Skip to content

Commit 10ab072

Browse files
committed
Test that Dataset and DataArray resampling are identical
1 parent 3f9069b commit 10ab072

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

xarray/tests/test_dataset.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3594,6 +3594,19 @@ def test_resample_old_api(self):
35943594
with raises_regex(TypeError, r"resample\(\) no longer supports"):
35953595
ds.resample("1D", dim="time")
35963596

3597+
def test_resample_ds_da_are_the_same(self):
3598+
time = pd.date_range("2000-01-01", freq="6H", periods=365 * 4)
3599+
ds = xr.Dataset(
3600+
{
3601+
"foo": (("time", "x"), np.random.randn(365 * 4, 5)),
3602+
"time": time,
3603+
"x": np.arange(5),
3604+
}
3605+
)
3606+
assert_identical(
3607+
ds.resample(time="M").mean()["foo"], ds.foo.resample(time="M").mean()
3608+
)
3609+
35973610
def test_ds_resample_apply_func_args(self):
35983611
def func(arg1, arg2, arg3=0.0):
35993612
return arg1.mean("time") + arg2 + arg3

0 commit comments

Comments
 (0)