Skip to content

fix(codecs): declare the astype output of numcodecs Quantize - #456

Draft
d-v-b wants to merge 2 commits into
mainfrom
fix/quantize-resolve-metadata
Draft

d-v-b wants to merge 2 commits into
mainfrom
fix/quantize-resolve-metadata

Conversation

@d-v-b

@d-v-b d-v-b commented Nov 16, 2026

Copy link
Copy Markdown
Owner

🤖 AI text below 🤖

Arrays that apply a zarr.codecs.numcodecs.Quantize filter whose astype differs from the array data type can now be read back. Previously writing succeeded, but reading failed with ValueError: cannot reshape array.

Agent notes
  • Quantize had no resolve_metadata, so the codecs after it were told the chunk still had the array data type. The bytes codec then encoded and decoded the astype values with the wrong item size.
  • Delta and FixedScaleOffset already had the same astype logic, copied in each class. All three now call a shared _resolve_astype helper.
  • Found while writing the zarr-extensions spec for numcodecs.quantize.
Tests
  • test_generic_filter_quantize is parametrized over astype (none, a narrower float, a wider float) and compares the read-back values with numcodecs' own encode/decode round trip, instead of a fixed tolerance.
  • The three astype cases fail on main with "cannot reshape" and pass with this change.
  • Full suite: 13371 passed, 1319 skipped, 9 xfailed. pre-commit passes.

🤖 Generated with Claude Code

Quantize with an astype that differs from the array data type wrote data that could not be read, because the wrapper did not declare its output data type. Share the astype resolution with Delta and FixedScaleOffset.

Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant