Array¶
zarrista.Array ¶
A Zarr array.
compressors
property
¶
compressors: list[BytesToBytesCodec]
The bytes-to-bytes codecs ("compressors").
dimension_names
property
¶
The dimension names, if any were specified.
__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 ¶
Delete the chunk at chunk_indices from the store.
Erasing an absent chunk is a no-op.
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 ¶
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.
compressors
property
¶
compressors: list[BytesToBytesCodec]
The bytes-to-bytes codecs ("compressors").
dimension_names
property
¶
The dimension names, if any were specified.
__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
¶
Delete the chunk at chunk_indices from the store.
Erasing an absent chunk is a no-op.
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
¶
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.