-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add chunk grid logic #141
Add chunk grid logic #141
Conversation
Hey Ryan! I noticed that this approach seems a lot like XArray-Beams's I'd love to talk more about the approach you're taking here, and how we can generalize this pattern. |
d84b0b8
to
36a10ee
Compare
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.
Note that the overall effect of this is to shift the reasoning about chunks, overlaps, subsets, etc. into an abstract, standalone class where the logic can be clearly implemented and thoroughly tested.
dim_idx.index | ||
for dim_idx in chunk_key | ||
if dim_idx.operation == CombineOp.SUBSET and dim_idx.name == concat_dim | ||
][0] |
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.
Note how we no longer need this opaque logic in this function. It now lives in ChunkGrid.
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.
(and the new chunk_position
function, which translates a ChunkKey to a chunk index)
for conflict_index in conflict: | ||
this_chunk_conflicts.add(conflict_index) | ||
|
||
return {concat_dim: region_slice}, this_chunk_conflicts |
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.
Same. All this code goes away.
This is a first start on closing #140 and #98.
Let's create a new abstract class called ChunkGrid that understands about the mapping between chunk indexes and array slices and implement methods to find the overlap / intersection between different grids. Then we can refactor XarrayZarrRecipe to use this rather than its current impenetrable logic.
This is definitely WIP; just wanted to push something to get the conversation started.