xarray.Dataset.to_zarr

Dataset.to_zarr(self, store: Union[MutableMapping, str, pathlib.Path] = None, mode: str = None, synchronizer=None, group: str = None, encoding: Mapping = None, compute: bool = True, consolidated: bool = False, append_dim: Hashable = None) → 'ZarrStore'

Write dataset contents to a zarr group.

Note

Experimental The Zarr backend is new and experimental. Please report any unexpected behavior via github issues.

Parameters
  • store (MutableMapping, str or Path, optional) – Store or path to directory in file system.

  • mode ({'w', 'w-', 'a', None}) – Persistence mode: ‘w’ means create (overwrite if exists); ‘w-‘ means create (fail if exists); ‘a’ means append (create if does not exist). If append_dim is set, mode can be omitted as it is internally set to 'a'. Otherwise, mode will default to w- if not set.

  • synchronizer (object, optional) – Array synchronizer

  • group (str, optional) – Group path. (a.k.a. path in zarr terminology.)

  • encoding (dict, optional) – 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,}, ...}

  • compute (bool, optional) – If True compute immediately, otherwise return a dask.delayed.Delayed object that can be computed later.

  • consolidated (bool, optional) – If True, apply zarr’s consolidate_metadata function to the store after writing.

  • append_dim (hashable, optional) – If set, the dimension on which the data will be appended.

References

https://zarr.readthedocs.io/