Skip to content

Commit e15ff14

Browse files
DHRUVA KUMAR KAUSHALDHRUVA KUMAR KAUSHAL
authored andcommitted
precommit
1 parent 99b5845 commit e15ff14

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

xarray/tests/test_dataset.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,29 +1141,28 @@ def test_chunks_does_not_load_data(self) -> None:
11411141
[(True, "standard"), (False, "standard"), (True, "noleap"), (True, "360_day")],
11421142
)
11431143
def test_chunk_by_season_resampler(self, use_cftime: bool, calendar: str) -> None:
1144-
# With 2 years of data starting Jan 1, we get 9 seasonal chunks:
1145-
# partial DJF (Jan-Feb), MAM, JJA, SON, DJF, MAM, JJA, SON, partial DJF (Dec)
11461144
ds = xr.Dataset(
11471145
{"foo": (("x", "time"), np.ones((10, 365 * 2)))},
11481146
coords={
11491147
"x": np.arange(10),
11501148
"time": pd.date_range("2000-01-01", periods=365 * 2),
11511149
},
11521150
)
1153-
rechunked = ds.chunk({"x": 2, "time": SeasonResampler()})
1151+
1152+
# Standard seasons
1153+
rechunked = ds.chunk(
1154+
{"x": 2, "time": SeasonResampler(["DJF", "MAM", "JJA", "SON"])}
1155+
)
11541156
assert len(rechunked.chunksizes["time"]) == 9
11551157
assert rechunked.chunksizes["x"] == (2,) * 5
1156-
# Write out the actual chunks tuple for clarity
11571158
assert rechunked.chunksizes["time"] == (31, 92, 92, 92, 31, 92, 92, 92, 31)
11581159

1159-
# Test custom seasons
1160+
# Custom seasons
11601161
rechunked = ds.chunk(
11611162
{"x": 2, "time": SeasonResampler(["DJFM", "AM", "JJA", "SON"])}
11621163
)
1163-
# Custom seasons also produce boundary chunks
11641164
assert len(rechunked.chunksizes["time"]) == 9
11651165
assert rechunked.chunksizes["x"] == (2,) * 5
1166-
# Write out the actual chunks tuple for clarity
11671166
assert rechunked.chunksizes["time"] == (120, 61, 92, 92, 120, 61, 92, 92, 120)
11681167
"""Test chunking using SeasonResampler."""
11691168
import dask.array

0 commit comments

Comments
 (0)