xr-scipy icon indicating copy to clipboard operation
xr-scipy copied to clipboard

apply_kwargs should be unpacked?

Open allen-adastra opened this issue 11 months ago • 1 comments

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,
            )

allen-adastra avatar Mar 13 '24 18:03 allen-adastra

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 !

hippalectryon-0 avatar Jul 23 '24 15:07 hippalectryon-0