Closed
Description
Code Sample, a copy-pastable example if possible
import xarray as xr
import numpy as np
x = np.arange(4.)
ds = xr.DataArray(x, dims=('dim', ))
ds.rolling(dim=3, center=True).mean()
# RESULT: array([nan, 1., 2., nan])
ds.rolling(dim=3, center=True).construct('window').mean('window')
# RESULT: array([0.5, 1. , 2. , 2.5])
Problem description
ds.rolling(...).mean()
and ds.rolling(...).construct().mean()
yields different results. Because mean
does skipna=True
per default.
Expected Output
I would expect both ways to yield the same result.
Output of xr.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.6.4.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.114-42-default
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: en_GB.UTF-8
xarray: 0.10.2+dev6.g9261601
pandas: 0.22.0
numpy: 1.14.2
scipy: 1.0.0
netCDF4: 1.3.1
h5netcdf: None
h5py: None
Nio: None
zarr: None
bottleneck: 1.2.1
cyordereddict: 1.0.0
dask: 0.17.1
distributed: 1.21.3
matplotlib: 2.2.2
cartopy: None
seaborn: None
setuptools: 39.0.1
pip: 9.0.2
conda: None
pytest: 3.4.2
IPython: 6.2.1
sphinx: None