Skip to content

convenience

zarr.consolidate_metadata

consolidate_metadata(
    store: StoreLike,
    path: str | None = None,
    zarr_format: ZarrFormat | None = None,
) -> Group

Consolidate the metadata of all nodes in a hierarchy.

Upon completion, the metadata of the root node in the Zarr hierarchy will be updated to include all the metadata of child nodes. For Stores that do not use consolidated metadata, this operation raises a TypeError.

Parameters:

  • store (StoreLike) –

    The store-like object whose metadata you wish to consolidate.

  • path (str, default: None ) –

    A path to a group in the store to consolidate at. Only children below that group will be consolidated.

    By default, the root node is used so all the metadata in the store is consolidated.

  • zarr_format ((2, 3, None), default: 2 ) –

    The zarr format of the hierarchy. By default the zarr format is inferred.

Returns:

  • group ( Group ) –

    The group, with the consolidated_metadata field set to include the metadata of each child node. If the Store doesn't support consolidated metadata, this function raises a TypeError. See Store.supports_consolidated_metadata.

Source code in zarr/api/synchronous.py
def consolidate_metadata(
    store: StoreLike,
    path: str | None = None,
    zarr_format: ZarrFormat | None = None,
) -> Group:
    """
    Consolidate the metadata of all nodes in a hierarchy.

    Upon completion, the metadata of the root node in the Zarr hierarchy will be
    updated to include all the metadata of child nodes. For Stores that do
    not use consolidated metadata, this operation raises a `TypeError`.

    Parameters
    ----------
    store : StoreLike
        The store-like object whose metadata you wish to consolidate.
    path : str, optional
        A path to a group in the store to consolidate at. Only children
        below that group will be consolidated.

        By default, the root node is used so all the metadata in the
        store is consolidated.
    zarr_format : {2, 3, None}, optional
        The zarr format of the hierarchy. By default the zarr format
        is inferred.

    Returns
    -------
    group: Group
        The group, with the ``consolidated_metadata`` field set to include
        the metadata of each child node. If the Store doesn't support
        consolidated metadata, this function raises a `TypeError`.
        See ``Store.supports_consolidated_metadata``.

    """
    return Group(sync(async_api.consolidate_metadata(store, path=path, zarr_format=zarr_format)))

zarr.copy

copy(*args: Any, **kwargs: Any) -> tuple[int, int, int]

Not implemented.

Source code in zarr/api/synchronous.py
def copy(*args: Any, **kwargs: Any) -> tuple[int, int, int]:
    """
    Not implemented.
    """
    return sync(async_api.copy(*args, **kwargs))

zarr.copy_all

copy_all(*args: Any, **kwargs: Any) -> tuple[int, int, int]

Not implemented.

Source code in zarr/api/synchronous.py
def copy_all(*args: Any, **kwargs: Any) -> tuple[int, int, int]:
    """
    Not implemented.
    """
    return sync(async_api.copy_all(*args, **kwargs))

zarr.copy_store

copy_store(
    *args: Any, **kwargs: Any
) -> tuple[int, int, int]

Not implemented.

Source code in zarr/api/synchronous.py
def copy_store(*args: Any, **kwargs: Any) -> tuple[int, int, int]:
    """
    Not implemented.
    """
    return sync(async_api.copy_store(*args, **kwargs))

zarr.print_debug_info

print_debug_info() -> None

Print version info for use in bug reports.

Source code in zarr/__init__.py
def print_debug_info() -> None:
    """
    Print version info for use in bug reports.
    """
    import platform
    from importlib.metadata import version

    def print_packages(packages: list[str]) -> None:
        not_installed = []
        for package in packages:
            try:
                print(f"{package}: {version(package)}")
            except ModuleNotFoundError:
                not_installed.append(package)
        if not_installed:
            print("\n**Not Installed:**")
            for package in not_installed:
                print(package)

    required = [
        "packaging",
        "numpy",
        "numcodecs",
        "typing_extensions",
        "donfig",
    ]
    optional = [
        "botocore",
        "cupy-cuda12x",
        "fsspec",
        "numcodecs",
        "s3fs",
        "gcsfs",
        "universal-pathlib",
        "rich",
        "obstore",
    ]

    print(f"platform: {platform.platform()}")
    print(f"python: {platform.python_version()}")
    print(f"zarr: {__version__}\n")
    print("**Required dependencies:**")
    print_packages(required)
    print("\n**Optional dependencies:**")
    print_packages(optional)

zarr.tree

tree(
    grp: Group,
    expand: bool | None = None,
    level: int | None = None,
) -> Any

Provide a rich display of the hierarchy.

Deprecated

zarr.tree() is deprecated since v3.0.0 and will be removed in a future release. Use group.tree() instead.

Parameters:

  • grp (Group) –

    Zarr or h5py group.

  • expand (bool, default: None ) –

    Only relevant for HTML representation. If True, tree will be fully expanded.

  • level (int, default: None ) –

    Maximum depth to descend into hierarchy.

Returns:

  • TreeRepr

    A pretty-printable object displaying the hierarchy.

Source code in zarr/api/synchronous.py
@deprecated("Use Group.tree instead.", category=ZarrDeprecationWarning)
def tree(grp: Group, expand: bool | None = None, level: int | None = None) -> Any:
    """Provide a rich display of the hierarchy.

    !!! warning "Deprecated"
        `zarr.tree()` is deprecated since v3.0.0 and will be removed in a future release.
        Use `group.tree()` instead.

    Parameters
    ----------
    grp : Group
        Zarr or h5py group.
    expand : bool, optional
        Only relevant for HTML representation. If True, tree will be fully expanded.
    level : int, optional
        Maximum depth to descend into hierarchy.

    Returns
    -------
    TreeRepr
        A pretty-printable object displaying the hierarchy.
    """
    return sync(async_api.tree(grp._async_group, expand=expand, level=level))