From 20be463968b550f3ae431e2d61242814fb95a861 Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Fri, 15 Mar 2024 22:17:31 -0600 Subject: [PATCH] Fix direct quantile reduction (#343) --- flox/xarray.py | 1 + tests/test_xarray.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/flox/xarray.py b/flox/xarray.py index 0a299d6d..11cf706d 100644 --- a/flox/xarray.py +++ b/flox/xarray.py @@ -312,6 +312,7 @@ def xarray_reduce( # skipna is not supported for all reductions # https://github.com/pydata/xarray/issues/8819 kwargs = {"skipna": skipna} if skipna is not None else {} + kwargs.update(finalize_kwargs) result = getattr(ds_broad, func)(dim=dim_tuple, **kwargs) if isinstance(obj, xr.DataArray): return obj._from_temp_dataset(result) diff --git a/tests/test_xarray.py b/tests/test_xarray.py index 97b5674b..ecd63bbf 100644 --- a/tests/test_xarray.py +++ b/tests/test_xarray.py @@ -736,7 +736,7 @@ def test_direct_reduction(func): data = xr.DataArray(rand, dims=("x", "y"), coords={"x": [10, 20], "y": [0, 1, 2]}) with xr.set_options(use_flox=True): - actual = getattr(data.groupby("x", squeeze=False), func)(**kwargs) + actual = xarray_reduce(data, "x", func=func, **kwargs) with xr.set_options(use_flox=False): expected = getattr(data.groupby("x", squeeze=False), func)(**kwargs) xr.testing.assert_identical(expected, actual)