Skip to content

apply_ufunc with dictionary or set arguments #7861

Answered by dcherian
hassec asked this question in Q&A
Discussion options

You must be logged in to vote

To pass arbitrary things, pass them as kwargs.

The variables in *args (here x, y, z) are interpreted as array-like. So dicts won't really work or sets, which are unordered, won't work well.

xr.apply_ufunc(test, x, y, z, input_core_dims=((), (), ("z")), vectorize=True))

Instead try

xr.apply_ufunc(test, x, y, input_core_dims=((), ()), kwargs={"z": z}, vectorize=True))

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@hassec
Comment options

@kmuehlbauer
Comment options

Answer selected by dcherian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants