Skip to content

zarr

stores.arrays._zarr.ZarrArrayStore(path, disk_format=DiskFormat.ZARR, mode='r', **kwargs)

Bases: ArrayStore

Zarr-based array store where each logical path maps to a Zarr array.

Paths use '/' to denote nested logical structure.

Open a Zarr store using zarr.open_group. Please refer to it's documentation for information on available args and kwargs.

PARAMETER DESCRIPTION
store

Store or path to directory in file system or name of zip file. Strings are interpreted as paths on the local file system and used as the root argument to zarr.storage.LocalStore. Dictionaries are used as the store_dict argument in zarr.storage.MemoryStore. By default (store=None) a new zarr.storage.MemoryStore is created.

mode

Persistence modes:

  • r means read only (must exist);
  • r+ means read/write (must exist);
  • a means read/write (create if doesn't exist);
  • w means create (overwrite if exists);
  • w- means create (fail if exists).

TYPE: str DEFAULT: 'r'

append(path, data, *args, **kwargs)

Append data along the first axis to an existing Zarr array; creates the array with an unlimited first dimension if it does not exist.

available()

List all stored Zarr array paths (joined by '/').

create(path, shape, overwrite=False, dtype=None, chunks='auto', **kwargs)

Pre-allocate an array with the given shape and dtype.

PARAMETER DESCRIPTION
path

hierarchical key, e.g. 'coords'.

TYPE: Path | str

shape

full shape of the array.

TYPE: tuple[int, ...]

overwrite

if True, delete existing before create; otherwise error if exists.

TYPE: bool DEFAULT: False

dtype

numpy-compatible dtype.

TYPE: DTypeLike | None DEFAULT: None

chunks

chunk shape or 'auto'.

TYPE: tuple[int, ...] | Literal['auto'] DEFAULT: 'auto'

read(path, view=None, **kwargs)

Read the array from Zarr, optionally returning a subset efficiently. Returns None if the path does not exist.

write(path, data, view=None, dtype=None, **kwargs)

Write data to an array, whole or sliced. Will create the array if it does not exist.

PARAMETER DESCRIPTION
path

hierarchical key of the array.

TYPE: Path | str

array

data to write.

view

if None, overwrite entire array (requires create or existing), else write into the specified slice region.

TYPE: OptionalSliceSpec DEFAULT: None

overwrite

if True and slices is None, replaces existing array definition.