Skip to content

 zarr.group

zarr.group

group(
    store: StoreLike | None = None,
    *,
    overwrite: bool = False,
    chunk_store: StoreLike | None = None,
    cache_attrs: bool | None = None,
    synchronizer: Any | None = None,
    path: str | None = None,
    zarr_format: ZarrFormat | None = None,
    meta_array: Any | None = None,
    attributes: dict[str, JSON] | None = None,
    storage_options: dict[str, Any] | None = None,
) -> Group

Create a group.

Parameters:

  • store (StoreLike or None, default: None ) –

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

  • overwrite (bool, default: False ) –

    If True, delete any pre-existing data in store at path before creating the group.

  • chunk_store (StoreLike or None, default: None ) –

    Separate storage for chunks. Not implemented.

  • cache_attrs (bool, default: None ) –

    If True (default), user attributes will be cached for attribute read operations. If False, user attributes are reloaded from the store prior to all attribute read operations.

  • synchronizer (object, default: None ) –

    Array synchronizer.

  • path (str, default: None ) –

    Group path within store.

  • meta_array (array - like, default: None ) –

    An array instance to use for determining arrays to create and return to users. Use numpy.empty(()) by default.

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

    The zarr format to use when saving.

  • storage_options (dict, default: None ) –

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

Returns:

  • g ( Group ) –

    The new group.

Source code in zarr/api/synchronous.py
def group(
    store: StoreLike | None = None,
    *,
    overwrite: bool = False,
    chunk_store: StoreLike | None = None,  # not used
    cache_attrs: bool | None = None,  # not used, default changed
    synchronizer: Any | None = None,  # not used
    path: str | None = None,
    zarr_format: ZarrFormat | None = None,
    meta_array: Any | None = None,  # not used
    attributes: dict[str, JSON] | None = None,
    storage_options: dict[str, Any] | None = None,
) -> Group:
    """Create a group.

    Parameters
    ----------
    store : StoreLike or None, default=None
        StoreLike object to open. See the
        [storage documentation in the user guide][user-guide-store-like]
        for a description of all valid StoreLike values.
    overwrite : bool, optional
        If True, delete any pre-existing data in `store` at `path` before
        creating the group.
    chunk_store : StoreLike or None, default=None
        Separate storage for chunks. Not implemented.
    cache_attrs : bool, optional
        If True (default), user attributes will be cached for attribute read
        operations. If False, user attributes are reloaded from the store prior
        to all attribute read operations.
    synchronizer : object, optional
        Array synchronizer.
    path : str, optional
        Group path within store.
    meta_array : array-like, optional
        An array instance to use for determining arrays to create and return
        to users. Use `numpy.empty(())` by default.
    zarr_format : {2, 3, None}, optional
        The zarr format to use when saving.
    storage_options : dict
        If using an fsspec URL to create the store, these will be passed to
        the backend implementation. Ignored otherwise.

    Returns
    -------
    g : Group
        The new group.
    """
    return Group(
        sync(
            async_api.group(
                store=store,
                overwrite=overwrite,
                chunk_store=chunk_store,
                cache_attrs=cache_attrs,
                synchronizer=synchronizer,
                path=path,
                zarr_format=zarr_format,
                meta_array=meta_array,
                attributes=attributes,
                storage_options=storage_options,
            )
        )
    )