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

running numpy functions on xarray objects #3917

Open
keewis opened this issue Mar 29, 2020 · 1 comment
Open

running numpy functions on xarray objects #3917

keewis opened this issue Mar 29, 2020 · 1 comment
Labels
topic-arrays related to flexible array support

Comments

@keewis
Copy link
Collaborator

keewis commented Mar 29, 2020

In the pint integration tests I tried to also test calling numpy functions on xarray objects (we provide methods for all of them).

Some of these functions, like numpy.median, numpy.searchsorted and numpy.clip, depend on __array_function__ (i.e. not __array_ufunc__) to dispatch. However, neither Dataset nor DataArray (nor Variable, I think?) define these protocols (see #3643).

Should we define __array_function__ on xarray objects?

@shoyer
Copy link
Member

shoyer commented Apr 9, 2020

I think this is probably a good idea, assuming we figure out the type casting hierarchy challenge. Right now people often check for the existence of __array_function__ to indicate NumPy duck arrays, which clearly isn't quite right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-arrays related to flexible array support
Projects
None yet
Development

No branches or pull requests

3 participants