Skip to content

Array

zarrista.Array

A Zarr array.

attrs property

attrs: dict[str, JSONValue]

The array's user attributes as a dict.

chunk_grid property

chunk_grid: ChunkGrid

The chunk grid of the array.

compressors property

compressors: list[BytesToBytesCodec]

The bytes-to-bytes codecs ("compressors").

dimension_names property

dimension_names: list[str | None] | None

The dimension names, if any were specified.

dtype property

dtype: DataType

The Zarr data type.

filters property

filters: list[ArrayToArrayCodec]

The array-to-array codecs ("filters").

metadata property

metadata: ArrayMetadataV3

The array's full Zarr v3 metadata.

ndim property

ndim: int

The number of dimensions.

path property

path: str

The array's path in the store.

serializer property

serializer: ArrayToBytesCodec

The array-to-bytes codec ("serializer").

shape property

shape: list[int]

The array shape.

__getitem__

__getitem__(selection: Selection) -> DecodedArray

Read a region with numpy-style basic indexing, e.g. arr[0:10, :, 5].

Sugar for retrieve_array_subset.

compact_chunk

compact_chunk(
    chunk_indices: list[int], **codec_options: Unpack[CodecOptions]
) -> bool

Re-encode the stored chunk in place, returning whether it was rewritten.

Reads the encoded chunk, attempts to produce a more compact encoding, and rewrites it if that succeeds. Returns True if the chunk was rewritten, False if it was absent or already optimal.

Keyword arguments are passed as CodecOptions.

erase_chunk

erase_chunk(chunk_indices: list[int]) -> None

Delete the chunk at chunk_indices from the store.

Erasing an absent chunk is a no-op.

erase_metadata

erase_metadata() -> None

Delete the array's metadata from the store.

from_metadata staticmethod

from_metadata(
    metadata: ArrayMetadataV3,
    store: FilesystemStore | MemoryStore,
    path: str = "/",
) -> Array

Use the provided metadata to open a new array at path in store.

This does not write the metadata to the store.

open staticmethod

open(store: FilesystemStore | MemoryStore, path: str = '/') -> Array

Open the array stored at path in store.

read_only

read_only() -> Array

Return a read-only view of this array.

Reads behave identically, but any write (store_chunk, erase_chunk, erase_metadata, ...) raises at runtime.

retrieve_array_subset

retrieve_array_subset(
    selection: Selection, **codec_options: Unpack[CodecOptions]
) -> DecodedArray

Read and decode an array region selected with numpy-style basic indexing.

The result is ndim-preserving (consistent with a zarrs ArraySubset): an integer selects a length-1 range and that axis is retained.

Keyword arguments are passed as CodecOptions.

retrieve_chunk

retrieve_chunk(
    chunk_indices: list[int], **codec_options: Unpack[CodecOptions]
) -> DecodedArray

Read and decode the chunk at the given chunk grid indices.

Keyword arguments are passed as CodecOptions.

store_chunk

store_chunk(
    chunk_indices: list[int],
    decoded_chunk: ArrayBytes,
    **codec_options: Unpack[CodecOptions]
) -> None

Encode decoded_chunk and write it as the chunk at chunk_indices.

decoded_chunk holds the decoded chunk data; the array's codec pipeline encodes it before it is written. If the data equals the fill value and store_empty_chunks is False, the chunk is erased instead.

Keyword arguments are passed as CodecOptions.

store_encoded_chunk

store_encoded_chunk(chunk_indices: list[int], encoded_chunk: Buffer) -> None

Write already-encoded bytes directly as the chunk at chunk_indices.

The bytes are stored verbatim with no encoding. The caller is responsible for ensuring they match the array's codec pipeline; invalid bytes produce a chunk that cannot be decoded.

zarrista.AsyncArray

A Zarr array backed by an async store.

attrs property

attrs: dict[str, JSONValue]

The array's user attributes as a dict.

chunk_grid property

chunk_grid: ChunkGrid

The chunk grid of the array.

compressors property

compressors: list[BytesToBytesCodec]

The bytes-to-bytes codecs ("compressors").

dimension_names property

dimension_names: list[str | None] | None

The dimension names, if any were specified.

dtype property

dtype: DataType

The Zarr data type.

filters property

filters: list[ArrayToArrayCodec]

The array-to-array codecs ("filters").

metadata property

metadata: ArrayMetadataV3

The array's full Zarr v3 metadata.

ndim property

ndim: int

The number of dimensions.

path property

path: str

The array's path in the store.

serializer property

serializer: ArrayToBytesCodec

The array-to-bytes codec ("serializer").

shape property

shape: list[int]

The array shape.

__getitem__ async

__getitem__(selection: Selection) -> DecodedArray

Read a region with numpy-style basic indexing: await arr[0:10, :, 5].

Sugar for retrieve_array_subset.

compact_chunk async

compact_chunk(
    chunk_indices: list[int], **codec_options: Unpack[CodecOptions]
) -> bool

Re-encode the stored chunk in place, returning whether it was rewritten.

Reads the encoded chunk, attempts to produce a more compact encoding, and rewrites it if that succeeds. Returns True if the chunk was rewritten, False if it was absent or already optimal.

Keyword arguments are passed as CodecOptions.

erase_chunk async

erase_chunk(chunk_indices: list[int]) -> None

Delete the chunk at chunk_indices from the store.

Erasing an absent chunk is a no-op.

erase_metadata async

erase_metadata() -> None

Delete the array's metadata from the store.

from_metadata staticmethod

from_metadata(
    metadata: ArrayMetadataV3, store: AsyncStore, path: str = "/"
) -> AsyncArray

Use the provided metadata to open a new array at path in store.

This does not write the metadata to the store.

open_async async staticmethod

open_async(store: AsyncStore, path: str = '/') -> AsyncArray

Open the array stored at path in store.

store may be an obstore ObjectStore or an icechunk Session.

read_only

read_only() -> AsyncArray

Return a read-only view of this array.

Reads behave identically, but any write (store_chunk, erase_chunk, erase_metadata, ...) raises at runtime.

retrieve_array_subset async

retrieve_array_subset(
    selection: Selection, **codec_options: Unpack[CodecOptions]
) -> DecodedArray

Read and decode an array region selected with numpy-style basic indexing.

The result is ndim-preserving (consistent with a zarrs ArraySubset): an integer selects a length-1 range and that axis is retained.

Keyword arguments are passed as CodecOptions.

retrieve_chunk async

retrieve_chunk(
    chunk_indices: list[int], **codec_options: Unpack[CodecOptions]
) -> DecodedArray

Read and decode the chunk at the given chunk grid indices.

Keyword arguments are passed as CodecOptions.

store_chunk async

store_chunk(
    chunk_indices: list[int],
    decoded_chunk: ArrayBytes,
    **codec_options: Unpack[CodecOptions]
) -> None

Encode decoded_chunk and write it as the chunk at chunk_indices.

decoded_chunk holds the decoded chunk data; the array's codec pipeline encodes it before it is written. If the data equals the fill value and store_empty_chunks is False, the chunk is erased instead.

Keyword arguments are passed as CodecOptions.

store_encoded_chunk async

store_encoded_chunk(chunk_indices: list[int], encoded_chunk: Buffer) -> None

Write already-encoded bytes directly as the chunk at chunk_indices.

The bytes are stored verbatim with no encoding. The caller is responsible for ensuring they match the array's codec pipeline; invalid bytes produce a chunk that cannot be decoded.