()
| 2752 | |
| 2753 | |
| 2754 | def test_groupby_binary_op_regression() -> None: |
| 2755 | # regression test for #7797 |
| 2756 | # monthly timeseries that should return "zero anomalies" everywhere |
| 2757 | time = xr.date_range("2023-01-01", "2023-12-31", freq="MS") |
| 2758 | data = np.linspace(-1, 1, 12) |
| 2759 | x = xr.DataArray(data, coords={"time": time}) |
| 2760 | clim = xr.DataArray(data, coords={"month": np.arange(1, 13, 1)}) |
| 2761 | |
| 2762 | # seems to give the correct result if we use the full x, but not with a slice |
| 2763 | x_slice = x.sel(time=["2023-04-01"]) |
| 2764 | |
| 2765 | # two typical ways of computing anomalies |
| 2766 | anom_gb = x_slice.groupby("time.month") - clim |
| 2767 | |
| 2768 | assert_identical(xr.zeros_like(anom_gb), anom_gb) |
| 2769 | |
| 2770 | |
| 2771 | def test_groupby_multiindex_level() -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…