MCPcopy
hub / github.com/dask/dask / to_zarr

Function to_zarr

dask/array/core.py:3942–4124  ·  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

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…