Constants¶
String constants used in store metadata. Importing them turns a typo into an import error.
Format constants for the Zarr Vectors (ZV) format.
These are the canonical names, prefixes, and default values used throughout the specification. Changing a value here changes it everywhere in the package.
- zarr_vectors.constants.CAP_DENSE_MANIFESTS: str = 'dense_manifests'¶
At least one level’s object index is (or will be written) in the dense layout,
"dense_manifests_v1": fixed-width integer arrays rather than one vlen blob per object. Stamped with the root’smanifest_layout: "dense".
- zarr_vectors.constants.CAP_FRAGMENT_INDEX: str = 'fragment_index'¶
The store uses the v0.6 fragment-index encoding for
vertex_fragmentsandlink_fragments(single uint8 blob per chunk; seezarr_vectors.encoding.fragments).Reserved, not stamped: every store this package writes uses that encoding, and each sidecar array declares it itself (
encoding: "fragment_index_v1"in its own metadata), which is what readers consult. Rootformat_capabilitiesnever carries this token, so no reader may require it.
- zarr_vectors.constants.CAP_MULTISCALE_LINKS: str = 'multiscale_links'¶
Store uses the multiscale links layout (
links/<delta>/<offsets>/andlink_attributes/<name>/<delta>/<offsets>/) and may contain cross-pyramid-level edges (delta != 0). Since 0.9.0 there is no separate cross-chunk family — a cross-chunk link is a link with a non-zero offsets segment — so this token now marks only the presence ofdelta != 0arrays.
- zarr_vectors.constants.CAP_OCTREE_CHUNKS: str = 'octree_chunks'¶
its per-chunk arrays hold one cell per octree leaf (an aligned cube of the uniform grid’s cells, sized by its vertex count), at the leaf’s minimum-corner cell, with cross-leaf links named by
(offset, depth change). A reader without it must not read such a level: it would take each leaf for one uniform cell. Readers that do not check capabilities are stopped by zarr itself: the level’s per-chunk arrays carry thezarr_vectors_octree_chunkscodec (zarr_vectors.encoding.octree_marker), which a zarr reader must know to open them. Listed in the root’srequired_capabilitiesas well asformat_capabilities, for the same span, so a viewer that checks the first can refuse the store with a clear message. Optional, and converted to and from uniform chunks byzarr_vectors.octree_chunks.- Type:
A level of the store has octree chunks
- zarr_vectors.constants.CAP_OCTREE_SHARDING: str = 'octree_sharding'¶
its sharded per-chunk arrays are written with zarr-octree’s
octree_shardingcodec (zarr_octree_shardingbefore 0.4; cells grouped into the leaves of an octree aimed at a target size, and a sparse shard index) instead ofsharding_indexed. Stamped with the root’soctree_shardingblock (the codec’s configuration); set at construction (Layout(octree=...)) or byzarr_vectors.sharding.set_octree(), which converts either way. Reading or writing such an array needs the zarr-octree package. Optional and additive: absent meanssharding_indexed, as every other store.- Type:
The store is marked octree
- zarr_vectors.constants.CAP_PRESERVED_OBJECT_IDS: str = 'preserved_object_ids'¶
At least one resolution level was written with ID-preserving sparsification (
preserves_object_ids=Trueon the level metadata). A dropped object keeps its id as an empty manifest slot, so ids stay stable across levels, andparent_levelcarries semantic weight. (Pre-0.8.1 this also meant a zeroedpresent_maskbyte; that sidecar is gone – presence is the manifest being empty.)
- zarr_vectors.constants.CAP_SHARED_FRAGMENTS: str = 'shared_fragments'¶
At least one resolution level stores per-chunk fragments that may be referenced by multiple objects’ manifests (the v0.6 successor to
shared_vertex_groups; the sharing primitive is now a fragment rather than a contiguous-byte vertex group).
- zarr_vectors.constants.COARSEN_PER_OBJECT: str = 'per_object'¶
each surviving object’s vertices are aggregated into bin centroids (metavertices). Metavertices may be shared between objects; OIDs are preserved across levels.
- Type:
Per-object pyramid
- zarr_vectors.constants.DEFAULT_AXES_NAMES: tuple[str, ...] = ('x', 'y', 'z', 'w')¶
Default axis names used when
create_storeis called without an explicitaxeskwarg. Indexed bysid_ndim(1 →("x",), 2 →("x", "y"), …). Stops at 4 dims; higher-dim stores must pass axes explicitly.
- zarr_vectors.constants.DEFAULT_BIN_RATIO: tuple[int, ...] = (1, 1, 1)¶
Bin ratio at level 0 (no downsampling).
- zarr_vectors.constants.DEFAULT_BOUNDS_SIDE: float = 128.0¶
Default per-dimension extent for a freshly-warmed store. When
create_store(path)is called with noboundskwarg, the store is created withbounds = ([0,...,0], [128,...,128])for the resolvedsid_ndim. Out-of-bounds writes raise unless anout_of_bounds=policy is supplied by the caller.
- zarr_vectors.constants.DEFAULT_CROSS_LEVEL_DEPTH: int = 1¶
emit
±1cross-level link arrays at every adjacent level pair.0disables,-1means all available pyramid levels.- Type:
Default
cross_level_depth
- zarr_vectors.constants.DEFAULT_CROSS_LEVEL_STORAGE: str = 'explicit'¶
materialize both
+N(at the finer level) and-N(at the coarser level).- Type:
Default
cross_level_storage
- zarr_vectors.constants.DEFAULT_OOB_POLICY: str = 'raise'¶
Default
out_of_boundspolicy applied by the top-level write functions when the caller does not specify one. Values:"raise"(reject the write),"ignore"(silently drop out-of-bounds vertices),"expand"(grow storeboundsto include the new data).
- zarr_vectors.constants.DEFAULT_REDUCTION_FACTOR: int = 8¶
only emit a new resolution level when vertex count drops by 8×.
- Type:
Default
- zarr_vectors.constants.DICTIONARY_ENCODING: str = 'dictionary'¶
encodingstamped on a dictionary-encoded (categorical) attribute: integer codes, withcategories[code]recovering the value.
- zarr_vectors.constants.FORMAT_VERSION: str = '0.10.0'¶
Current ZV specification version.
0.10.0: the metadata moves onto the Zarr Vectors convention (https://github.com/Andrew-Keenlyside/zarr-vectors, v0.1.0). Cell payloads are byte-for-byte those of 0.9.4; only where metadata lives changes, so 0.9.x stores migrate in place with
zarr_vectors.building.migrate_metadata_0_10()and no data is rewritten.Every node’s Zarr Vectors properties sit under one attribute,
zarr_vectors, discriminated bykind:root,level,parametric, or an array kind. Array fields (dtype,name,nonempty_chunks, …) move inside it,zarr_vectors_levelbecomeszarr_vectorswithkind: "level", and the level’szarr_vectors_presencebecomes itspresencefield. Two array kinds are renamed:attribute->vertex_attributeandgroupings_attribute->group_attribute. In memory, array metadata keeps its flatzv_arrayshape (zarr_vectors.core.convention).zarr_conventionsregisters the convention on every such node, and the multiscales (and, with a CRS, proj) conventions on the root.Axes move from NGFF
multiscales[0].axesintozarr_vectors.axes.The bare-root OME-NGFF 0.4
multiscaleslist – which pointeddatasetsat groups and reusedscale/translationfor bin geometry – is replaced by the registered multiscales convention’s{"layout": [{"asset": "<level>"}]}, with notransform: vertex coordinates are the same at every level, so there is no coordinate transform to state. A coarse level’sbin_shapeandbin_ratiolive only in its ownzarr_vectorsobject.crsleaves the root object for the proj convention’sproj:projjson.
A 0.9.x reader cannot read a 0.10.0 store, and this package refuses a 0.9.x store with
UnsupportedFormatVersionErrornaming the migration.0.9.4: an optional dense object-index layout,
"dense_manifests_v1":object_index/manifest_spans(int64 (n_objects, 2), start and count) indexingobject_index/manifest_blocks(int64 (n_blocks, sid_ndim + 1), chunk coordinates then fragment index, one row per fragment an object references), withobject_index/object_idsas in the V2 vlen layout. Chosen per store by the root’smanifest_layout: "dense"(absent means vlen, so every 0.9.3 store reads unchanged), and declared by thedense_manifestscapability. A store that uses it is not readable by a 0.9.3 build, whose object index reader rejects the unknownlayoutwith an error rather than misreading it.0.9.3: optional, backward-compatible
shard_shapeon the root (absent ⇒ unsharded, so 0.9.0-0.9.2 stores read unchanged). Cells per shard per axis – anintwhen every axis agrees, a list when they do not.The store’s declared PACKING, which had nowhere to live before. Sharding was per-array and per-call: a writer passed
shard_shape=and the arrays that call created were sharded, while every array allocated later – an attribute array or links segment made on first write, in a worker that never saw the argument – came out flat. Recording it on the root is what lets those paths find it.create_store(shard_shape=)previously had no parameter at all, so the value was absorbed by**backend_kwargsand dropped without a word.Additive: no reader needs it. Sharding is transparent to any conformant Zarr v3 reader, and each array’s own
zarr.jsonremains the truth about that array – this is a writer default, not a claim about what is on disk, which is why it is a field rather than aformat_capabilitiestoken. A 0.9.2 reader ignoring the key reads the store correctly.Also in 0.9.3, both additive in the same sense:
The root
omescene’sworldcoordinate system carriesidbesidename, so a collection elsewhere can bind an edge to it; a reader that looks fornamefinds it unchanged.A per-chunk array may omit
nonempty_chunks, meaning presence is not recorded and a reader takes it from the store. That happens only while a level declares presence"deferred"(from 0.10.0 the level object’spresencefield) – a build-time state that the coordinator’s rebuild ends, restoring every manifest – so a finished store is readable by a 0.9.2 reader. One caught mid-build is not: that reader treats the missing manifest as an empty array.
0.9.2: optional, backward-compatible
omeblock on the root (absent ⇒ the prior behaviour, so 0.9.0 and 0.9.1 stores read unchanged). It is an OME-Zarr RFC 8 node —version,type: "collection",name, onezv:levelleaf per resolution level, and ascenedeclaring theworldcoordinate system with the store’s axes and units. That is what an OME collection elsewhere needs in order to name this store by path: a resolver following{"type": "zarr", "path": "./x.zarrvectors"}fetches the rootzarr.jsonand looks for a legal node underome, and before 0.9.2 there was none. Declaringworldis what makes the membership useful rather than merely legal — a viewer can place the store beside an image pyramid.Additive in the strict sense: nothing moved, nothing was removed, and no reader in this package or downstream consults the block. Every field in it restates one already carried by
zarr_vectorsormultiscales, which remain the source of truth. Re-seating the format on RFC 8 — dropping the repurposedcoordinateTransformations, minting node types for the arrays, collapsing the attribute discriminators — is the separate 0.10.0 change; this block is forward-compatible with it. Because it only adds, an existing store can be brought up to it in place, without rewriting data:zarr_vectors.building.stamp_ome_node(). Seezarr_vectors.core.ome.0.9.1: optional, backward-compatible
attribute_specsblock on the root (absent ⇒ the prior behaviour, so 0.9.0 stores read unchanged). It records what a store declares its attributes to be, by scope —{"vertex": {"intensity": {"dtype": "float32", "unit": "microvolt"}}, "object": {...}, "link": {...}}— so azarr_vectors.api.schema.Schemaround-trips throughSchema.from_storeandopen_or_createcan report a store that is missing an attribute the caller declared. A declaration is not a promise the array exists; the array appears when data is written.unitanddescriptionare additionally stamped onto the attribute array’s own metadata block when it is written. No migration: an undeclared store is simply undeclared.0.9.0: single-array layout for every per-spatial-chunk array. Each logical array —
vertices,vertex_fragments,link_fragments,links/<delta>,vertex_attributes/<name>,fragment_attributes/<name>,link_attributes/<name>/<delta>— is now ONE Zarr v3 vlen-bytes array whose shape is the level’s chunk grid (<array>/zarr.json+ one chunk file per cell at<array>/c/i/j/k), replacing the previous “Option G” layout where every spatial chunk was its own single-chunkuint8sub-array under a per-array group. A spatial chunk at absolute coordclands in cellc - originwhereorigin = floor(min_corner / chunk_shape)is stored as the array’schunk_grid_originattribute (absent ⇒ zero origin); this lets data with negative coordinates map onto a 0-indexed array. Non-empty cells are tracked in the array’snonempty_chunksattribute for O(1) enumeration. Optionalshard_shape=wraps the cells in the Zarr v3sharding_indexedcodec. Hard break: 0.8.x stores wrote per-chunk sub-arrays and cannot be read; rewrite from source.0.9.0 also merges
cross_chunk_links/cross_chunk_link_attributesintolinks/link_attributes. Connectivity is ONE family: an intra-chunk link is just a link whose relative chunk offset is zero.links/<delta>becomes a group whose children are one rank-D vlen array per relative-offset segment —links/<delta>/<offsets>, cell = the record’s SOURCE chunk,vi_klocal tosrc + o_k— andlink_attributes/<name>/<delta>/<offsets>mirrors it exactly (same offsets, same cells, same row order). Endpoint tuples are no longer part of any path, so both families are ordinary chunk-grid arrays and shard like everything else. Seezarr_vectors.core.paths.0.8.1: flat single-array layout for dense / ragged blobs. Removes the
group-with-data-childpattern used by every non-spatial array (object_attributes, group_attributes, groups, parametric blobs, composite links) and writes each logical array as a single standard Zarr v3 array at its logical path. Sparse coverage is expressed via the array’sfill_value(NaN for floats, sentinel for integers) instead of a siblingpresent_maskchild array. Ragged arrays move to vlen-bytes codec, matching the layoutobject_index/manifestsalready used. Custom per-array attrs move from the parent group’sattributesinto the array’s ownattributesblock. Hard break: 0.8.0 stores are not readable; rewrite from source.0.8.1 also adds three optional, backward-compatible fields to the
cross_chunk_links/<delta>/family.zattrs(absent ⇒ the prior behaviour, so existing 0.8.1 stores read unchanged):directed(bool; when true endpoint order is preserved andA→B/B→Aare distinct cells — used by streamline and skeleton parent→child edges),store("canonical"= one cell per record, or"duplicate"= one cell per distinct incident chunk for prefix-scan incidence reads), andnum_physical_records(on-disk row count,> num_linkswhen duplicated).num_linksremains the logical record count. A decentralizedwrite_cross_chunk_link_cells+finalize_cross_chunk_linkspair lets independent workers append into disjoint cells race-free. (That family and those helpers were merged intolinks/after 0.8.1 — seedocs/spec/object_model/links.mdfor the layout that replaced it.)0.8.0: per-tuple
cross_chunk_linkslayout. The global flatcross_chunk_links/<delta>/datablob is replaced by per-cell arrays keyed on the canonical-sorted L-tuple of endpoint chunks (cross_chunk_links/<delta>/<chunk_0.x.y.z>.<chunk_1.x.y.z>...) where L =link_width. Each cell stores only the records spanning that exact chunk-tuple — readers scale with cell size, not store size. Endpoint order is preserved via a Lehmer-codedperm_idxint64 per record so mesh-face winding and directed- edge direction survive the canonical sort.write_cross_chunk_linksreturns aCrossChunkLinkPartitioninstead of anint; legacy callers can stillint(partition)for thefirst_newfield. Hard break: 0.7.x stores are not readable; rewrite from source.0.7.0: per-level
chunk_shape.RootMetadata.chunk_shaperemains the level-0 default;LevelMetadatagains an optionalchunk_shapefield that, when set, overrides root for that level. Required invariant: per-levelchunk_shapemust be a positive integer multiple of the rootchunk_shapealong every axis (nested chunk grids). This lets coarser pyramid levels use larger chunks the way OME-Zarr image pyramids grow physical chunk extent via voxel-size scaling. Cross-level link arrays keep the single-chunk-key convention; the differing level’s chunk coord is computed by integer division using the per-level chunk_shape ratio. Hard break: 0.6.x stores are not readable; rewrite from source.0.6.0: fragment-index schema. Replaces
vertex_group_offsetswithvertex_fragmentsand splits the v0.5 inline-header link blob into a flatlinks/0/<chunk>payload plus a siblinglink_fragments/<chunk>group. The fragment-index byte layout expresses each per-group boundary as either a contiguous index range[start, count)or an explicit list of row indices, supporting vertex re-use across fragments.object_index/datanow uses a per-chunk manifest-block format with single / range / explicit modes; cross-level link arrays (cross_chunk_links,delta != 0) are unchanged. Hard break: 0.5.x stores are not readable; rewrite from source.0.5.0: NGFF-alignment cleanup + format simplification. The 0.5 series went through several on-disk simplifications without a version bump (consumers should pin to a specific point release):
vertex_counts/per-chunk sidecars removed; per-chunk vertex counts are derived fromvertex_group_offsetsand thevertices/<key>blob size.vertex_group_offsets/<key>is a plain(K,)int64 array of vertex byte offsets (the legacy(K, 2)paired layout with a link-offset column is gone).attributes/<name>/<key>_offsetssibling blobs removed. Attribute groups align 1:1 with vertex groups; per-group byte offsets are computed at read time.metanode_children/removed. Pyramid drill-down uses thelinks/<+1>/+cross_chunk_links/<+1>/arrays emitted inline during coarsening (mirrored as-1on the coarse side undercross_level_storage="explicit").cross_chunk_faces/removed. Cross-chunk face identity usescross_chunk_links/<delta>/withlink_width=3. Thecross_chunk_linksarray carries alink_widthmetadata field (default 2 for edges).object_index/pending/staging tree removed. Incremental writes go directly intoobject_index/; transactional backends (icechunk) make this cheap.
Earlier 0.5 changes (now baseline): renamed
format_versiontozv_version, moved axes tomultiscales[0].axes, dropped per-array dtype duplication.0.4.1: bare-integer resolution-level group names (
0/,1/).
- zarr_vectors.constants.FRAGMENT_ATTRIBUTES: str = 'fragment_attributes'¶
Per-fragment attribute arrays. Dense per-chunk blob with one row per fragment in that chunk (
(F,)or(F, C)). Optional — used when callers want to materialize per-fragment data, including parent-IDs (e.g. anobject_idfragment attribute carrying the OID that owns each fragment).
- zarr_vectors.constants.LINKS: str = 'links'¶
Connectivity family.
links/<delta>is a group; its children are one rank-D vlen array per relative-offset segment (links/<delta>/<offsets>). There is no array atlinks/<delta>itself — compose paths viazarr_vectors.core.paths.
- zarr_vectors.constants.LINK_ATTRIBUTES: str = 'link_attributes'¶
Per-link attribute family.
link_attributes/<name>/<delta>is a group mirroringlinks/<delta>: one array per offsets segment, same cells, same per-cell row order, so attribute rows align 1:1 with link records without storing a row id.
- zarr_vectors.constants.LINK_FRAGMENTS: str = 'link_fragments'¶
Per-chunk fragment-index describing how rows of the intra-chunk link array group into fragments. Keyed by chunk ALONE — it carries no delta and no offsets segment — so exactly one array may write it: the all-zero-offsets array at
delta == 0(links/0/<intra offsets>/<chunk>). Every other offset array, and everydelta != 0array, uses an inline self-describing blob and has no sidecar; seezarr_vectors.core.arrays.write_chunk_links().
- zarr_vectors.constants.OCTREE_CODEC_NAMES: tuple[str, ...] = ('octree_sharding', 'zarr_octree_sharding')¶
octree_sharding(its zarr-extensions registry name, written since zarr-octree 0.4) andzarr_octree_sharding(written by zarr-octree 0.3 and earlier, and still read). An array whose first codec has either name is octree-sharded.- Type:
Names zarr-octree’s codec is stored under
- zarr_vectors.constants.OME_ATTRS_KEY: str = 'ome'¶
Root-attribute key the
omeblock lives under. Reserved by NGFF 0.5+.
- zarr_vectors.constants.OME_VERSION: str = '0.6'¶
NGFF version stamped on the node.
"0.6": RFC 8 is a proposal and is not part of NGFF 0.5, so the node declares the next NGFF version, the one RFC 8 targets. Until RFC 8 lands that version is not settled; it is a single constant so that correcting it is a one-line change.RFC 8 requires
versionon the root node of a document and forbids it on any other, so it appears here and nowhere else in the store.
- zarr_vectors.constants.PARAMETRIC_GROUP: str = 'parametric'¶
Name of the root-level parametric objects group.
- zarr_vectors.constants.RESOLUTION_PREFIX: str = ''¶
Empty under the 0.4.1 layout — resolution level groups are bare integer names (
0,1, …) to mirror OME-Zarr’s convention. Retained as a symbol so callers that build paths viaf"{RESOLUTION_PREFIX}{n}"keep working without import churn.
- zarr_vectors.constants.VERTEX_FRAGMENTS: str = 'vertex_fragments'¶
Per-chunk fragment-index group describing how rows of
vertices/<chunk>group into fragments. Seezarr_vectors.encoding.fragments.
Geometry type values¶
Constant |
Value |
Use |
|---|---|---|
|
|
Unconnected vertices |
|
|
Independent line segment pairs |
|
|
Ordered vertex paths |
|
|
Tractography paths with metadata |
|
|
Arbitrary vertex–edge graph |
|
|
Tree-structured morphology (SWC-compatible) |
|
|
Triangulated surface mesh |