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

apply_kwargs should be unpacked? #40

Open
allen-adastra opened this issue Mar 13, 2024 · 1 comment
Open

apply_kwargs should be unpacked? #40

allen-adastra opened this issue Mar 13, 2024 · 1 comment

Comments

@allen-adastra
Copy link

allen-adastra commented Mar 13, 2024

Hello,

I'm working with dask, and I stumbled across the need to specify the dask="parallelized" argument to xr.apply_ufunc in frequency_filter. Currently, there is no way to do that.

One way to do it is to unpack apply_kwargs. I'm curious what the intent of that variable is.

Before:

            ret = xr.apply_ufunc(
                sosfiltfilt,
                sos,
                darray,
                input_core_dims=[[], [dim]],
                output_core_dims=[[dim]],
                kwargs=apply_kwargs,
            )

After:

            ret = xr.apply_ufunc(
                sosfiltfilt,
                sos,
                darray,
                input_core_dims=[[], [dim]],
                output_core_dims=[[dim]],
                **apply_kwargs,
            )
@hippalectryon-0
Copy link
Owner

It's all written in https://docs.xarray.dev/en/stable/generated/xarray.apply_ufunc.html :P
The kwargs are forwarded to the kwargs of the function being applied.

For the dask issue, feel free to open a PR !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants