Zarr — DatasetCollection#
Backs DatasetCollection.to_zarr() and DatasetCollection.from_zarr(). The 4-D
(time, band, y, x) cube, one dask chunk per Zarr chunk.
| Backend methods | write_collection_to_zarr, read_collection_from_zarr |
| Module | pyramids_lazy._collection_zarr |
| Returns | a DatasetCollection on read; None (or a Delayed) on write |
from pyramids.dataset import DatasetCollection
cube = DatasetCollection.read_multiple_files("rasters", with_order=False)
cube.to_zarr("cube.zarr")
back = DatasetCollection.from_zarr("cube.zarr")
Region append#
A collection can be extended along an existing axis without rewriting the store: the new data is
written into a region of the existing arrays, and the collection metadata (_meta, _files) is
re-finalised afterwards so a later read reconstructs the full cube. The region is translated to
per-axis slices, and an unknown dimension name is refused with a ValueError.
Chunk-grid alignment is not validated. A region that straddles a chunk boundary is written as given, so it is the caller's job to append on the chunk grid.
As with the single-Dataset path, the pyramids geobox is persisted as GeoZarr attributes so
standard readers can reconstruct it.
API#
pyramids_lazy._collection_zarr.write_collection_to_zarr(collection, store, *, compute=True, mode='w', storage_options=None, compressor='auto', append_dim=None, region=None)
#
Serialise the 4-D (T, B, R, C) cube of collection to a Zarr store.
Each dask chunk in collection.data lands in an independent Zarr chunk file. Geobox metadata
is written as attributes on the root group + the data array. See
:meth:DatasetCollection.to_zarr for the full argument contract.
Source code in src/pyramids_lazy/_collection_zarr.py
pyramids_lazy._collection_zarr.read_collection_from_zarr(collection_cls, store, *, storage_options=None)
#
Open a pyramids-written cube Zarr store into a lazy DatasetCollection.
Inverse of :func:write_collection_to_zarr. The 4-D (time, band, y, x) data array is
read lazily straight from the store, and the geobox is recovered from the GeoZarr spatial_ref
mapping. collection_cls is the DatasetCollection class to construct.