ZarrBackend¶
Import path: earth2studio.io.ZarrBackend
Documentation¶
A backend that supports the zarr format.
One array is created per variable label of an add_array template,
with the dimension and auxiliary coordinates stored alongside them so the group
opens directly with xarray.open_zarr (see to_xarray).
Parameters:
-
file_name(str, default:None) –Optional name to provide to the zarr store, if provided then this function will create a directory store with this file name. If none, will create a in-memory store., by default None
-
chunks(dict[str, int], default:{'ensemble': 1, 'time': 1, 'lead_time': 1}) –An ordered dict of chunk sizes keyed by dimension. Dimensions that are not present in a stored array are ignored and dimensions without an entry are stored in a single chunk, by default {"ensemble": 1, "time": 1, "lead_time": 1}
-
backend_kwargs(dict[str, Any], default:{'overwrite': False}) –Key word arguments for zarr.Group root object, by default {"overwrite": False}
-
zarr_codecs(CompressorsLike, default:None) –Compression codec to use when creating any new arrays. Only effects Zarr 3.0. If None, will use no compressor, by default None
Note
For keyword argument options see: zarr.readthedocs.io/en/latest/api/zarr/index.html#zarr.group
Note
Variable labels name arrays verbatim, including statistic qualifiers such as
tp:sum:6h. A local store creates one directory per array, so such labels
require a file system that permits : in names.
add_array ¶
add_array(template: DataArray) -> None
Create the arrays a template describes in the zarr group.
Coordinates are written once, here, together with their attributes. Each
stored array lists its auxiliary coordinates in a CF coordinates
attribute and carries the template's attributes.
Parameters:
-
template(DataArray) –Concrete coordinate signature; field values are never read.