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

Unable to assign flox method and quantile method in xarray_reduce #340

Open
lassiterdc opened this issue Mar 14, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@lassiterdc
Copy link

lassiterdc commented Mar 14, 2024

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'
@dcherian
Copy link
Collaborator

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?

flox/flox/aggregate_flox.py

Lines 109 to 110 in b0cabf3

# TODO: could support all the interpolations here
gamma = np.broadcast_to(virtual_index, idxshape) - lo_

@dcherian dcherian added the bug Something isn't working label Mar 14, 2024
@lassiterdc
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants