Skip to content

Commit 93e786b

Browse files
committed
Add test for pydata#757
1 parent 339ed3a commit 93e786b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

xarray/tests/test_groupby.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3004,6 +3004,15 @@ def test_lazy_int_bins_error():
30043004
_ = BinGrouper(bins=4).factorize(DataArray(dask.array.arange(3)))
30053005

30063006

3007+
def test_time_grouping_seasons_specified():
3008+
time = xr.date_range("2001-01-01", "2002-01-01", freq="D")
3009+
ds = xr.Dataset({"foo": np.arange(time.size)}, coords={"time": ("time", time)})
3010+
labels = ["DJF", "MAM", "JJA", "SON"]
3011+
actual = ds.groupby({"time.season": UniqueGrouper(labels=labels)}).sum()
3012+
expected = ds.groupby("time.season").sum()
3013+
assert_identical(actual, expected.reindex(season=labels))
3014+
3015+
30073016
# Possible property tests
30083017
# 1. lambda x: x
30093018
# 2. grouped-reduce on unique coords is identical to array

0 commit comments

Comments
 (0)