encoder only.Expand description
Xue bundles as Zarr v3 stores, written straight from their codes.
Two layouts, both normative in docs/zarr-profile.md, and both mirroring
xuebuild/zarrstore.py, the reference, byte for byte. A shared store
(profile 2, bundles[.<tier>].zarr) holds every bundle of one resolution
tier: write_bundle_arrays writes one bundle’s arrays and the
coordinates its dimension names name into it, write_part the partial
group document over the bundles one build wrote. The store’s zarr.json
itself is never written here: the reference’s finalize_store merges the
parts into it, so the group document has one implementation. A
one-bundle store (profile 1, write_store) is what a series store
is.
Documents are serialized the way Python’s json.dumps(..., indent=2, ensure_ascii=False) does, plus a trailing newline; inner chunks are
padded and compressed by the same one-shot zstd call, with the same shard
index and CRC-32C. A bundle’s arrays are a function of its metadata, its
codes, its tile, each variable’s predictor and its dimension names, so
nothing here reads a container. Every chunk is decompressed again right
after it is compressed and compared with what went in, and every document
written is parsed back by the decoder’s own store validators
(crate::zarr), the store’s counterpart of the container’s full
read-back.
Structs§
- Bundle
Write - One bundle written into a shared store (
BundleWritein the reference). - Store
Codes - A bundle’s codes as the writer reads them.
- Store
Report - What one store write produced: the manifest descriptor’s three values
plus the report fields
ExportReport.to_dictcarries. - Store
Variable - One variable’s codes: its planes in axis order, each
width * height. - Wide
Planes - Sixteen-bit planes held in memory, in axis order.
- Wide
Variable - One widened variable of a series store: its codes, by the id its
StoreVariable(whose byte planes are then empty) names.
Constants§
- DIMENSIONS
- The primary dimension names, which are also the store’s primary coordinate arrays.
- PART_
PREFIX - File name prefix of a partial group document inside a shared store
(
zarr.part.<first bundle id>.json). - SERIES_
BLOCK - The spatial block of a series store,
(width, height). - SHARED_
PROFILE_ VERSION - The
xue_profileof a shared store (bundles[.<tier>].zarr). - SHARED_
STORE_ STEM - The reserved stem of a shared store; no bundle may be named it.
- TIME_
CHUNK - Frames per time chunk of a map store: the bundle’s own group length, on a regular grid.
- ZSTD_
LEVEL - The inner chunks’ zstd level, which the array documents declare.
Traits§
- Wide
Codes - A widened variable’s sixteen-bit codes, which a series store reads a band
of rows at a time rather than holding the whole axis: planes in memory
(
WidePlanes), or a build’s spool on disk.
Functions§
- code_
data_ type - A code array’s
data_type:uint16exactly when the codebook’s nodata code does not fit a byte, which only a series codebook’s does (docs/zarr-profile.md, “Series store”);uint8otherwise. The reference’scode_data_type. - compression_
pool - The compression pool a caller outside the crate hands to
write_store. - group_
document - A shared store’s group document over
bundles, in manifest order (group_documentin the reference). - is_
coordinate_ suffix ^[a-z][a-z0-9]*$: a bundle id, and the suffix of a coordinate named for a grid family.- part_
path <store>/zarr.part.<first bundle id>.json: a build’s bundles are disjoint from every other build’s of the same run, so the first one names the part uniquely.- series_
metadata - A series store’s metadata: the bundle’s, with each variable named in
quantizationsholding that block as itsquantization, the codes the store holds for it. The key keeps its place, so everything else, key order included, is the bundle’s, and a series store with no widened variable carries the bundle’s metadata exactly. The reference’sseries_metadata. - shared_
store_ name bundles.zarrfor the full tier,bundles.<tier>.zarrfor a rung of the resolution ladder.- write_
bundle_ arrays - Write one bundle’s variable arrays and the coordinate arrays its
dimensionsname into the shared storestore, which is created if absent and otherwise left as it is: other bundles’ arrays, written before or concurrently, stay. The group document is not touched. - write_
part - The partial group document over the bundles one build wrote into
store, in manifest order:group_documentover them alone, atpart_pathof the first. Returns its path and its CRC-32, which the build’s entries carry until the reference’sfinalize_storewrites the store’s group document from the parts. - write_
store - Write one bundle’s store at
store(replaced whole).seriescuts the series layout over that block instead of the map layout;deltaputsxue.deltain front ofbyteson every previous-predicted variable. - write_
store_ widened write_storefor a series store whosewidevariables hold sixteen-bit codes: the metadata names their series codebooks (series_metadata), theirStoreVariables carry no byte planes, and their arrays areuint16.