virtualizarr.accessor.VirtualiZarrDatasetAccessor.rename_paths#
- VirtualiZarrDatasetAccessor.rename_paths(new: str | Callable[[str], str]) Dataset #
Rename paths to chunks in every ManifestArray in this dataset.
Accepts either a string, in which case this new path will be used for all chunks, or a function which accepts the old path and returns the new path.
- Parameters:
new – New path to use for all chunks, either as a string, or as a function which accepts and returns strings.
- Return type:
Dataset
See also
ManifestArray.rename_paths
,ChunkManifest.rename_paths
Examples
Rename paths to reflect moving the referenced files from local storage to an S3 bucket.
>>> def local_to_s3_url(old_local_path: str) -> str: ... from pathlib import Path ... ... new_s3_bucket_url = "http://s3.amazonaws.com/my_bucket/" ... ... filename = Path(old_local_path).name ... return str(new_s3_bucket_url / filename)
>>> ds.virtualize.rename_paths(local_to_s3_url)