Skip to content

Commit

Permalink
Test that Dataset and DataArray resampling are identical
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Oct 22, 2019
1 parent e258b88 commit d6b4baa
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 d6b4baa

Please sign in to comment.