datatree.DataTree.to_zarr#

DataTree.to_zarr(store, mode: str = 'w-', encoding=None, consolidated: bool = True, **kwargs)[source][source]#

Write datatree contents to a Zarr store.

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

  • mode ({{"w", "w-", "a", "r+", None}, default: "w-") – Persistence mode: “w” means create (overwrite if exists); “w-” means create (fail if exists); “a” means override existing variables (create if does not exist); “r+” means modify existing array values only (raise an error if any metadata or shapes would change). The default mode is “a” if append_dim is set. Otherwise, it is “r+” if region is set and w- otherwise.

  • encoding (dict, optional) – Nested dictionary with variable names as keys and dictionaries of variable specific encodings as values, e.g., {"root/set1": {"my_variable": {"dtype": "int16", "scale_factor": 0.1}, ...}, ...}. See xarray.Dataset.to_zarr for available options.

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

  • kwargs – Additional keyword arguments to be passed to xarray.Dataset.to_zarr