Skip to content

Revert "Implement NumPy's __array_function__ protocol for array methods that are not in the Array API Standard" - #469

Merged
tomwhite merged 1 commit into
mainfrom
revert-468-np-array-function
May 22, 2024
Merged

tomwhite merged 1 commit into
mainfrom
revert-468-np-array-function

Conversation

@tomwhite

Copy link
Copy Markdown
Member

Reverts #468

This is causing problems when running with xarray, so I'm reverting it for the time being.

@tomwhite
tomwhite merged commit 8143af7 into main May 22, 2024
@TomNicholas

Copy link
Copy Markdown
Member

Can you elaborate on what exactly goes wrong with this approach?

@tomwhite

Copy link
Copy Markdown
Member Author

Can you elaborate on what exactly goes wrong with this approach?

Yes, of course. With this change Xarray now thinks that it can use NdArrayLikeIndexingAdapter for indexing, rather than ArrayApiIndexingAdapter, see

https://github.com/pydata/xarray/blob/12123be8608f3a90c6a6d8a1cdc4845126492364/xarray/core/indexing.py#L874-L877

Switching the order here (i.e. check for__array_namespace__ before __array_function__) would work in this case, but I'm not sure if it has other implications. Otherwise I'm not sure how to fix this, since there doesn't seem to be much progress on standardising the NaN functions any time soon.

Any thoughts about how to proceed?

@TomNicholas

Copy link
Copy Markdown
Member

Thoughts in pydata/xarray#8834 (comment)

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

Successfully merging this pull request may close these issues.

2 participants