8. Metadata¶
8.1 Metadata Structure¶
Zarr Vectors metadata is published as the
Zarr Vectors convention
v0.1.0, which covers format 0.10.0. It says what each node is and
how to interpret its cells; the byte layouts inside the cells are
defined in §7.
All metadata lives in the attributes of the Zarr v3 zarr.json
documents. Every node’s Zarr Vectors properties are held in one
attribute, zarr_vectors, whose required kind field names the node:
|
Node |
Fields |
|---|---|---|
|
store root (group) |
|
|
|
|
|
arrays of a level |
|
|
family groups of a level |
|
|
|
Every node with a zarr_vectors attribute also carries
zarr_conventions (§8.9).
The root also carries multiscales (§8.10),
proj:projjson when the store has a CRS
(§8.8), optionally ome
(§8.11), and optionally
user_metadata, which holds application metadata, one namespace per
application, and which the format neither reads nor validates.
Writers MUST NOT place Zarr Vectors fields outside the node’s
zarr_vectorsobject, nor application keys inside it. Other conventions MAY add prefixed keys (proj:…).Readers SHOULD ignore
zarr_vectorsfields they do not recognise. Anullfield means the same as an absent one.A writer that rewrites a node MUST keep attributes that belong to other conventions or to applications.
The normative JSON Schema is the convention’s schema.json
(Appendix A). Per-object, per-group and per-vertex data are arrays,
described in §8.5 to
§8.7.
8.2 Root-Level Metadata¶
Root metadata is the root’s zarr_vectors object, kind: "root".
The root attributes of a three-level streamline pyramid
(chunk_shape 200, bin_shape 50, two ×2 coarsenings), with the
registrations and the ome node abridged (see §8.9 and §8.11):
{
"zarr_conventions": [
{"uuid": "66268a61-7833-4995-bbcb-233bb417dae5", "name": "zarr_vectors", ...},
{"uuid": "d35379db-88df-4056-af3a-620245f8e347", "name": "multiscales", ...}
],
"zarr_vectors": {
"kind": "root",
"zv_version": "0.10.0",
"axes": [
{"name": "x", "type": "space"},
{"name": "y", "type": "space"},
{"name": "z", "type": "space"}
],
"format_capabilities": ["preserved_object_ids", "shared_fragments", "multiscale_links"],
"chunk_shape": [200.0, 200.0, 200.0],
"bounds": [[0.0, 0.0, 0.0], [400.0, 400.0, 400.0]],
"geometry_types": ["streamline"],
"base_bin_shape": [50.0, 50.0, 50.0],
"links_convention": "implicit_sequential", "object_index_convention": "standard",
"cross_chunk_strategy": "explicit_links", "cross_level_depth": 1,
"cross_level_storage": "explicit"
},
"multiscales": {"layout": [{"asset": "0"}, {"asset": "1"}, {"asset": "2"}]},
"ome": {"version": "0.6", "type": "collection", "name": "streamline_pyr", ...}
}
Required fields:
Field |
Type |
Description |
|---|---|---|
|
|
Node discriminator. |
|
string ( |
Format version of the writer, |
|
|
One |
|
|
Level-0 chunk edge lengths, one positive entry per axis. Per-level overrides live in the level object’s |
|
|
Global |
|
|
Geometries present; empty in a store that holds no data yet. Canonical values: |
Optional fields (a reader uses the default when absent):
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Capability tokens the store uses (Capability tokens). The reference writer always writes it. |
|
|
|
Capability tokens a reader MUST implement to read the store correctly (Capability tokens). Written only when non-empty. |
|
|
|
Level-0 bin edge lengths. |
|
|
|
How intra-chunk links are stored. |
|
|
|
|
|
|
|
How cross-chunk connectivity is expressed. |
|
int ≥ 2 |
|
Multi-resolution threshold: a new level is emitted only when the vertex count drops by at least this factor. |
|
int ≥ −1 |
|
Largest ` |
|
|
|
Optionality knob for cross-pyramid-level links (§9.6). |
|
object |
absent |
Declared attributes by scope ( |
|
int ≥ 1 | |
unsharded |
Writer default for packing per-chunk arrays (Writer defaults). |
|
object |
absent ( |
Writer default: configuration of the |
|
|
|
Writer default for new object indexes. Written only as |
|
|
|
Element type of |
|
|
zeros |
Stored-to-world offset per axis ( |
There is no crs field: a CRS is the root attribute proj:projjson
(§8.8).
Cross-field rules:
chunk_shape,base_bin_shape, bothboundscorners,coordinate_offset, and every level’sbin_shapeandbin_ratioMUST havesid_ndimentries (one per axis).octree_shardingMUST NOT be present withoutshard_shape.Every token in
required_capabilitiesMUST also appear informat_capabilities.
Axes¶
axes is a list of {"name", "type", "unit"?} descriptors in the order
time → channel → custom → space. type is one of "space",
"time", "channel" or "custom". Axis names MUST be unique, and a
store MUST have at least two space axes. sid_ndim — the number of
spatial index dimensions, and the rank of every per-chunk array — is
the number of axes of every type (an x, y, z, t store has 4).
unit is a UDUNITS-2 name ("micrometer", "second", …). Writers
MUST NOT stamp placeholder units; an unknown unit is omitted. The
descriptor shape is OME-Zarr RFC 4’s.
attribute_specs¶
attribute_specs records what a store declares its attributes to be,
by scope:
"attribute_specs": {
"vertex": {"intensity": {"dtype": "float32", "unit": "microvolt"}},
"object": {"label": {"dtype": "int32", "categorical": true}}
}
Key |
Meaning |
|---|---|
scope |
|
|
Element type, a NumPy dtype name. Required. |
|
Number of channels; omitted when 1. |
|
|
|
UDUNITS-2 unit name, when given. |
|
Free text, when given. |
A declaration does not promise that the array exists; the array
appears when data is written. Absent means undeclared. A writer also
stamps unit and description into the attribute array’s own
zarr_vectors object, which is the truth about that array.
Writer defaults: shard_shape, octree_sharding, manifest_layout¶
These fields say how new arrays are written, so that every path
that allocates one — including a worker creating an array on its first
write — makes the same choice. They are not claims about what is on
disk: each array’s own codecs and each object index’s own layout are
the truth. A reader that ignores them reads the store correctly.
Field |
Meaning |
|---|---|
|
Cells (not coordinate units) per shard: an integer for every axis, or one per spatial axis (one more on a level with a leading non-spatial axis, §6.7). Absent ⇒ one storage object per non-empty cell. |
|
The store is marked octree: sharded per-chunk arrays use the |
|
|
coordinate_offset¶
coordinate_offset is the world position of the stored coordinate
origin, one value per axis:
world position = stored position + coordinate_offset
It lets a writer align the chunk grid with a source grid. Absent
means zero. All other coordinates in the store (bounds, vertex
positions, …) are in the stored frame.
Capability tokens (format_capabilities)¶
Capability tokens advertise optional features the store uses:
Token |
Meaning |
Added when |
|---|---|---|
|
At least one level was written with ID-preserving sparsification (level |
A level preserves object IDs. |
|
At least one level stores per-chunk fragments that more than one object’s manifest references. |
A level shares fragments. |
|
The store contains cross-pyramid-level link arrays ( |
Cross-level links are written. |
|
At least one object index uses (or will be written in) the |
|
|
Sharded per-chunk arrays use the |
|
|
A level stores one cell per octree leaf rather than per uniform chunk (§6.5). A reader without this capability MUST NOT read such a level. |
A level has an |
|
|
Reserved, not written. Every store uses that encoding and each sidecar array declares it ( |
multiscale_links says nothing about chunk-spanning links, which
are ordinary delta = 0 arrays.
The set is open: a reader that meets a token it does not recognize
in format_capabilities either treats that feature as absent or
declines to open the store
(Appendix H); what it MUST
NOT do is assume the feature is present.
A reader that does not implement a token in required_capabilities
SHOULD refuse to open the store, and MUST NOT read the parts of it
that depend on the token. octree_chunks is currently the only such
token; writers remove it (and an emptied list) when no level has octree
chunks. A reader that skips the check is still stopped by the
zarr_vectors_octree_chunks marker codec (Appendix D).
8.3 Resolution-Level Metadata¶
Per-level metadata is the level group’s zarr_vectors object,
kind: "level". Level 1 of the pyramid in §8.2:
{
"zarr_conventions": [{"uuid": "66268a61-7833-4995-bbcb-233bb417dae5"}],
"zarr_vectors": {
"kind": "level", "level": 1, "object_sparsity": 0.5, "vertex_count": 15,
"coarsening_method": "per_object", "parent_level": 0,
"arrays_present": ["links", "object_index", "vertex_fragments", "vertices"],
"preserves_object_ids": true, "inherited_num_objects": 20, "shared_fragments": true,
"bin_ratio": [2.0, 2.0, 2.0], "bin_shape": [100.0, 100.0, 100.0]
}
}
Level 0 of the same store has "level": 0, "object_sparsity": 1.0,
"coarsening_method": "none", "parent_level": null,
"fragments_tile": true and no bin fields.
Field |
Type |
Description |
|---|---|---|
|
|
Node discriminator. Required. |
|
int ≥ 0 |
Level index (0 = full resolution). Required; MUST equal the group name. |
|
int ≥ 0 |
Total vertex rows across all |
|
|
Subset of the canonical family names actually present — |
|
float in |
Fraction of the parent level’s objects kept at this level. |
|
|
How this level was generated. |
|
int | null |
Index of the source level; |
|
|
Above level 0: this level’s bin edge lengths. Absent at level 0. |
|
|
Above level 0: |
|
|
Per-level chunk-shape override. Each axis must be a positive integer multiple of root |
|
|
Every chunk’s vertex fragment index tiles its buffer exactly, letting a bulk read skip |
|
|
In every chunk, the |
|
|
Names of chunk-key axes (leading axis first), when the level is chunked along a non-spatial axis (§6.7). |
|
string |
Per-vertex attribute used as the leading chunk axis. |
|
|
Ordered list mapping leading-axis chunk coordinate to attribute value. |
|
|
The stores each value of a leading |
|
|
This level inherits the parent’s object-ID space (dropped objects → empty manifest slots). MUST NOT be set at level 0. |
|
int ≥ 0 |
Size of the object-ID space inherited from |
|
|
Per-chunk fragments at this level may be referenced by several objects’ manifests. |
|
object |
The level has octree chunks (§6.5). Requires the |
|
|
Build-time only (Deferred presence). |
bounds MUST NOT appear in a level object; it is root-only.
A coarse level’s bin geometry is stored in its level object and
nowhere else; the multiscales block carries none
(§8.10). Level 0’s bin is the root
base_bin_shape (or chunk_shape). A coarse level that records
neither reads as level 0’s. See
§9.3.
bin_ratio, bin_shape, chunk_shape and the root bounds fix the
layout of arrays already written; a writer MUST NOT change them on a
level that holds data.
Cross-level invariants:
A per-level
chunk_shapemust be a positive integer multiple of the rootchunk_shape, and an integer multiple of the level’sbin_shape, along every axis.Each coarse level’s
parent_levelnames an existing level, the chain reaches level 0 without cycles, andbin_ratioequalsbin_shape / base_bin_shape.
Deferred presence¶
presence: "deferred" is set only while uncoordinated workers are
writing a level. The level’s per-chunk arrays MAY then lack
nonempty_chunks (§7), and a
reader MUST take presence from the store (by listing or reading cells)
and MUST NOT treat such an array as empty. A coordinator ends the
state by writing every array’s nonempty_chunks and then removing
presence, so a finished store never carries it; a validator SHOULD
warn when it does.
8.4 Array-Level Metadata¶
Every array and family group carries its properties in its
zarr_vectors object with an array kind (examples in
§7). Fields Zarr already records
(shape, chunk_grid, codecs) stay in the standard places. dtype
is the element type of the rows inside a cell; the cells are byte
strings, so a reader MUST take the element type from dtype, not from
the array’s Zarr data_type.
Recognized array kinds, with their fields (each array’s fields are specified in §7):
|
Node |
Required fields |
Optional fields |
|---|---|---|---|
|
|
|
|
|
|
|
— |
|
|
|
— |
|
|
|
|
|
|
|
— |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Every per-chunk kind (vertices, vertex_fragments,
link_fragments, links, vertex_attribute, fragment_attribute,
link_attribute) also carries nonempty_chunks and, when non-zero,
chunk_grid_origin (§7); no
other kind may carry them. The arrays inside object_index/
(manifests, object_ids, manifest_spans, manifest_blocks) carry
no zarr_vectors attribute: their parent group describes them. The
plain container groups (vertex_attributes/, links/,
link_attributes/<name>/, …) carry none either.
Kind spellings are normative. A reader SHOULD reject a node whose
kind it does not recognise, and MUST NOT interpret it as any kind it
does recognise.
Parametric objects¶
The optional root-level parametric/ group carries
kind: "parametric" and the type table:
"zarr_vectors": {
"kind": "parametric",
"parametric_types": {
"0": {"name": "plane", "coefficients": ["A", "B", "C", "D"]},
"1": {"name": "line", "coefficients": ["x0", "y0", "z0", "dx", "dy", "dz"]},
"2": {"name": "sphere", "coefficients": ["cx", "cy", "cz", "r"]}
}
}
Types 0–2 are built in; a writer MAY add further type ids.
Its arrays carry kind: "parametric_objects" (parametric/objects;
fields num_objects, max_row_length, dtype) and
kind: "parametric_names" (parametric/names; field num_objects).
8.5 Object-Level Metadata¶
Per-object data lives in <level>/object_attributes/<name>, dense
(B,) or (B, C) arrays aligned to the object rows of the level’s
object index. There is no fixed schema; common names:
"name"— human-readable label per object."type"— categorical kind (mesh / skeleton / polyline / …)."centroid"—(B, sid_ndim)per-object summary point."termination"—(B, 2)for streamline endpoints (channel 0 = source, channel 1 = sink region IDs).
On an OID-preserving level, an object dropped at that level keeps its
row (with an empty manifest) in every object_attributes/<name>
array (§7.6).
8.6 Group-Level Metadata¶
Per-group data lives in <level>/group_attributes/<name>, dense
(G,) or (G, C) arrays keyed by group ID. Common names:
"region_name"— name per anatomical region group."tract_name"— name per fascicle group."super_type"— coarser label for hierarchical grouping (hierarchy is expressed by attributes, not structure).
8.7 Point-Level Metadata¶
Per-vertex data lives in the <level>/vertex_attributes/<name> cell
for a chunk, row-aligned to the vertices cell at the same
coordinate. The column count is the array’s row_shape; channel
labels are its channel_names. Splitting one attribute into several
per-channel arrays is a writer’s choice. Vertex, object and link
attributes MAY be declared in the root attribute_specs
(§8.2).
8.8 Coordinate Reference System (CRS)¶
A store’s CRS is a PROJJSON object in the root attribute
proj:projjson, defined by the
proj convention v0.1:
"proj:projjson": {"type": "ProjectedCRS", "name": "WGS 84 / UTM zone 33N", ...}
A store with a CRS MUST register the proj convention on the root (§8.9); a store without one has neither.
Writers write
proj:projjsononly. A reader MAY also accept the proj convention’sproj:codeandproj:wkt2.The CRS applies to world positions (stored position plus
coordinate_offset). Axis units are on the root’saxes.There is no per-level transform (§8.10).
8.9 Convention Registration (zarr_conventions)¶
Every node that carries a zarr_vectors attribute MUST list the Zarr
Vectors convention in its zarr_conventions attribute, as the
Zarr Conventions specification
requires. On the root the entry is the full one:
{
"schema_url": "https://raw.githubusercontent.com/Andrew-Keenlyside/zarr-vectors/refs/tags/v0.1.0/schema.json",
"spec_url": "https://github.com/Andrew-Keenlyside/zarr-vectors/blob/v0.1.0/README.md",
"uuid": "66268a61-7833-4995-bbcb-233bb417dae5",
"name": "zarr_vectors",
"description": "Spatially chunked, multi-resolution N-dimensional vector data (point clouds, meshes, skeletons, streamlines, graphs)"
}
On every other node writers write the short form
{"uuid": "66268a61-7833-4995-bbcb-233bb417dae5"}.
The root also registers:
Convention |
UUID |
When |
|---|---|---|
multiscales v0.1 |
|
Always (the root carries a |
proj v0.1 |
|
When the store has a CRS ( |
Writers write these as full entries (schema_url, spec_url,
uuid, name, description). A writer MUST keep entries for other
conventions and replaces its own rather than duplicating it. Readers
identify an entry by its uuid.
8.10 Multiscales¶
The root’s multiscales attribute is the
multiscales convention
v0.1 block, with one layout entry per level in ascending order:
"multiscales": {"layout": [{"asset": "0"}, {"asset": "1"}, {"asset": "2"}]}
assetis the level group’s name. Level"0"MUST be present, and the assets MUST match the level groups one to one.Vertex positions are in level-0 coordinates at every level, so no transform relates the levels. Writers SHOULD NOT write a
transform; if present it MUST be the identity.The block carries no bin geometry (§8.3).
derived_fromMAY be present; if so it MUST equal the level’sparent_level. A writer keeps other keys already in an entry.
A Zarr Vectors store is not an OME-Zarr image and carries no OME-NGFF
multiscales list.
8.11 OME-Zarr RFC 8 Node (ome)¶
The root MAY carry an ome attribute, an
OME-Zarr RFC 8 collection
node, so that an OME collection elsewhere can name the store by path:
"ome": {
"version": "0.6",
"type": "collection",
"name": "streamline_pyr",
"attributes": {
"scene": {
"coordinateSystems": [{
"id": "world", "name": "world",
"axes": [{"name": "x", "type": "space"}, {"name": "y", "type": "space"},
{"name": "z", "type": "space"}]
}],
"coordinateTransformations": []
}
},
"nodes": [{"type": "zv:level", "name": "0"}, {"type": "zv:level", "name": "1"},
{"type": "zv:level", "name": "2"}]
}
name defaults to the store’s directory name without extension.
nodes holds one zv:level leaf per level; writers keep other entries
when refreshing the list. The world system restates the root’s
axes. The node only restates authoritative fields: readers MUST NOT
depend on it, a store without it is valid (a validator SHOULD warn),
and it can be added in place without rewriting data.
8.12 Version Rules¶
The root’s zv_version is the format version, covering the
metadata layout and the cell layouts. It is independent of the
convention version (the v0.1.0 tag in the registration URLs).
Convention 0.1.0 covers format 0.10.0.
A 0.10.0 reader:
MUST refuse a store whose root
zarr_vectorsobject has nokind(one written before 0.10.0). For a 0.9.x store the refusal SHOULD name the in-place metadata migration (Appendix J).MUST refuse a root whose
kindis not"root".MUST refuse a store whose
zv_versionhas a newer major or minor version than its own (0.11.0,1.0.0, …). A newer patch version of the same minor (0.10.1) is readable.MUST treat a malformed
zv_version(notX.YorX.Y.Zintegers), or a version older than0.10.0on a root that haskind: "root", as invalid metadata.MUST NOT interpret cells of a format version it does not support.
A reader MUST reject a store it cannot identify rather than read it on a best-effort basis (§13.2).
A 0.9.x store migrates in place by rewriting its zarr.json
documents; older stores must be rewritten from source
(Appendix J).