Skip to content

Zarr

virtualizarr.parsers.ZarrParser

Parser for creating virtual references to existing Zarr stores.

The ZarrParser creates lightweight virtual references to chunks in existing Zarr stores without copying data. It supports both Zarr V2 and V3 formats, automatically converting V2 metadata to V3 format.

Parameters:

  • group (str, default: None ) –

    Path to a specific group within the Zarr store to use as the root. Uses forward slashes for nested groups (e.g., "model/output"). Default is None, which uses the store's root group.

  • skip_variables (iterable of str, default: None ) –

    Names of variables (arrays) to exclude when creating the virtual store. Useful for filtering out auxiliary data or large variables that aren't needed. Default is None, which includes all variables.

Attributes:

  • group (str or None) –

    The group path to use as root.

  • skip_variables (iterable of str or None) –

    Variables to exclude from virtualization.

Methods:

  • __call__

    Create a virtual representation of a Zarr store.

See Also

virtualizarr.open_virtual_dataset : High-level function for opening virtual datasets.

__call__

__call__(url: str, registry: ObjectStoreRegistry) -> ManifestStore

Parse the metadata and byte offsets from a given Zarr store to produce a VirtualiZarr ManifestStore.

Parameters:

  • url (str) –

    URL or path to the Zarr store. Supports various protocols:

    • Local filesystem: "file:///path/to/store.zarr" or "/path/to/store.zarr"
    • S3: "s3://bucket/path/to/store.zarr"
    • Google Cloud Storage: "gs://bucket/path/to/store.zarr"
    • Azure Blob Storage: "az://container/path/to/store.zarr"
    • HTTP/HTTPS: "example.com/store.zarr"
  • registry (ObjectStoreRegistry) –

    An ObjectStoreRegistry for resolving urls and reading data.

Returns:

Raises:

  • ValueError

    If the URL cannot be resolved or normalized.

  • KeyError

    If the registry doesn't contain an appropriate store for the URL.

  • NotImplementedError

    If the Zarr store uses an unsupported format version.

See Also

virtualizarr.open_virtual_dataset : High-level interface for virtual datasets. virtualizarr.manifests.ManifestStore : The returned virtual store object.

__init__

__init__(group: str | None = None, skip_variables: Iterable[str] | None = None)

Instantiate a parser with parser-specific parameters that can be used in the __call__ method.

Parameters:

  • group (str | None, optional (default: None), default: None ) –

    The group within the original Zarr store to be used as the root group for the ManifestStore (default: the Zarr store's root group).

  • skip_variables (Iterable[str] | None, optional (default: None), default: None ) –

    Variables in the Zarr store that will be ignored when creating the ManifestStore (default: None, do not ignore any variables).