Skip to content

 zarr.open_like

zarr.open_like

open_like(
    a: ArrayLike, path: str, **kwargs: Any
) -> AnyArray

Open a persistent array like another array.

Parameters:

  • a (Array) –

    The shape and data-type of a define these same attributes of the returned array.

  • path (str) –

    The path to the new array.

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

    Additional keyword arguments passed to open_array. If mode is omitted or None, it defaults to "a". Pass mode="r" when opening an existing array from a read-only store.

Returns:

  • Array

    The opened array.

Source code in zarr/api/synchronous.py
def open_like(a: ArrayLike, path: str, **kwargs: Any) -> AnyArray:
    """Open a persistent array like another array.

    Parameters
    ----------
    a : Array
        The shape and data-type of a define these same attributes of the returned array.
    path : str
        The path to the new array.
    **kwargs
        Additional keyword arguments passed to `open_array`.
        If `mode` is omitted or `None`, it defaults to `"a"`. Pass `mode="r"` when
        opening an existing array from a read-only store.

    Returns
    -------
    Array
        The opened array.
    """
    return Array(sync(async_api.open_like(a, path=path, **kwargs)))