Modules¶
zarr-vectors-tools is about 12 000 lines across 57 modules, organised
into six subpackages. This page is the map: what each one owns, its main
entry points, and where to read more.
Subpackage |
Owns |
Narrative |
API |
|---|---|---|---|
|
file format → store |
||
|
store → file format |
||
|
merge into, and split, an existing store |
||
|
coarser levels, pyramids |
||
|
streaming graph and mesh compute |
||
|
format metadata preservation |
||
|
the |
convert is the one subpackage with submodules: ingest and export are
the two directions of the same operation, which is also how zvtools convert presents them.
zarr_vectors_tools.convert.ingest¶
Reads a source file and writes a store. Nineteen modules — one per format, plus shared enrichment helpers.
Each ingest function takes (input_path, output_path, chunk_shape, ...)
and returns the underlying writer’s summary dict, augmented with
enrichment counters such as dropped_by_length or dropped_by_na.
Module |
Entry point |
Format |
|---|---|---|
|
|
CSV / XYZ points |
|
|
LAS / LAZ |
|
|
PLY (points) |
|
|
6-column segment CSV |
|
|
MRtrix TCK |
|
|
TrackVis TRK (serial) |
|
|
TrackVis TRK (parallel, inline pyramid) |
|
|
TRX |
|
|
SWC skeletons |
|
|
precomputed |
|
|
precomputed, no spatial index |
|
|
OBJ meshes |
|
|
STL meshes (ASCII + binary) |
|
|
edge-list CSV pair |
|
|
GraphML |
Supporting modules: _parallel (the two executor backends),
_point_enrichments, _polyline_enrichments, _tree_enrichments.
Warning
convert/ingest/__init__.py is empty — there are no re-exports. Import
from the concrete module: from zarr_vectors_tools.convert.ingest.csv_points import ingest_csv.
zarr_vectors_tools.multiresolution¶
The largest subsystem, and the one with no counterpart in core. Builds coarser resolution levels by reducing along two orthogonal axes — coarsening (fewer vertices per object) and sparsity (fewer objects). Start at Coarsening versus sparsity.
Module |
Role |
|---|---|
|
orchestrator: |
|
the five sparsity strategies and |
|
|
|
|
|
|
|
|
|
pure, I/O-free helpers for the |
|
vectorised batched forest operations |
|
|
strategies/ holds the per-geometry coarseners: skeletons,
polylines, points, meshes, graphs.
Note
_forest is worth knowing about if you are profiling. Its
_nearest_special_ancestor uses path-doubling (Hillis–Steele), which is
O(log height) rather than O(height). The docstring records that a scipy
formulation benchmarked ~1.75× slower and naive relaxation ~10× slower.
tests/test_forest_vectorized.py pins it to a scalar reference.
zarr_vectors_tools.algorithms¶
Streaming compute over a store. Nothing here materialises the whole store — everything walks the chunk grid or the object manifests on demand.
Unlike ingest and export, this subpackage does re-export, with an
__all__ of 11 functions:
from zarr_vectors_tools.algorithms import bfs_distances, compute_louvain
Module |
Functions |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Two internal modules matter to anyone writing their own algorithm:
_links— the offsets-aware link readers. This is the single definition of the cross-chunk filter, and the module that documents the double-count trap. Useread_cross_linksrather than composingread_linkswith a per-chunk loop._chunk_neighbours—neighbouring_chunk_keys, a shim for a core helper that does not exist yet.
zarr_vectors_tools.convert.export¶
Store → file. Six exporters, all sharing the signature shape
(store_path, output_path, *, level=0, ...) and all returning a summary
dict.
Module |
Entry point |
Output |
|---|---|---|
|
|
CSV |
|
|
PLY |
|
|
TrackVis TRK |
|
|
TRX |
|
|
SWC |
|
|
OBJ |
level= selects the resolution level, so exporting from a coarser level
gives you a decimated file — often the quickest way to get a previewable
subset.
Warning
convert/export/__init__.py is also empty. And no exporter reads the
headers/ group automatically — see Export.
zarr_vectors_tools.headers¶
Preserves format-specific metadata that is not part of the geometry, in a
headers/<format>/ group on the store.
registry.HeaderRegistry—available_formats,has,get,add,remove. Accepts a store path or an open group.formats— theHeaderbase class plusTRKHeader,NIfTIHeader,SWCHeader,LASHeader,OBJHeader,CSVHeader,GraphHeader, andheader_from_dict.
Ingest writes these; reading them back on export is manual.
zarr_vectors_tools.cli¶
The zvtools entry point, declared as
zvtools = "zarr_vectors_tools.cli:main".
Module |
Role |
|---|---|
|
|
|
parsers, |
|
the |
|
the |
_args.FORMAT_REGISTRY is the authoritative format table — extension
mapping, ingest module, and required extra all live there.
Root modules¶
__init__.py — import side effects only. It registers this package’s
coarseners and selectors into the parent package’s strategy registry
(via the supported zarr_vectors.building.register_* entry points), so
core can dispatch into tools without depending on tools. Degrades
silently on a core too old to have the registry. It does not define
__version__; the CLI reads the version via importlib.metadata.
_manifests.py — rebuild_nonempty_manifests and
per_chunk_array_paths, a workaround for a core method that does not
exist yet. Its docstring documents the manifest race that makes the
parallel write protocol necessary; see Parallel
workflows.
Shims awaiting upstream¶
Four pieces exist only until core grows an equivalent. If you are reading the source and wondering why something is reimplemented here, this is why:
Shim |
Waiting on |
|---|---|
|
|
|
|
|
a public |
|
a public |
Upstream findings is the formal write-up of these and of the concurrency work.