xarray.DataTree.to_zarr#
- DataTree.to_zarr(store, mode='w-', encoding=None, consolidated=True, group=None, compute=True, **kwargs)[source]#
Write datatree contents to a Zarr store.
- Parameters
store (
MutableMapping,strorPath, optional) – Store or path to directory in file systemmode (
{{"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 “w-”.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}, ...}, ...}. Seexarray.Dataset.to_zarrfor available options.consolidated (
bool) – If True, apply zarr’s consolidate_metadata function to the store after writing metadata for all groups.group (
str, optional) – Group path. (a.k.a. path in zarr terminology.)compute (
bool, default:True) – If true compute immediately, otherwise return adask.delayed.Delayedobject that can be computed later. Metadata is always updated eagerly. Currently,compute=Falseis not supported.kwargs – Additional keyword arguments to be passed to
xarray.Dataset.to_zarr
Note
Due to file format specifications the on-disk root group name is always
"/"overriding any givenDataTreeroot node name.