Skip to content

Feature Request: Advanced indexing without oindex and vindex #926

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

Closed
Ha5hBr0wn opened this issue Dec 24, 2021 · 2 comments
Closed

Feature Request: Advanced indexing without oindex and vindex #926

Ha5hBr0wn opened this issue Dec 24, 2021 · 2 comments

Comments

@Ha5hBr0wn
Copy link

Ha5hBr0wn commented Dec 24, 2021

Hi,

I have just begun to use zarr and it is great thank you!

The one thing I find mildly annoying is having to write oindex and vindex when doing advanced slicing. This is because I am writing functions that can handle either an in memory numpy array or a zarr.core.Array. So a lot of code ends up looking like

if type(x) == zarr.core.Array:
    # slice with oindex or vindex

else:
    # slice with numpy 

whenever the slice involves advanced indexing.

It seems like all the support is already there just hiding behind different names. It would be great if such checks were not necessary and if slicing matched numpy API, both semantically and syntactically. It looks to me that the semantic part is already done, part of oindex functionality is even beyond that of numpy slicing, doing something that I typically use two slices for, but that could just stay as part of oindex.

Exact correspondence with numpy slicing could be a great selling point for zarr I think, and doesn't seem like a huge lift given that the semantics are already supported and the change seems like it would be backwards compatible (Although of course I could be very wrong about that as I don't know all the intricacies involved)

Also as far as I can tell oindex support boolean indexing as well but that is not documented.

@jakirkham
Copy link
Member

Some work along these lines was done in PR ( #725 )

@joshmoore
Copy link
Member

@Ha5hBr0wn: it would be great if you could try out a later version of Zarr (like the current 2.13) and see if it does what you need. I'm going to go ahead and close this issue because as @jakirkham says, some of this has been implemented. If you can give us an example of any additional advanced indexing you need in a new issue, that'd be great.

Thanks again.

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

No branches or pull requests

3 participants