cellmap_flow.io.paths
Dataset paths: where a container ends, how to join onto a path, what is there.
A dataset path is a local directory or an http(s), s3 or gs URL, and may run
on past its container into the group or array inside it
(/data/x.zarr/recon-1/em/s0). A precomputed:// path, and a gs://
path with no .zarr/.n5 in it, is a neuroglancer precomputed volume:
precomputed:// is followed by a local directory or, as neuroglancer
writes it, a URL (precomputed://gs://bucket/volume).
What is at a path is probed through io.store (for .zgroup,
.zarray, zarr.json) only where a path has no .zarr/.n5
suffix to split it at; the local v3 checks look at the filesystem.
Attributes
Functions
|
An http(s), s3 or gs URL. |
|
A |
|
Remove shell-escape backslashes from a filesystem path. |
|
Join path components; a URL is joined with "/" whatever the OS. |
|
The directory above |
|
True if |
|
The nearest directory at or above |
|
A local zarr (v2 or v3) group or array, with or without a .zarr suffix. |
|
"zarr" or "n5": the suffix of the last component of |
|
|
|
|
|
|
Module Contents
- cellmap_flow.io.paths.ZARR_JSON = 'zarr.json'
- cellmap_flow.io.paths.is_remote(path: str) bool
An http(s), s3 or gs URL.
- cellmap_flow.io.paths.is_precomputed(path: str) bool
A
precomputed://path, or ags://one that names no zarr or N5 container (neuroglancer’s cloud volumes are precomputed).
- cellmap_flow.io.paths.normalize_path(path: str) str
Remove shell-escape backslashes from a filesystem path.
Users often copy-paste paths from a terminal where spaces are escaped (e.g.
/path/to/file\ name.zarr). YAML preserves the literal backslashes, but the filesystem expects plain spaces.A URL – http(s), s3, gs, or one after
precomputed://– is returned as it is: it is not a filesystem path.
- cellmap_flow.io.paths.join(base: str, *parts: str) str
Join path components; a URL is joined with “/” whatever the OS.
- cellmap_flow.io.paths.parent(path: str) str
The directory above
path, a URL’s as a local path’s; a URL’s root (s3://bucket) is its own.
- cellmap_flow.io.paths.is_v3_container(path: str) bool
True if
pathis a directory with azarr.jsonat its root.
- cellmap_flow.io.paths.find_v3_container(path: str) str | None
The nearest directory at or above
pathholding azarr.json.None if there is none (a v2 store),
pathis a URL (zarr v3 is read from the local filesystem only), orpathdoes not exist: a missing level is not the group above it, whose zarr.json would otherwise answer for it.
- cellmap_flow.io.paths.is_zarr_container(path: str) bool
A local zarr (v2 or v3) group or array, with or without a .zarr suffix.
- cellmap_flow.io.paths.suffix_format(path: str) str | None
“zarr” or “n5”: the suffix of the last component of
paththat ends in .zarr or .n5; else None.
- cellmap_flow.io.paths.split_container(path: str) Tuple[str, str]
(container, path inside it).The container ends at the last component of
pathending in.zarr/.n5; without one it is the nearest directory up frompathwith a.zgroup(or, failing that, the first with a.zarray), on disk or at a URL alike./data/x.zarr/em/s0is("/data/x.zarr", "em/s0").
- cellmap_flow.io.paths.precomputed_scale(path: str) Tuple[str, int | None]
(volume, scale index)for a precomputed path: a last components<N>names scale N of the volume above it; a path without one is the volume itself, with index None.
- cellmap_flow.io.paths.precomputed_volume(path: str) Tuple[str, int]
(volume location, scale index)for a precomputed path: the volume’s local directory or URL, whichio.storereads, and the scale a trailing/s<N>names (precomputed_scale), else 0.precomputed://followed by a URL – neuroglancer’s way of writing a cloud source,precomputed://gs://bucket/volumeorprecomputed://https://host/volume– is that URL, as is a baregs://path. Any otherprecomputed://path is a local directory.