Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that Dataset and DataArray resampling are identical #3412

Merged
merged 1 commit into from
Oct 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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