Skip to content

Commit d6b4baa

Browse files
committed
Test that Dataset and DataArray resampling are identical
1 parent e258b88 commit d6b4baa

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
@@ -3593,6 +3593,19 @@ def test_resample_old_api(self):
35933593
with raises_regex(TypeError, r"resample\(\) no longer supports"):
35943594
ds.resample("1D", dim="time")
35953595

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

0 commit comments

Comments
 (0)