Skip to content

Commit

Permalink
Fix direct quantile reduction (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian authored Mar 16, 2024
1 parent 382dc14 commit 20be463
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions flox/xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 20be463

Please sign in to comment.