Repository navigation
fix: preserve Numcodecs filter shape and decode order - #4558
Merged
Merged
Conversation
Restore the shape declared by the filter and normalize decode input to C order after a transpose. Extend the existing round-trip cases to cover a following TransposeCodec without relaxing exact array equality. The shape-restoration approach follows ghuls's draft in zarr-developers#4553. Signed-off-by: Don Yin <Don_Yin@outlook.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4558 +/- ##
=======================================
Coverage 94.90% 94.90%
=======================================
Files 96 96
Lines 14055 14055
=======================================
Hits 13339 13339
Misses 716 716
🚀 New features to boost your workflow:
|
|
Thanks for fixing it properly. |
…shape Resolve the conflict in src/zarr/codecs/numcodecs/_codecs.py by keeping main's encode reshape (from zarr-developers#4560) and this PR's C-contiguous decode input. Drop the PR's `TransposeCodec` import, which main already provides. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ecode order The shape fix on encode is already described by changes/4560.bugfix.md. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d-v-b
approved these changes
Nov 16, 2026
Contributor
|
I pushed some changes required to rebase, thanks @Don-Yin |
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.
Fixes #4553.
Some Numcodecs filters (e.g. PackBits) return a flat array, so a following TransposeCodec fails on write. This reshapes the encoded output to the shape from
resolve_metadata.Reshaping alone isn't enough: after undoing the transpose the array can be F-ordered, and Numcodecs decodes in memory order, so Delta and FixedScaleOffset round-trips come back scrambled. Making the input C-contiguous before decoding fixes that.
Builds on @ghuls's draft in the issue. The existing filter round-trip test now also runs with a following transpose.
TODO
docs/user-guide/*.md(n/a)changes/