-
Notifications
You must be signed in to change notification settings - Fork 10
Rectilinear (variable-length) chunk grid #25
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
base: main
Are you sure you want to change the base?
Conversation
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.
Looks good to me. Do we want to include a recommendation that implementations SHOULD use run length encoding where appropriate when saving metadata?
Implementation here: zarrs/zarrs#284
|
This is ready for review. I would like to include a small, complete array that demonstrates this chunk grid, and a JSON schema for the metadata. |
normanrz
left a comment
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.
Thanks, @d-v-b!
This PR fulfills all requirements to be merged and is a great addition to zarr-extensions.
Schema JSON and examples would be great. Do you wish add these in this PR or in a later one?
|
I leave that to you. Let me know, when you want this PR merged. |
|
If we want to support negative chunk indices (in order to allow expansion in the negative direction) then we need to be able to specify the sizes of the negative chunks also. For a regular grid it is sufficient to have a single grid_origin parameter that specifies the start of chunk 0 in array index space. But for the rectilinear grid we need to specify both the position in array index space and the position in chunk index space of the start of the chunk size list. |
|
Another thing that has been suggested in the past is to allow the logical size of a chunk to differ from the physical size, i.e. allow chunks to be stored with unused padding at both the start and end. For every chunk, you need to specify the physical size, logical size, and offset of the start of the logical chunk within the physical chunk. This would allow you to insert and remove elements in the middle of a dimension without having to re-encode chunks, just rename them. And by using kerchunk or icechunk or OCDBT the renaming could be done "virtually". To avoid even having to rename you could allow an arbitrary virtual to physical chunk index map, where you remap the chunk index also. |
|
Speaking for Zarr Python, these would require some work to implement -- in particular, we will need to introduce a new array indexing API to work with negative indices that aren't referenced to the end of an array. So for that reason I'm inclined to keep this chunk grid simple for now, provided we are confident we can safely extend it in the future. I think using additional keys in the configuration + defining new variants of the "kind" field to overload the meaning of |
|
The kind should arguably be per-dimension rather than apply to all dimensions. Perhaps the kind could be indicated by the type of the json value instead. |
Our intention for |
What I meant is that you may want the chunk sizes for one dimension to be stored in a separate 1-d array, but another dimension might have uniform chunking or sizes specified inline in the metadata. |
Opening this PR with a draft of a rectilinear chunk grid spec