diff --git a/flox/xarray.py b/flox/xarray.py index faebc468e..100d5fb4a 100644 --- a/flox/xarray.py +++ b/flox/xarray.py @@ -1,5 +1,6 @@ from __future__ import annotations +import warnings from typing import TYPE_CHECKING, Any, Hashable, Iterable, Sequence, Union import numpy as np @@ -565,6 +566,11 @@ def resample_reduce( **kwargs, ): + warnings.warn( + "flox.xarray.resample_reduce is now deprecated. Please use Xarray's resample method directly.", + DeprecationWarning, + ) + obj = resampler._obj dim = resampler._group_dim diff --git a/tests/test_xarray.py b/tests/test_xarray.py index 995e1daaa..0bee41c15 100644 --- a/tests/test_xarray.py +++ b/tests/test_xarray.py @@ -254,10 +254,15 @@ def test_xarray_resample(chunklen, isdask, dataarray, engine): ds = ds.air resampler = ds.resample(time="M") - actual = resample_reduce(resampler, "mean", engine=engine) + with pytest.warns(DeprecationWarning): + actual = resample_reduce(resampler, "mean", engine=engine) expected = resampler.mean() xr.testing.assert_allclose(actual, expected) + with xr.set_options(use_flox=True): + actual = resampler.mean() + xr.testing.assert_allclose(actual, expected) + @requires_dask def test_xarray_resample_dataset_multiple_arrays(engine):