xarray 触发未来警告

xarray firing a Future Warning

刚刚升级到 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!)打开一个问题