html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/issues/3741#issuecomment-738070264,https://api.github.com/repos/pydata/xarray/issues/3741,738070264,MDEyOklzc3VlQ29tbWVudDczODA3MDI2NA==,4264660,2020-12-03T15:15:37Z,2020-12-03T15:15:37Z,NONE,"As a workaround, it's possible to use rolling and .sel to keep only adjacent windows: ```python ds Dimensions: (x: 237, y: 69, z: 2) Coordinates: * x (x) int64 0 1 2 3 4 5 6 7 8 ... 228 229 230 231 232 233 234 235 236 * y (y) int64 0 1 2 3 4 5 6 7 8 9 10 ... 59 60 61 62 63 64 65 66 67 68 * z (z) int64 0 1 Data variables: data2D (x, y) float64 dask.array data3D (x, y, z) float64 dask.array # window size window = {'x' : 51, 'y' : 21} # window dims, prefixed by 'k_' window_dims = {k: ""k_%s"" % k for k in window.keys()} # dataset, with new dims as window. .sel drop sliding windows, to keep only adjacent ones. ds_win = ds.rolling(window,center=True).construct(window_dims).sel( {k: slice(window[k]//2,None,window[k]) for k in window.keys()}) Dimensions: (k_x: 51, k_y: 21, x: 5, y: 3, z: 2) Coordinates: * x (x) int64 25 76 127 178 229 * y (y) int64 10 31 52 * z (z) int64 0 1 Dimensions without coordinates: k_x, k_y Data variables: data2D (x, y, k_x, k_y) float64 dask.array data3D (x, y, z, k_x, k_y) float64 dask.array # now, use reduce on a standard dataset, using window k_dims as dimensions ds_red = ds_win.reduce(np.mean,dim=window_dims.values()) Dimensions: (x: 5, y: 3, z: 2) Coordinates: * x (x) int64 25 76 127 178 229 * y (y) int64 10 31 52 * z (z) int64 0 1 Data variables: data2D (x, y) float64 dask.array data3D (x, y, z) float64 dask.array ``` Note that i was unable to use `unique`, because the size of the result depend on the data. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,558519267 https://github.com/pydata/xarray/issues/3741#issuecomment-657803276,https://api.github.com/repos/pydata/xarray/issues/3741,657803276,MDEyOklzc3VlQ29tbWVudDY1NzgwMzI3Ng==,2448579,2020-07-13T21:29:58Z,2020-07-13T21:29:58Z,MEMBER,coarsen is pretty similar to rolling AFAIR so it may not be too hard to implement a `.reduce` method.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,558519267 https://github.com/pydata/xarray/issues/3741#issuecomment-657793175,https://api.github.com/repos/pydata/xarray/issues/3741,657793175,MDEyOklzc3VlQ29tbWVudDY1Nzc5MzE3NQ==,14662821,2020-07-13T21:04:57Z,2020-07-13T21:04:57Z,CONTRIBUTOR,👍 that would be super useful!,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,558519267