Repository: dask/dask
File: dask/array/core.py (Python)

Code before:
        Passed to determine whether the store should be readonly by evaluating the following:
        'kwargs.pop("read_only", kwargs.pop("mode", "a") == "r")'

    Returns
    -------
    store : zarr.store.Store or original url
        A Zarr-compatible store object. Can be:
        - `zarr.storage.FsspecStore` for Zarr v3 with storage options
        - `zarr.storage.FSStore` for Zarr v2 with storage options
        - The original URL/path if no storage options are provided
    """
    # Cannot directly import FSStore from storage.
    from zarr import storage

    storage_options = storage_options or {}

    if storage_options:
        if _zarr_v3():
            read_only = kwargs.pop("read_only", kwargs.pop("mode", "a") == "r")
            store = storage.FsspecStore.from_url(
                url, read_only=read_only, storage_options=storage_options
            )
        else:
            store = storage.FSStore(url, **storage_options)
    else:
        store = url
    return store


def to_zarr(
    arr,
    url,
    component=None,
    shard_factors=None,
    storage_options=None,
    overwrite=False,
    region=None,
    compute=True,
    return_stored=False,
    **kwargs,
):
    """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://

Review comment (suggestion):
```suggestion
    if storage_options is not None:
        if _zarr_v3():
            read_only = kwargs.pop("read_only", kwargs.pop("mode", "a") == "r")
            store = storage.FsspecStore.from_url(
                url, read_only=read_only, storage_options=storage_options
            )
        else:
            store = storage.FSStore(url, **storage_options)
    else:
        store = url
```

Code after:
    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 ``url`` is a zarr.Array.
        Not to be used with other types of ``url``.
    compute: bool
        See :func:`~dask.array.store` for more details.
    return_stored: bool
        See :func:`~dask.array.store` for more details.
    zarr_array_kwargs: dict or None
        Keyword arguments passed to :func:`zarr.create_array` (for zarr v3) or
        :func:`zarr.create` (for zarr v2). This function automatically sets
        ``shape``, ``chunks``, and ``dtype`` based on the dask array, but these
        can be overridden.

        Common options include:

        - ``compressor``: Compression algorithm (e.g., ``zarr.Blosc()``)
        - ``filters``: List of filters to apply
        - ``fill_value``: Value to use for uninitialized portions
        - ``order``: Memory layout ('C' or 'F')
        - ``dimension_separator``: Separator for chunk keys ('/' or '.')

        For the complete list of available arguments, see the zarr documentation:

        - zarr v3: https://zarr.readthedocs.io/en/stable/api/zarr/index.html#zarr.create_array
        - zarr v2: https://zarr.readthedocs.io/en/stable/api/core.html#zarr.create
    zarr_read_kwargs: dict or None
        Keyword arguments passed to the storage backend when creating a zarr
        store from a URL string. Only used when ``url`` is a string (not when
        ``url`` is already a zarr.Array or MutableMapping instance).

        Common options include:

        - ``mode``: File access mode. Options include: