Skip to content

Commit a0ab10f

Browse files
committed
Combo resample/groupby test
1 parent 875f57c commit a0ab10f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

xarray/tests/test_groupby.py

+12
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
BinGrouper,
1919
EncodedGroups,
2020
Grouper,
21+
TimeResampler,
2122
UniqueGrouper,
2223
)
2324
from xarray.tests import (
@@ -2693,3 +2694,14 @@ def test_weather_data_resample(use_flox):
26932694
with xr.set_options(use_flox=use_flox):
26942695
actual = ds.resample(time="1MS").mean()
26952696
assert "location" in actual._indexes
2697+
2698+
gb = ds.groupby(time=TimeResampler(freq="1MS"), location=UniqueGrouper())
2699+
with xr.set_options(use_flox=use_flox):
2700+
actual = gb.mean()
2701+
expected = ds.resample(time="1MS").mean().sortby("location")
2702+
assert_allclose(actual, expected)
2703+
assert actual.time.attrs == ds.time.attrs
2704+
assert actual.location.attrs == ds.location.attrs
2705+
2706+
assert expected.time.attrs == ds.time.attrs
2707+
assert expected.location.attrs == ds.location.attrs

0 commit comments

Comments
 (0)