Skip to content

Support blosc 'shuffle' of -1 in v2 metadata - #102

Merged
normanrz merged 2 commits into
zarr-developers:mainfrom
stefanhahmann:fix-blosc-autoshuffle
Sep 9, 2026
Merged

Support blosc 'shuffle' of -1 in v2 metadata#102
normanrz merged 2 commits into
zarr-developers:mainfrom
stefanhahmann:fix-blosc-autoshuffle

Conversation

@stefanhahmann

Copy link
Copy Markdown
Contributor

Zarr v2 arrays written by other implementations may have "shuffle": -1 (blosc picks the variant at write time). Reading them failed with ArrayIndexOutOfBoundsException from Shuffle.values()[-1].

The actual variant is stored in the chunk header, so decoding is unaffected; -1 now maps to BYTE_SHUFFLE, and other unknown values give a readable parse error.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Comment thread src/main/java/dev/zarr/zarrjava/v2/codec/core/BloscCodec.java Outdated
Blosc's -1 means bit shuffle for single-byte items and byte shuffle
otherwise. Since numcodecs omits 'typesize' from the .zarray metadata,
the item size is only known once the data type has been read, so the
variant is derived again when the codec is evolved.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@normanrz
normanrz merged commit fc418e8 into zarr-developers:main Sep 9, 2026
3 checks passed
@stefanhahmann
stefanhahmann deleted the fix-blosc-autoshuffle branch September 9, 2026 14:19
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.

2 participants