Zarr v2 and v3 chunked array storage for MoonBit
moon add zlhahaha/zarr@0.10.1python -m pip install zarr==3.4.0 numpy==2.5.3
python scripts/verify_zarr_npy_roi.py --download --batch --output-dir _build/zarr-npy-batch| Capability | Zarr v2 | Zarr v3 |
|---|---|---|
| Parse regular-grid array metadata | Yes, common string dtypes | Yes, common string data types |
| Metadata and chunk keys | . and / separators | default and v2-compatible encodings |
| Raw encoded chunk storage | Memory and native filesystem | Memory and native filesystem |
| Safe single-key filesystem replacement | Native: exclusive sibling staging + replace | Native: exclusive sibling staging + replace |
| bool element and slice I/O | Memory and native filesystem | Memory and native filesystem; bytes codec |
| uint8 element and slice I/O | Memory and native filesystem; C/F order | Memory and native filesystem; bytes codec |
| int8 element and slice I/O (Int API, range-checked) | Memory and native filesystem; C/F order | Memory and native filesystem; bytes codec |
| uint16 element and slice I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| int16 element and slice I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| uint32 element and slice I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| float64 element I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| float32 element I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| int32 element I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| int64 element and slice I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| uint64 element and slice I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| Rectangular slice I/O (all listed types) | Memory and native filesystem | Memory and native filesystem |
| Incremental N-D tile traversal | chunk.RegionTileCursor, caller reads each bounded tile | Same; no whole-result allocation by the cursor |
| gzip compression (levels 0–9) | Read/write | Read/write after bytes codec |
| zstd compression (levels 0–22) | Read/write | Read/write after bytes codec, with or without frame checksum |
| zlib compression (levels 0–9) | Read/write | Not a v3 core codec |
| Blosc1 frames (LZ4/LZ4HC/Zlib/Zstd; no, byte or bit shuffle) | LZ4 read/write; LZ4HC/Zlib/Zstd read-only; BloscLZ unsupported | LZ4 read/write after bytes codec; LZ4HC/Zlib/Zstd read-only; BloscLZ unsupported |
| Other dtypes, filters and codecs | Planned | Planned |
| Groups, ancestors and attributes | Memory and native filesystem (.zgroup/.zattrs) | Memory and native filesystem (zarr.json) |
| Consolidated metadata | Read-only native .zmetadata snapshot | Read-only native inline root zarr.json snapshot (zarr-python convention) |
| HTTP read-only regional hydration | Native, bounded metadata/chunk downloads | Native, bounded ordinary or shard-index/payload byte-range downloads |
| Sharding-indexed codec | Not a v2 codec | Native filesystem and HTTP/S3 reads; native whole-shard writes for uint8/uint16/float32; start/end index, index endian and optional CRC32C; no partial-shard or remote writes |
| S3-compatible object storage | Native, read-only regional hydration | Native, read-only ordinary/sharded regional hydration; anonymous or explicit SigV4 credentials |
| Explicit group children and breadth-first traversal | Memory, native filesystem (including consolidated snapshots), S3 | Same; signed S3 pagination, bounded nodes/depth/entries |
| Structured remote diagnostics | HTTP/S3 _result APIs; legacy optional APIs retained | Same; metadata, transport/authentication, budgets and shard/Range failures |
python -m pip install zarr==3.4.0 numpy==2.5.3
python scripts/verify_real_volume_pipeline.py --download --trials 1 --output _build/ct-trial.jsonpython scripts/demo_volume_pipeline.py --download --output-dir _build/ct-showcasemoon add zlhahaha/zarr@0.10.1moon add moonbitlang/async@0.20.3git clone https://github.com/zlhahaha/zarr.git
cd zarr
moon update
moon run --target wasm-gc cmd/main
moon run --target wasm-gc cmd/discovery_demo
moon run --target native cmd/native_demo
moon run --target native cmd/v2_demo
moon run --target native cmd/budget_demo
moon run --target native cmd/nd_demo
moon run --target native cmd/tile_demo
moon run --target native cmd/real_bonsai # optional: accesses a public AWS dataset
moon run --target native cmd/real_bonsai --volume # optional: eight real compressed chunksmoon check --target native --deny-warn
moon build --target native
moon test --target native --deny-warn
moon check --target wasm-gc --deny-warn
moon build --target wasm-gc
moon test --target wasm-gc --deny-warn
moon run --target wasm-gc cmd/main
moon run --target native cmd/native_demo
moon run --target native cmd/v2_demo
moon run --target native cmd/tile_demometadata/ Parse and validate v2/v3 array and group documents
chunk/ Regular-grid indexing and metadata/chunk keys
shard/ V3 sharding layout, bounded indexes and encoded packing
dtype/ Numeric dtype and fill-value checks
codec/ Codec-chain validation and bounded gzip/zlib/zstd decode
store/ In-memory encoded-byte store and structured AccessError
store/fs/ Native-only filesystem store
store/http/ Native-only read-only HTTP regional hydration
store/s3/ Native-only read-only S3-compatible adapter with SigV4
array/ Typed array creation, element and region I/O
hierarchy/ Group/attribute operations and shared node discovery
scan/ Portable typed tile reader (no prefetch or result collection)
scan/async/ Native async reader for filesystem/custom sources
scan/remote/ Automatic HTTP/S3 typed tile hydration and decode
integration/ Cross-package tests
cmd/main/ Portable in-memory v3 example
cmd/discovery_demo/ Portable explicit hierarchy traversal and limits
cmd/native_demo/ Native filesystem v3 example
cmd/v2_demo/ Native filesystem v2 example
cmd/budget_demo/ Native read-budget rejection and recovery example
cmd/nd_demo/ Native 3D image / 4D feature-tensor example
cmd/nd_interop/ N-D reverse interoperability generator
cmd/shard_interop/ Complete-shard reverse interoperability generator
cmd/tile_demo/ Full logical 256 MiB scan using bounded tile reads
cmd/real_bonsai/ Optional live public OME-Zarr AWS read example
cmd/benchmark/ Native read latency and OS peak-memory instrumentation
cmd/scan_benchmark/ Real 3D HTTP tile histogram and memory measurements
cmd/metrics/ Shared native OS benchmark instrumentation
scripts/ Independent data generation, interoperability and benchmarks
examples/volume_pipeline/ Independent crop/normalize/shard application module