cellmap_flow.utils.zarr_v3

Read support for Zarr v3-format stores (zarr.json metadata).

The zarr package pinned in this project (2.18.4) has no awareness of the Zarr v3 storage format at all — zarr.open() cannot even recognize a zarr.json-only store, let alone read one. Bumping to zarr-python 3.x was considered and rejected (it drops zarr.n5, used elsewhere in this codebase, and conflicts with the installed funlib.persistence pin).

Instead, this module reads v3 metadata directly with json.load and reads v3 chunk data via tensorstore’s zarr3 driver, which is already a project dependency. It mirrors the output contracts of the equivalent v2 helpers in cellmap_flow.utils.ds so callers can dispatch on format and otherwise not care which one they got. Local filesystem stores only — remote (s3/gs/http) v3 stores are not handled here.

Attributes

logger

ZARR_JSON

Functions

is_v3_container(→ bool)

True if path is a directory with a zarr.json at its root.

find_v3_container(→ Optional[str])

Walk up from path looking for the nearest directory containing a

read_zarr_json(→ dict)

attrs_from_meta(→ dict)

Merge OME-NGFF 0.5's nested attributes.ome with the top-level

open_array_v3(→ _TensorstoreArray)

Open a v3 array for reading. path must be the array's own

multiscales_from_group(→ Optional[dict])

get_scale_info_v3(→ Tuple[dict, dict, dict])

Mirror of ds.py's get_scale_info for a v3 multiscale group.

find_closest_scale_v3(→ Tuple[str, list, tuple])

Mirror of ds.py's find_closest_scale for a v3 multiscale group.

get_ds_info_v3(path)

Mirror of ds.py's get_ds_info return contract for a local v3

Module Contents

cellmap_flow.utils.zarr_v3.logger
cellmap_flow.utils.zarr_v3.ZARR_JSON = 'zarr.json'
cellmap_flow.utils.zarr_v3.is_v3_container(path: str) bool

True if path is a directory with a zarr.json at its root.

cellmap_flow.utils.zarr_v3.find_v3_container(path: str) str | None

Walk up from path looking for the nearest directory containing a zarr.json. Returns None if none is found (e.g. a v2 store, or a remote URL).

cellmap_flow.utils.zarr_v3.read_zarr_json(path: str) dict
cellmap_flow.utils.zarr_v3.attrs_from_meta(meta: dict) dict

Merge OME-NGFF 0.5’s nested attributes.ome with the top-level attributes dict (some writers emit OME metadata unnested).

cellmap_flow.utils.zarr_v3.open_array_v3(path: str) _TensorstoreArray

Open a v3 array for reading. path must be the array’s own directory (i.e. already descended into, not its parent group).

cellmap_flow.utils.zarr_v3.multiscales_from_group(group_path: str) dict | None
cellmap_flow.utils.zarr_v3.get_scale_info_v3(group_path: str) Tuple[dict, dict, dict]

Mirror of ds.py’s get_scale_info for a v3 multiscale group.

Returns (offsets, resolutions, shapes) keyed by dataset path.

cellmap_flow.utils.zarr_v3.find_closest_scale_v3(group_path: str, target_resolution) Tuple[str, list, tuple]

Mirror of ds.py’s find_closest_scale for a v3 multiscale group.

target_resolution=None defaults to the finest (first) scale rather than raising, since callers sometimes ask for the “closest scale” without a specific target in mind.

cellmap_flow.utils.zarr_v3.get_ds_info_v3(path: str)

Mirror of ds.py’s get_ds_info return contract for a local v3 store: (voxel_size, chunk_shape, shape, roi, axes_names, "zarr").