Skip to content

Conversation

TomNicholas
Copy link
Member

Allows you to subset ManifestArray objects, as long as your indexer slice aligns with chunk boundaries.

@TomNicholas TomNicholas added the enhancement New feature or request label Jul 11, 2024
Comment on lines +344 to +347
marr = create_manifestarray(shape=(4,), chunks=(2,))
marr[0:2]
marr[2:4]
marr[0:4]
Copy link
Member Author

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

Comment on lines +329 to +332
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
Copy link
Member Author

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.

Comment on lines +318 to +324
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.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@d-v-b this is a first step in the direction of #71

indexer_nd = indexer

indexer = _possibly_expand_trailing_ellipsis(key, self.ndim)
# _validate_indexer(indexer)
Copy link
Member Author

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)

@TomNicholas TomNicholas added this to the v2.0.0 milestone Feb 27, 2025
@TomNicholas TomNicholas changed the base branch from main to develop March 22, 2025 00:37
@maxrjones maxrjones modified the milestones: v2.0.0, v2.0.1 Jul 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support indexing by slicing along chunk boundaries?

2 participants