MCPcopy Create free account
hub / github.com/dask/dask / to_zarr

Function to_zarr

dask/array/core.py:3937–4119  ·  view source on GitHub ↗

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:

(
    arr,
    url,
    component=None,
    storage_options=None,
    region=None,
    compute=True,
    return_stored=False,
    mode="a",
    **zarr_array_kwargs,
)

Source from the content-addressed store, hash-verified

3935
3936
3937def to_zarr(
3938 arr,
3939 url,
3940 component=None,
3941 storage_options=None,
3942 region=None,
3943 compute=True,
3944 return_stored=False,
3945 mode="a",
3946 **zarr_array_kwargs,
3947):
3948 """Save array to the zarr storage format
3949
3950 See https://zarr.readthedocs.io for details about the format.
3951
3952 Parameters
3953 ----------
3954 arr: dask.array
3955 Data to store
3956 url: Zarr Array or str or MutableMapping
3957 Location of the data. A URL can include a protocol specifier like s3://
3958 for remote data. Can also be any MutableMapping instance, which should
3959 be serializable if used in multiple processes.
3960 component: str or None
3961 If the location is a zarr group rather than an array, this is the
3962 subcomponent that should be created/over-written. If both `component`
3963 and 'name' in `zarr_array_kwargs` are specified, `component` takes
3964 precedence. This will change in a future version.
3965 storage_options: dict
3966 Any additional parameters for the storage backend (ignored for local
3967 paths)
3968 overwrite: bool
3969 If given array already exists, overwrite=False will cause an error,
3970 where overwrite=True will replace the existing data. Deprecated, please
3971 add to zarr_kwargs
3972 region: tuple of slices or None
3973 The region of data that should be written if ``url`` is a zarr.Array.
3974 Not to be used with other types of ``url``.
3975 compute: bool
3976 See :func:`~dask.array.store` for more details.
3977 return_stored: bool
3978 See :func:`~dask.array.store` for more details.
3979 mode: Literal["r+", "a", "w", "w-"]
3980 Keyword argument `mode` passed to the storage backend when creating a zarr
3981 store from a URL string. Only used when ``url`` is a string (not when
3982 ``url`` is already a zarr.Array or MutableMapping instance).
3983
3984 Common options include:
3985 - ``'r+'``: Read/write, must exist
3986 - ``'a'``: Read/write, create if doesn't exist (default)
3987 - ``'w'``: Create, remove existing data if present
3988 - ``'w-'``: Create, fail if exists
3989 **zarr_array_kwargs:
3990 .. deprecated:: 2025.12.0
3991 Passing storage io-related arguments via ``**kwargs`` is deprecated.
3992 Please use the ``mode`` parameter instead when using ``**kwargs`` with the
3993 ``mode`` keys and corresponding values. ``read_only`` is not allowed anymore
3994 and will not have an effect.

Callers 1

to_zarrMethod · 0.85

Calls 11

maxFunction · 0.90
_zarr_v3Function · 0.85
_check_regular_chunksFunction · 0.85
_setup_zarr_storeFunction · 0.85
popMethod · 0.80
storeMethod · 0.80
anyMethod · 0.45
itemsMethod · 0.45
getMethod · 0.45
rechunkMethod · 0.45

Tested by

no test coverage detected