zarr.metadata.migrate_v3#

Functions#

migrate_to_v3(→ None)

Migrate all v2 metadata in a Zarr array/group to v3.

migrate_v2_to_v3(→ None)

Migrate all v2 metadata in a Zarr store to v3.

remove_metadata(→ None)

Remove all v2 (.zarray, .zattrs, .zgroup, .zmetadata) or v3 (zarr.json) metadata files from the given Zarr.

Module Contents#

zarr.metadata.migrate_v3.migrate_to_v3(
zarr_v2: zarr.Array | zarr.Group,
output_path: zarr.storage.StorePath,
dry_run: bool = False,
) None[source]#

Migrate all v2 metadata in a Zarr array/group to v3.

Note - if a group is provided, then all arrays / groups within this group will also be converted. A zarr.json file will be created for each level and written to output_path, with any v2 files (.zarray, .zattrs etc.) left as-is.

Parameters:
zarr_v2Array | Group

An array or group with zarr_format = 2

output_pathStorePath

The store path to write generated v3 metadata to.

dry_runbool, optional

Enable a ‘dry run’ - files that would be created are logged, but no files are created or changed.

zarr.metadata.migrate_v3.migrate_v2_to_v3(
*,
input_store: zarr.abc.store.Store,
output_store: zarr.abc.store.Store | None = None,
dry_run: bool = False,
) None[source]#

Migrate all v2 metadata in a Zarr store to v3.

This will create a zarr.json file at each level of a Zarr hierarchy (for every group / array). v2 files (.zarray, .zattrs etc.) will be left as-is.

Parameters:
input_storeStore

Input Zarr to migrate.

output_storeStore, optional

Output location to write v3 metadata (no array data will be copied). If not provided, v3 metadata will be written to input_store.

dry_runbool, optional

Enable a ‘dry run’ - files that would be created are logged, but no files are created or changed.

async zarr.metadata.migrate_v3.remove_metadata(
store: zarr.abc.store.Store,
zarr_format: zarr.core.common.ZarrFormat,
force: bool = False,
dry_run: bool = False,
) None[source]#

Remove all v2 (.zarray, .zattrs, .zgroup, .zmetadata) or v3 (zarr.json) metadata files from the given Zarr.

Note - this will remove metadata files at all levels of the hierarchy (every group and array).

Parameters:
storeStore

Zarr to remove metadata from.

zarr_formatZarrFormat

Which format’s metadata to remove - 2 or 3.

forcebool, optional

When False, metadata can only be removed if a valid alternative exists e.g. deletion of v2 metadata will only be allowed when v3 metadata is also present. When True, metadata can be removed when there is no alternative.

dry_runbool, optional

Enable a ‘dry run’ - files that would be deleted are logged, but no files are removed or changed.