问题描述
刚刚升级到python3.8,我已经将xarray更新到v.0.16,但是现在我总是收到以下警告:
/usr/local/lib/python3.8/dist-packages/xarray/core/common.py:1123: FutureWarning: 'base' in .resample() and in Grouper() is deprecated.
The new arguments that you should use are 'offset' or 'origin'.
>>> df.resample(freq="3s",base=2)
becomes:
>>> df.resample(freq="3s",offset="2s")
grouper = pd.Grouper(
我脚本中使用.resample的唯一要点是:
mydata = xr.open_dataset(ncfile).resample(time='3H').reduce(np.mean)
但是我不知道如何更改它以避免警告。
解决方法
在xarray中对此进行更新之前,可以通过调用warnings.filterwarnings
忽略警告。
欢迎您在GitHub上为xarray(甚至是PR!)打开一个问题