Skip to content

 zarr.open_array

zarr.open_array

open_array(
    store: StoreLike | None = None,
    *,
    zarr_format: ZarrFormat | None = None,
    path: PathLike = "",
    storage_options: dict[str, Any] | None = None,
    **kwargs: Any,
) -> AnyArray

Open an array using file-mode-like semantics.

Parameters:

  • store (StoreLike, default: None ) –

    StoreLike object to open. See the storage documentation in the user guide for a description of all valid StoreLike values.

  • zarr_format ((2, 3, None), default: 2 ) –

    The zarr format to use when saving.

  • path (str, default: '' ) –

    Path in store to array.

  • storage_options (dict, default: None ) –

    If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise.

  • **kwargs (Any, default: {} ) –

    Any keyword arguments to pass to create.

Returns:

Source code in zarr/api/synchronous.py
def open_array(
    store: StoreLike | None = None,
    *,
    zarr_format: ZarrFormat | None = None,
    path: PathLike = "",
    storage_options: dict[str, Any] | None = None,
    **kwargs: Any,
) -> AnyArray:
    """Open an array using file-mode-like semantics.

    Parameters
    ----------
    store : StoreLike
        StoreLike object to open. See the
        [storage documentation in the user guide][user-guide-store-like]
        for a description of all valid StoreLike values.
    zarr_format : {2, 3, None}, optional
        The zarr format to use when saving.
    path : str, optional
        Path in store to array.
    storage_options : dict
        If using an fsspec URL to create the store, these will be passed to
        the backend implementation. Ignored otherwise.
    **kwargs
        Any keyword arguments to pass to [`create`][zarr.api.asynchronous.create].


    Returns
    -------
    AsyncArray
        The opened array.
    """
    return Array(
        sync(
            async_api.open_array(
                store=store,
                zarr_format=zarr_format,
                path=path,
                storage_options=storage_options,
                **kwargs,
            )
        )
    )