issues: 1689655334
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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1689655334 | I_kwDOAMm_X85kthgm | 7797 | More `groupby` indexing problems | 39069044 | closed | 0 | 1 | 2023-04-29T18:58:11Z | 2023-05-02T14:48:43Z | 2023-05-02T14:48:43Z | CONTRIBUTOR | What happened?There is still something wrong with the groupby indexing changes from ```python import numpy as np import xarray as xr monthly timeseries that should return "zero anomalies" everywheretime = xr.date_range("2023-01-01", "2023-12-31", freq="MS") data = np.linspace(-1, 1, 12) x = xr.DataArray(data, coords={"time": time}) clim = xr.DataArray(data, coords={"month": np.arange(1, 13, 1)}) seems to give the correct result if we use the full x, but not with a slicex_slice = x.sel(time=["2023-04-01"]) two typical ways of computing anomaliesanom_gb = x_slice.groupby("time.month") - clim anom_sel = x_slice - clim.sel(month=x_slice.time.dt.month) passes on 2023.3.0, fails on 2023.4.2the groupby version is aligning the indexes wrong, giving us something other than 0assert anom_sel.equals(anom_gb) ``` Related: #7759 #7766 cc @dcherian What did you expect to happen?No response Minimal Complete Verifiable ExampleNo response MVCE confirmation
Relevant log outputNo response Anything else we need to know?No response Environment |
{
"url": "https://api.github.com/repos/pydata/xarray/issues/7797/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} |
completed | 13221727 | issue |