issues: 507471865
This data as json
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
507471865 | MDU6SXNzdWU1MDc0NzE4NjU= | 3402 | reduce() by multiple dims on groupby object | 22454970 | closed | 0 | 2 | 2019-10-15T20:42:21Z | 2019-10-25T21:01:11Z | 2019-10-25T21:01:11Z | NONE | MCVE Code Sample```python Your code hereimport xarray as xr import numpy as np url = 'https://data.nodc.noaa.gov/thredds/dodsC/GCOS/monthly_five_degree/19810101-NODC-L3_GHRSST-SSTblend-GLOB_HadSST2-Monthly_FiveDeg_DayNitAvg_19810101_20071231-v01.7-fv01.0.nc' ds = xr.open_dataset(url, chunks=dict(time=12)) reduce() directly on dataArray - THIS IS OKds.analysed_sst.reduce(np.percentile, dim=('lat','lon'), q=0.5) # ok Group by examplerr = ds.analysed_sst.rolling(min_periods=1, center=True, time=5).construct("window") g = rr.groupby("time.dayofyear") print(g.dims) test1d = g.reduce(np.percentile, dim=('time'), q=0.5) # ok testall = g.reduce(np.percentile, dim=xr.ALL_DIMS, q=0.5) # ok .reduce() w/ 2dims on grouby obj not workingtest2d = g.reduce(np.nanpercentile, dim=('time','window'), q=0.5) ``` Expected Outputreduced output performed over multiple dimensions (but not xr.ALL_DIMS) on a groupby object Problem DescriptionUsing .reduce() on a groupby object is only successful when given a single dimensions or by using xr.ALL_DIMS. I wish to apply a reduce on a subset of dims (last line of code above) but gives folowing error:
Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3402/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |