dask.array.to_zarr#
- dask.array.to_zarr(arr, url, component=None, storage_options=None, region=None, compute=True, return_stored=False, mode='a', **zarr_array_kwargs)[source]#
Save array to the zarr storage format
See https://zarr.readthedocs.io for details about the format.
- Parameters:
- arr: dask.array
Data to store
- url: Zarr Array or str or MutableMapping
Location of the data. A URL can include a protocol specifier like s3:// for remote data. Can also be any MutableMapping instance, which should be serializable if used in multiple processes.
- component: str or None
If the location is a zarr group rather than an array, this is the subcomponent that should be created/over-written. If both component and ‘name’ in zarr_array_kwargs are specified, component takes precedence. This will change in a future version.
- storage_options: dict
Any additional parameters for the storage backend (ignored for local paths)
- overwrite: bool
If given array already exists, overwrite=False will cause an error, where overwrite=True will replace the existing data. Deprecated, please add to zarr_kwargs
- region: tuple of slices or None
The region of data that should be written if
urlis a zarr.Array. Not to be used with other types ofurl.- compute: bool
See
store()for more details.- return_stored: bool
See
store()for more details.- mode: Literal[“r+”, “a”, “w”, “w-“]
Keyword argument mode passed to the storage backend when creating a zarr store from a URL string. Only used when
urlis a string (not whenurlis already a zarr.Array or MutableMapping instance).- Common options include:
'r+': Read/write, must exist'a': Read/write, create if doesn’t exist (default)'w': Create, remove existing data if present'w-': Create, fail if exists
- **zarr_array_kwargs:
Deprecated since version 2025.12.0: Passing storage io-related arguments via
**kwargsis deprecated. Please use themodeparameter instead when using**kwargswith themodekeys and corresponding values.read_onlyis not allowed anymore and will not have an effect.Keyword arguments passed to
Group.create_array()(for zarr v3, where Group is a zarr group) orzarr.create()(for zarr v2). This function automatically setsshape,chunks, anddtypebased on the dask array, but these can be overridden.Common options include:
compressor: Compression algorithm (e.g.,zarr.Blosc())filters: List of filters to applyfill_value: Value to use for uninitialized portionsorder: Memory layout (‘C’ or ‘F’)dimension_separator: Separator for chunk keys (‘/’ or ‘.’)
For the complete list of available arguments, see the zarr documentation:
- Raises:
- ValueError
If
arrhas unknown chunk sizes, which is not supported by Zarr. Ifregionis specified andurlis not a zarr.Array Ifmodeis specified as r.