id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 666880880,MDU6SXNzdWU2NjY4ODA4ODA=,4278,Skipna not working in DataArray.rolling.mean ,12862013,closed,0,,,5,2020-07-28T08:32:41Z,2022-09-06T10:39:02Z,2020-07-29T11:17:23Z,CONTRIBUTOR,,,,"**What happened**: I tried to calculate a rolling mean or median, ignoring nan's **Minimal Complete Verifiable Example**: ```python >>> da = xr.DataArray([1.0, 2, 3, np.nan, 5, 6]) >>> da.rolling(dim_0 = 3).mean(skipna=True) array([nan, nan, 2., nan, nan, nan]) Dimensions without coordinates: dim_0 ``` I expected this array to have have no nans. There is a simple workaround that does give the answer I was looking for: ```python >>> da.rolling(dim_0 = 3).construct(""new"").mean(""new"", skipna=True) array([1. , 1.5, 2. , 2.5, 4. , 5.5]) Dimensions without coordinates: dim_0 ``` **Anything else we need to know?**: Love the project ;-) **Environment**:
Output of xr.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.8.3 (default, May 16 2020, 07:08:28) [GCC 8.3.0] python-bits: 64 OS: Linux OS-release: 4.19.76-linuxkit machine: x86_64 processor: byteorder: little LC_ALL: None LANG: C.UTF-8 LOCALE: en_US.UTF-8 libhdf5: None libnetcdf: None xarray: 0.16.0 pandas: 1.0.5 numpy: 1.19.1 scipy: None netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: None cartopy: None seaborn: None numbagg: None pint: None setuptools: 46.4.0 pip: 20.1.1 conda: None pytest: None IPython: 7.16.1 sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4278/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 546791416,MDU6SXNzdWU1NDY3OTE0MTY=,3671,rolling.construct alignment,12862013,closed,0,,,4,2020-01-08T11:03:28Z,2020-01-11T02:24:21Z,2020-01-11T02:24:21Z,CONTRIBUTOR,,,,"Hello xarray team I was trying to implement functionality similar to Scikit Image's [view_as_windows](https://scikit-image.org/docs/dev/api/skimage.util.html#skimage.util.view_as_windows), but I was having a hard time with the boundary conditions. I understand this request is very similar to rolling with periodic boundary conditions #2007. #### MCVE Code Sample ```python >>> arr = xr.DataArray(np.arange(4), dims=(""x"",)) >>> arr.rolling(x=2).construct(""roll_x"", stride=2) array([[nan, 0.], [ 1., 2.]]) Dimensions without coordinates: x, roll_x ``` #### Expected Output It would be nice to be able to easily get an output of: ```python array([[0., 1.], [2., 3.]]) Dimensions without coordinates: x, roll_x ``` #### Possible workarounds With the upcoming features of pad (#3596) and rolling: periodic (#2011) it is actually not that hard to work around with: ```python arr.pad(x=(1,0)).rolling(x=2).construct(""roll_x"", stride=2).isel(x=slice(1,None)) # or arr.roll(x=-1).rolling(x=2, boundary=""periodic"").construct(""roll_x"", stride=2) ``` #### Idea Would it be possible to add a keyword argument to either `rolling()` or `construct()` that expects an alignment of ""left"", ""right"" or ""center"". I understand that this could break interface copied from Pandas, but I hope it could be useful to others as well. ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3671/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue