-
Notifications
You must be signed in to change notification settings - Fork 22
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
Chunk-aligned indexing #183
base: main
Are you sure you want to change the base?
Conversation
marr = create_manifestarray(shape=(4,), chunks=(2,)) | ||
marr[0:2] | ||
marr[2:4] | ||
marr[0:4] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to come back and improve these placeholder tests
if chunk_length == 1: | ||
# alot of indexing is possible only in this case, because this is basically just a normal array along that axis | ||
chunk_slice = array_slice | ||
return chunk_slice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of interesting to realise this. You can even do things like slice(None, None, -1)
to reverse the array in this case.
def _array_slice_to_chunk_slice( | ||
array_slice: slice, | ||
arr_length: int, | ||
chunk_length: int, | ||
) -> slice: | ||
""" | ||
Translate a slice into an array into a corresponding slice into the underlying chunk grid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
indexer = _possibly_expand_trailing_ellipsis(key, self.ndim) | ||
# _validate_indexer(indexer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(probably don't need this as separate function)
Allows you to subset
ManifestArray
objects, as long as your indexer slice aligns with chunk boundaries.docs/releases.rst
api.rst