feat: Support variable chunking#877
Draft
maxrjones wants to merge 7 commits intozarr-developers:mainfrom
Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #877 +/- ##
==========================================
- Coverage 89.11% 88.93% -0.18%
==========================================
Files 34 35 +1
Lines 1956 1980 +24
==========================================
+ Hits 1743 1761 +18
- Misses 213 219 +6
🚀 New features to boost your workflow:
|
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: Mostly a proof of concept now to facilitate upstream reviews, but still opening for visibility
Overview
RectilinearChunkGrid(variable-length chunks), enabling VirtualiZarr to work with archival formats that have non-uniform chunk sizes (e.g., stripped TIFFs where image height isn't evenly divisible by rows per strip)RegularChunkGrid-only restriction fromManifestArrayand update the concatenation/stacking machinery to handle rectilinear chunk gridsvirtual-tiffand concatenates them withxr.concatDetails
Core changes:
ManifestArray.chunksnow returnschunk_grid.chunk_shapes(tuple of tuples) forRectilinearChunkGrid, rather than raisingNotImplementedError. Uses the same compatibility pattern as xarray: checknot isinstance(chunk_grid, RegularChunkGrid)behind ahas_rectilinear_chunk_grid_supportfeature flag, so it falls back gracefully on older zarr versionscopy_and_replace_metadatadetects nested chunk sequences (via vendored_is_nested_sequence) and creates the appropriate chunk grid type (regularvsrectilinear)stackcorrectly inserts a single-element tuple(1,)when adding a new axis to a rectilinear arraycheck_no_partial_chunks_on_concat_axisskips the check for rectilinear grids, which explicitly encode variable chunk sizes_is_nested_sequencefrom zarr-python#3534 intovirtualizarr/vendor/zarr/core/chunk_grids.pyfor detecting rectilinear chunk representationsCompatibility:
RectilinearChunkGrid)RectilinearChunkGridsupporttestenvironmentEnvironment:
rectilinearpixi environment with forked zarr-python, xarray, and virtual-tiff branchesChecklist
docs/releases.rstapi.rst