xarray.DataArray.to_zarr (original) (raw)

DataArray.to_zarr(store=None, chunk_store=None, mode=None, synchronizer=None, group=None, encoding=None, *, compute=True, consolidated=None, append_dim=None, region=None, safe_chunks=True, storage_options=None, zarr_version=None, zarr_format=None, write_empty_chunks=None, chunkmanager_store_kwargs=None)[source]#

Write DataArray contents to a Zarr store

Zarr chunks are determined in the following way:

Parameters:

Returns:

References

https://zarr.readthedocs.io/

Notes

Zarr chunking behavior:

If chunks are found in the encoding argument or attribute corresponding to any DataArray, those chunks are used. If a DataArray is a dask array, it is written with those chunks. If not other chunks are found, Zarr uses its own heuristics to choose automatic chunk sizes.

encoding:

The encoding attribute (if exists) of the DataArray(s) will be used. Override any existing encodings by providing the encoding kwarg.

fill_value handling:

There exists a subtlety in interpreting zarr’s fill_value property. For zarr v2 format arrays, fill_value is always interpreted as an invalid value similar to the _FillValue attribute in CF/netCDF. For Zarr v3 format arrays, only an explicit _FillValue attribute will be used to mask the data if requested using mask_and_scale=True. See this Github issuefor more.