コメント:私は12ヶ月間の月平均を探していますあなたの解決策は、だけなので、すべての年はcoverdあり、1年間の月平均
2010-12まで2001-01からマイ最初出力開始を計算します。
あなたはresample
になりますかもう一度値を入力してください。
は、どのように私は12ヶ月間の月平均を得るのですか?
あなたが望むものを決定する必要があり
:1年のために年以内に毎月のための
平均、年ごとの12の値の結果、最大120個の値10年間で
または
平均、以下xarray.Dataset
、DATE_RANGE = 10年
date_range('2001-01-01', '2010-12-31', name='time')
<xarray.Dataset>
Dimensions: (time: 3652)
Coordinates:
* time (time) datetime64[ns] 2001-01-01 2001-01-02 2001-01-03 ...
Data variables:
data (time) float64 16.0 18.0 15.0 12.0 23.0 9.0 7.0 18.0 23.0 23.0 ...
0123を使用して10年
10の値の結果
date_range('2001-01-01', '2010-12-31', name='time')
に毎月のためのmonthly_avr
を取得します。
monthly_avr = ds.resample('1MS', dim='time', how='mean')
出力:
monthly_avr=<xarray.Dataset>
Dimensions: (time: 120)
Coordinates:
* time (time) datetime64[ns] 2001-01-01 2001-02-01 2001-03-01 ...
Data variables:
data (time) float64 17.42 16.54 19.23 18.37 14.74 17.8 16.45 17.29 ...
をdate_range('2001-01-01', '2010-12-31', name='time')
に毎年のためのyear_avr
を取得します。
year_avr = ds.resample('1AS', dim='time', how='mean')
出力:
year_avr=<xarray.Dataset> Dimensions: (time: 10) Coordinates: * time (time) datetime64[ns] 2001-01-01 2002-01-01 2003-01-01 ... Data variables: data (time) float64 17.22 17.13 17.05 17.49 17.38 17.07 16.72 16.47 ...
は、Pythonでテスト:3.4.2 - xarray:0.9。1
ありがとうございます@stovfl、私は12ヶ月間の月平均を探しています(2001年から2010年のすべての年)。あなたの解は1年間の月平均しか計算しません – user308827