Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support negative step size in indexing #637

Open
tomwhite opened this issue Dec 4, 2024 · 1 comment
Open

Support negative step size in indexing #637

tomwhite opened this issue Dec 4, 2024 · 1 comment

Comments

@tomwhite
Copy link
Member

tomwhite commented Dec 4, 2024

From @dcherian in #636 (comment)

https://github.com/pydata/xarray/blob/99ee8c6ca54057a9b994d7685f36236f2d5a69d9/xarray/core/indexing.py#L1084 and friends. We rewrite the query to normal slice with +ve stride, then reverse in-memory after read :)

This is one of Xarray's magic tricks that very few people know about. We guarantee consistent indexing API over any array for the most part.

In pydata/xarray#8667, I suggested reusing this machinery for cubed.

EDIT: actually my comment is here: pydata/xarray#8834 (comment)

@tomwhite
Copy link
Member Author

tomwhite commented Dec 4, 2024

Note that when this is implemented we should include array_api_tests/test_array_object.py::test_getitem in the array api tests agains as it was added to the skip list in #636.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant