MCPcopy Index your code
hub / github.com/dask/dask / from_zarr

Function from_zarr

dask/array/core.py:3737–3794  ·  view source on GitHub ↗

Load array from the zarr storage format See https://zarr.readthedocs.io for details about the format. Parameters ---------- 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

(
    url,
    component=None,
    storage_options=None,
    chunks=None,
    name=None,
    inline_array=False,
    **kwargs,
)

Source from the content-addressed store, hash-verified

3735
3736
3737def from_zarr(
3738 url,
3739 component=None,
3740 storage_options=None,
3741 chunks=None,
3742 name=None,
3743 inline_array=False,
3744 **kwargs,
3745):
3746 """Load array from the zarr storage format
3747
3748 See https://zarr.readthedocs.io for details about the format.
3749
3750 Parameters
3751 ----------
3752 url: Zarr Array or str or MutableMapping
3753 Location of the data. A URL can include a protocol specifier like s3://
3754 for remote data. Can also be any MutableMapping instance, which should
3755 be serializable if used in multiple processes.
3756 component: str or None
3757 If the location is a zarr group rather than an array, this is the
3758 subcomponent that should be loaded, something like ``'foo/bar'``.
3759 storage_options: dict
3760 Any additional parameters for the storage backend (ignored for local
3761 paths)
3762 chunks: tuple of ints or tuples of ints
3763 Passed to :func:`dask.array.from_array`, allows setting the chunks on
3764 initialisation, if the chunking scheme in the on-disc dataset is not
3765 optimal for the calculations to follow.
3766 name : str, optional
3767 An optional keyname for the array. Defaults to hashing the input
3768 kwargs:
3769 Passed to :class:`zarr.core.Array`.
3770 inline_array : bool, default False
3771 Whether to inline the zarr Array in the values of the task graph.
3772 See :meth:`dask.array.from_array` for an explanation.
3773
3774 See Also
3775 --------
3776 from_array
3777 """
3778 import zarr
3779
3780 storage_options = storage_options or {}
3781 if isinstance(url, zarr.Array):
3782 z = url
3783 elif isinstance(url, (str, os.PathLike)):
3784 if isinstance(url, os.PathLike):
3785 url = os.fspath(url)
3786
3787 zarr_store = _setup_zarr_store(url, storage_options, **kwargs)
3788 z = zarr.open_array(store=zarr_store, path=component, **kwargs)
3789 else:
3790 z = zarr.open_array(store=url, path=component, **kwargs)
3791 chunks = chunks if chunks is not None else z.chunks
3792 if name is None:
3793 name = "from-zarr-" + tokenize(z, component, storage_options, chunks, **kwargs)
3794 return from_array(z, chunks, name=name, inline_array=inline_array)

Callers

nothing calls this directly

Calls 3

_setup_zarr_storeFunction · 0.85
from_arrayFunction · 0.70
tokenizeFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…