metadata
zarr.metadata ¶
zarr.metadata.migrate_v3 ¶
migrate_to_v3 ¶
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_v2(Array | Group) –An array or group with zarr_format = 2
-
output_path(StorePath) –The store path to write generated v3 metadata to.
-
dry_run(bool, default:False) –Enable a 'dry run' - files that would be created are logged, but no files are created or changed.
Source code in zarr/metadata/migrate_v3.py
migrate_v2_to_v3 ¶
migrate_v2_to_v3(
*,
input_store: Store,
output_store: Store | None = None,
dry_run: bool = False,
) -> None
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_store(Store) –Input Zarr to migrate.
-
output_store(Store, default:None) –Output location to write v3 metadata (no array data will be copied). If not provided, v3 metadata will be written to input_store.
-
dry_run(bool, default:False) –Enable a 'dry run' - files that would be created are logged, but no files are created or changed.
Source code in zarr/metadata/migrate_v3.py
remove_metadata
async
¶
remove_metadata(
store: Store,
zarr_format: ZarrFormat,
force: bool = False,
dry_run: bool = False,
) -> None
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:
-
store(Store) –Zarr to remove metadata from.
-
zarr_format(ZarrFormat) –Which format's metadata to remove - 2 or 3.
-
force(bool, default:False) –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_run(bool, default:False) –Enable a 'dry run' - files that would be deleted are logged, but no files are removed or changed.