xarray_beam.setup_zarr¶
- xarray_beam.setup_zarr(template, store, zarr_chunks=None, zarr_shards=None, zarr_format=None, encoding=None, *, stage_locally=None)[source]¶
Setup a Zarr store.
Creates a zarr template at the specified store by writing template metadata.
- Parameters:
template (Dataset) – a lazy xarray.Dataset already chunked using Dask (e.g., as created by xarray_beam.make_template). One or more variables are expected to be “chunked” with Dask, and will only have their metadata written to Zarr without array values.
store (str | Store | StorePath | FSMap | Path | dict[str, Buffer] | PathLike[str]) – a string corresponding to a Zarr path or an existing Zarr store.
zarr_chunks (Mapping[str, int] | None) – chunking scheme to use for Zarr. If set, overrides the chunking scheme on already chunked arrays in template. Chunks of -1 use the full dimension size from the dataset, like dask.array.
zarr_shards (Mapping[str, int] | None) – optional sharding scheme to use for Zarr. Only valid if using zarr_format=3. Shards of -1 use the full dimension size from the dataset, like dask.array. Unspecified shard sizes default to chunk sizes.
zarr_format (int | None) – The desired zarr format to target (currently 2 or 3). The default of None will attempt to determine the zarr version from store when possible, otherwise defaulting to the default version used by the zarr-python library installed.
encoding (Mapping[str, Any] | None) – Nested dictionary with variable names as keys and dictionaries of variable specific encodings as values, e.g.,
{"my_variable": {"dtype": "int16", "scale_factor": 0.1,}, ...}stage_locally (bool | None) – If True, write Zarr metadata to a local temporary directory before copying to store in parallel. This can significantly speed up setup on high-latency filesystems. By default, uses local staging if possible, which is true as long as store is provided as as string or path.
- Return type:
None