Skip to content

Commit

Permalink
Test that Dataset and DataArray resampling are identical (#3412)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian authored Oct 22, 2019
1 parent a3e43e6 commit 72be873
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions xarray/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3593,6 +3593,19 @@ def test_resample_old_api(self):
with raises_regex(TypeError, r"resample\(\) no longer supports"):
ds.resample("1D", dim="time")

def test_resample_ds_da_are_the_same(self):
time = pd.date_range("2000-01-01", freq="6H", periods=365 * 4)
ds = xr.Dataset(
{
"foo": (("time", "x"), np.random.randn(365 * 4, 5)),
"time": time,
"x": np.arange(5),
}
)
assert_identical(
ds.resample(time="M").mean()["foo"], ds.foo.resample(time="M").mean()
)

def test_ds_resample_apply_func_args(self):
def func(arg1, arg2, arg3=0.0):
return arg1.mean("time") + arg2 + arg3
Expand Down

0 comments on commit 72be873

Please sign in to comment.