You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is still something wrong with the groupby indexing changes from 2023.04.0 onward. Here are two typical ways of doing a seasonal anomaly calculation, which return the same result on 2023.03.0 but are different on 2023.04.2:
importnumpyasnpimportxarrayasxr# 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") -climanom_sel=x_slice-clim.sel(month=x_slice.time.dt.month)
# passes on 2023.3.0, fails on 2023.4.2# the groupby version is aligning the indexes wrong, giving us something other than 0assertanom_sel.equals(anom_gb)
What happened?
There is still something wrong with the groupby indexing changes from
2023.04.0
onward. Here are two typical ways of doing a seasonal anomaly calculation, which return the same result on2023.03.0
but are different on2023.04.2
:Related: #7759 #7766
cc @dcherian
What did you expect to happen?
No response
Minimal Complete Verifiable Example
No response
MVCE confirmation
Relevant log output
No response
Anything else we need to know?
No response
Environment
The text was updated successfully, but these errors were encountered: