Skip to content

Getting xarray.apply_ufunc and np.linalg.pinv to work with dask.array #7503

Answered by TomNicholas
tomchor asked this question in Q&A
Discussion options

You must be logged in to vote

You were almost there, you just needed to add the sizes of new the output dimensions by including the kwarg

dask_gufunc_kwargs={'output_sizes': {'i': 2, 'j': 3}}

It does sort of say this in the docstring for apply_ufunc but it could definitely be clearer!

That's a very unhelpful error, but it's ultimately being thrown because the keys 'i' and 'j' don't exist in the dict of expected sizes of the output (because you didn't provide them). We should improve that error!

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@TomNicholas
Comment options

@TomNicholas
Comment options

@TomNicholas
Comment options

@tomchor
Comment options

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