Skip to content
forked from pydata/xarray

Commit

Permalink
Add test for pydata#757
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Sep 20, 2024
1 parent 339ed3a commit 93e786b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions xarray/tests/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -3004,6 +3004,15 @@ def test_lazy_int_bins_error():
_ = BinGrouper(bins=4).factorize(DataArray(dask.array.arange(3)))


def test_time_grouping_seasons_specified():
time = xr.date_range("2001-01-01", "2002-01-01", freq="D")
ds = xr.Dataset({"foo": np.arange(time.size)}, coords={"time": ("time", time)})
labels = ["DJF", "MAM", "JJA", "SON"]
actual = ds.groupby({"time.season": UniqueGrouper(labels=labels)}).sum()
expected = ds.groupby("time.season").sum()
assert_identical(actual, expected.reindex(season=labels))


# Possible property tests
# 1. lambda x: x
# 2. grouped-reduce on unique coords is identical to array
Expand Down

0 comments on commit 93e786b

Please sign in to comment.