CLI¶
Internals of the zvtools terminal CLI. This page is argparse
plumbing; for the actual command reference — subcommands, flags, and
worked invocations — see The zvtools command line.
Entry point¶
zvtools — flag-based terminal CLI for zarr-vectors-tools.
- Subcommands:
convert Ingest a file into a new zarr-vectors store (+ optional pyramid). merge Add a file’s or another store’s objects to an existing store. split Cut a store into one store per group, label or merged source. pyramid Build a sparsity pyramid on an existing store. validate Run core conformance validation on a store. info Print a store’s geometry, resolution levels, and metadata. attach Stage a table’s columns (or CIFTI maps) onto a store’s vertices. shard Repack per-chunk cells into shards, or undo it. bundles Summarise each group of a streamline store. synapses Join a synapse table to an EM skeleton store by segment id. run Run a recipe: several of the above in order, resumable.
Also runnable as python -m zarr_vectors_tools.
Argument helpers¶
Shared argument helpers and the format registry for the zvtools CLI.
- class zarr_vectors_tools.cli._args.ExportFmt(name, exts, module, func, extra, geometry, accepts)[source]¶
Bases:
objectOne format a store can be written back out to.
acceptsnames the exporter’s own optional parameters, so the CLI can pass only what a given exporter takes and refuse the rest by name rather than dropping it silently.- Parameters:
- __init__(name, exts, module, func, extra, geometry, accepts)¶
- class zarr_vectors_tools.cli._args.Fmt(name, exts, module, func, extra, geometry, inline_pyramid=False)[source]¶
Bases:
objectOne convertible file format.
- Parameters:
- __init__(name, exts, module, func, extra, geometry, inline_pyramid=False)¶
- zarr_vectors_tools.cli._args.build_factors(coarsen, sparsity)[source]¶
Zip
--coarsen/--sparsityinto per-level(coarsen, sparsity)tuples.Returns
Nonewhen neither is given (no pyramid requested). Raises when only one is given or their lengths differ.
- zarr_vectors_tools.cli._args.check_rdp_tolerances(tolerances, factors, coarsen_mode)[source]¶
Check
--rdp-toleranceagainst the pyramid it is meant to shape.Everything that can be decided without the store: a pyramid to apply to, one tolerance per
--coarsenentry, positive finite distances, and rdp mode. Run before any ingest, so a bad list does not cost a conversion. Whether the store’s geometry has a tolerance is checked by the caller, which knows the format or has the store.
- zarr_vectors_tools.cli._args.executor_ctx(workers, backend='process')[source]¶
Yield a parallel executor when
workers > 1, elseNone.backend="process"(default) uses the stdlib process pool — no extra dependency.backend="dask"uses a local Dask cluster and needs theparallelextra (it addsscatterbroadcast of the shared payload, which helps dense levels with a large shared object).
- zarr_vectors_tools.cli._args.load_export_func(fmt)[source]¶
Import the export entry function for
fmt(lazy, with an install hint).- Parameters:
fmt (ExportFmt)
- zarr_vectors_tools.cli._args.load_ingest_func(fmt)[source]¶
Import the ingest entry function for
fmt(lazy, with an install hint).- Parameters:
fmt (Fmt)
- zarr_vectors_tools.cli._args.looks_like_store(path)[source]¶
Is this a zarr-vectors store rather than a file to ingest?
What decides the DIRECTION of
zvtools convert: a store on the input side means the user is exporting out of it. The test is the same one--overwriteuses to decide whether a directory is safe to replace – a directory carrying Zarr’s own metadata file – so the two cannot disagree about what a store is.
- zarr_vectors_tools.cli._args.parse_num_chunks(s)[source]¶
"5000"->5000(total) or"5,13,8"->(5, 13, 8)(per-axis).
- zarr_vectors_tools.cli._args.parse_shape(s)[source]¶
"100,100,100"->(100.0, 100.0, 100.0)(spatial chunk/bin size).
- zarr_vectors_tools.cli._args.resolve_export_format(output_path, explicit)[source]¶
Return the
ExportFmtfor--format, or the OUTPUT extension.The output names the format when exporting, which is the mirror of the ingest rule where the input does.
- zarr_vectors_tools.cli._args.resolve_format(input_path, explicit)[source]¶
Return the
Fmtfor--format(if given) or the input extension.A directory input is resolved by what is in it, since the cortical surface formats describe one subject as many files and a precomputed layer is a directory. A URL can only be a precomputed layer: every other ingester reads a local file.
convert¶
zvtools convert — move data between a file and a zarr-vectors store.
Both directions, chosen by what INPUT is:
a FILE in, a store out — ingest, optionally building a pyramid (a precomputed layer, a directory or URL rather than a file, counts as one);
a STORE in, a file out — export.
One command rather than two because it is one operation with a direction, and because a pipeline that ends in an export otherwise has to drop out of the CLI to a Python script for its last step.
- zarr_vectors_tools.cli.convert.run_export(args)[source]¶
zvtools convert STORE OUT.ext— write a store back out to a file.- Return type:
pyramid¶
zvtools pyramid / validate / info subcommands.