/zarr-chunk-optimization:synthetic-datafrom zarr-chunk-optimization
Generates reproducible synthetic Zarr arrays or samples from existing Zarr stores for chunking benchmarks. Useful when production data is unavailable, restricted, or too large to copy.
Ships in zarr-chunk-optimization. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Generates reproducible synthetic Zarr arrays, or cuts a leading-dimension sample from an existing Zarr array, as input for chunking benchmarks.
Core principle: synthetic data fixes shape, chunks and dtype, not content. Every pattern is noise-dominated and compresses about 1.1–2x; real scientific data often compresses 2–10x. Compare chunk shapes and access patterns with it, not codecs or absolute read times.
When NOT to use:
--sample-from, or ds.isel(...) as in chunking-strategy).access-pattern-analysis.chunking-strategy. Rewriting real data: rechunking. Writing up results: performance-reporting.Run from this skill's directory; python scripts/synthetic_data.py --help lists every flag.
# Climate-like, 0.88 GiB float32 (chunks 22.6 MiB)
python scripts/synthetic_data.py --output /tmp/climate.zarr \
--shape 3650,180,360 --chunks 365,90,180 \
--dims time,lat,lon --pattern temperature --seed 42
# Radio-like, 15.6 GiB float32 (chunks 12.5 MiB); --compression none isolates raw I/O
python scripts/synthetic_data.py --output /tmp/radio.zarr \
--shape 1000,2048,2048 --chunks 50,256,256 \
--dims time,frequency,baseline --pattern radio --compression none --seed 42
# To S3 (s3fs + AWS credentials), 1.95 GiB
python scripts/synthetic_data.py --output s3://bucket/synthetic.zarr \
--shape 500,1024,1024 --chunks 50,256,256 --seed 42
# First ~8 GiB along dim 0 of an existing Zarr v3 array (loads the whole sample into RAM)
python scripts/synthetic_data.py --sample-from /data/full.zarr/temperature \
--output /tmp/sample.zarr --target-size 8
--pattern | Content | zstd ratio |
|---|---|---|
random (default) | N(0, 1) noise | ~1.1x |
temperature | lat+lon gradient × sine over dim 0, plus noise | ~1.25x |
radio | real amplitudes |N + iN|, not complex values | ~1.1x |
constant | 100 + 0.01·N(0, 1) | ~2x |
Ratios measured on a 100×256×256 float32 array. references/dataset-design.md covers what --help omits: codec mapping, dtype casting, sampling, cloud URLs, seeding. assets/synthetic-config-example.json records a run; the script has no --config flag.
import numpy as np, zarr
z = zarr.open("/tmp/climate.zarr", mode="r")
assert (z.shape, z.chunks, z.dtype) == ((3650, 180, 360), (365, 90, 180), np.float32)
print(dict(z.attrs)) # dimensions, pattern_type, created_by (the seed is not stored)
sample = z[0:5]
assert np.isfinite(sample).all() and sample.std() > 0
| Mistake | Fix |
|---|---|
Opening the output with xr.open_zarr | It raises ContainsArrayError: the store is a bare array, not a group. chunking-strategy's benchmark_runner.py opens it as is; for your own xarray code, wrap it as a Dataset (see the reference). |
| Picking a codec from synthetic results | Noise barely compresses: you measure codec CPU cost without the I/O saving. |
--dtype int16 or complex64 | Values are generated as float32 and cast: int16 holds a handful of small integers, complex has a zero imaginary part. |
--sample-from store.zarr on an xarray store | It is a group ('Group' object has no attribute 'shape'); point at the variable, store.zarr/<var>. |
| Different shape or dtype, same seed | Data is identical only for identical shape, dtype, pattern and seed. Record the full command. |
| Chunks that do not divide the shape | Use even divisors of the shape to avoid partial edge chunks. |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (uw-ssec/savvy) — no native marketplace selected
npx claudepluginhub p/uw-ssec-zarr-chunk-optimization-plugins-zarr-chunk-optimization5 skills in this plugin
/access-pattern-analysisUse when choosing or benchmarking Zarr chunk shapes and the read workload is not yet written down; when a user describes their work informally ("I make maps", "I pull time series at stations", "I look at spectra"); when several teams or workflows share one dataset and need relative weights; or when reads are slow and the chunk layout may not match how the data is read./chunking-strategyUse when choosing or tuning Zarr chunk shapes for a multi-dimensional scientific array on S3, GCS or local disk, when map reads or time-series reads from a Zarr store are slow or run out of memory, or when comparing candidate chunk configurations by wall-clock time, peak memory or performance bias (Nguyen et al. 2023) before rechunking./performance-reportingOther plugins' skills for the same job