Skip to content

zarr: sharded storage (Zarr v3 / OME-NGFF 0.5) as a chunk strategy - #48

Merged
trissim merged 1 commit into
mainfrom
zarr-sharding
Nov 20, 2026
Merged

trissim merged 1 commit into
mainfrom
zarr-sharding

Conversation

@trissim

@trissim trissim commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Adds ZarrChunkStrategy.SHARDED: each plane its own chunk inside one shard object per array (plane-level random access, one file per well).

  • Each strategy member owns a ZarrLayout (chunks, shards, NGFF format, compressor form); the backend's two write paths ask it through one _array_layout. _calculate_chunks and the v2-only compressor= argument are gone.
  • The sharded layout writes Zarr v3 / NGFF 0.5 with the specification's codecs (blosc, zstd, gzip for zlib); standalone LZ4 uses numcodecs' v3 wrapper, as the specification has no codec for it.
  • WELL and FILE output is unchanged (Zarr v2 / NGFF 0.4).

Tests: 607 passed, 5 skipped. New: layout shapes, a one-object round trip with every compressor, a sharded well batch through its filename mapping.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XbFMSmfWxP4Wnm2cFnvSCk

ZarrChunkStrategy.SHARDED stores each plane as its own chunk inside one shard object per
array: plane-level random access with one file per well, where FILE writes one object per
plane and WELL makes the whole well a single chunk.

Each strategy member now owns a ZarrLayout: its chunk shape, its shard shape, the NGFF format
that can describe it, and the form its compressor takes in that format. The backend asks the
layout through one _array_layout for both write paths (save and save_batch), replacing
_calculate_chunks and the v2-only compressor argument. Sharding exists only in Zarr v3, so
the sharded layout writes NGFF 0.5 and each compressor factory states its v3 codec: the
specification's own codec where it has one (blosc, zstd, gzip for zlib), numcodecs' wrapper
only for standalone LZ4, which the specification lacks.

Tests: 607 passed. New: the sharded layout's chunk and shard shapes, a one-object round trip
with every compressor (chunks that do not divide the array included), and a sharded well
batch loaded back through its filename mapping.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XbFMSmfWxP4Wnm2cFnvSCk
@trissim
trissim merged commit 34ec357 into main Nov 20, 2026
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