Adding a geometry type¶
The places in zarr-vectors-py a new geometry type must be added to,
in the order a contributor meets them.
Terms¶
- Geometry type
A string in the root
geometry_typeslist, such as"point_cloud"or"streamline", that says how to read the store’s vertices and links. Valid values areVALID_GEOMETRY_TYPESinzarr_vectors/constants.py. See Geometry types.- Links convention
The root
links_conventionvalue:implicit_sequential(vertex order in a fragment is the topology),implicit_sequential_with_branches, orexplicit(alinks/family). See Links.
Introduction¶
All geometry types share one chunk layout, so a new type is mostly a writer and reader over the existing arrays, plus registrations. There is no plug-in registry for geometry types: each step below is an edit to the library. It is a format change, so propose it in an RFC first (see Spec change process).
Technical reference¶
Design questions for the RFC¶
The type string: lowercase letters, digits and underscores.
Which arrays it writes beyond
verticesandvertex_fragments(see Chunk arrays), and whether it has objects and so an object index.Its links convention. For a
links/family: thelink_width(2 for edges, 3 or more for faces) and whether it isdirected(write_links(directed=...)). A directed family keeps endpoint order; an undirected one is canonical-sorted and deduplicated, withperm_idxrecording input order.Any root or level attribute keys it adds.
Checklist¶
Step |
Where |
What |
|---|---|---|
Type string |
|
Add |
Schema |
none |
The convention’s schema accepts any geometry type string, so a new type needs no schema change. Document it in the format spec and the convention README. |
Writer and reader |
|
Add |
Validator |
|
Add the type to |
|
|
Add a |
Pyramids |
|
|
Tests |
|
See below. |
Docs |
|
A spec page following the spec documentation standards, added to the toctree and matrix in |
Closest existing types:
Closest to |
Module |
Functions |
|---|---|---|
Unconnected points |
|
|
Ordered vertex sequences |
|
|
Explicit edges |
|
|
Faces |
|
|
Writer rules¶
The writer sorts each chunk’s vertices into fragments, writes a
fragment index for the sorted rows, and reorders every per-vertex
attribute the same way (see Fragments).
It records the type and links convention in the root attributes and
updates each level’s vertex_count. The reader returns the same result
keys as the closest existing reader.
Tests¶
tests/test_<type>.py covers at least:
a write and read round trip, with objects that cross chunks;
a bounding-box read;
validate(path, level=5)passing on a new store and on a store with a pyramid;a corrupted store failing at the expected level;
the
Datasetpath (Dataset.add_<type>,Level.read).
See Compliance testing and Validation.