flox
flox copied to clipboard
Unable to assign flox method and quantile method in xarray_reduce
Reproducible example:
import xarray as xr
from flox.xarray import xarray_reduce
labels = xr.DataArray(
[1, 2, 3, 1, 2, 3, 0, 0, 0],
dims="x",
name="label",
)
finalize_kwargs = dict(q=[0.1,0.5,0.9], method = "hazen")
da = xr.ones_like(labels)
xarray_reduce(da, labels, func="quantile", method = "blockwise", **finalize_kwargs)
Output:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: flox.xarray.xarray_reduce() got multiple values for keyword argument 'method'
Sigh, nice find. I should probably just allow finalize_kwargs or rename method to strategy.
Either way only method="linear" has been implemented yet. Are you interested in fixing that?
https://github.com/xarray-contrib/flox/blob/b0cabf3dc5beb0d3429bc1e7dbe08a7479beb7cb/flox/aggregate_flox.py#L109-L110
I'm not sure I have the chops to do that. Using the default method="linear" is fine for me at the moment but I thought it'd be helpful to point out this issue either way.