Skip to content

abczarr.drivers.tensorstore

The TensorStore backend driver.

This module opens a Zarr array through Google's TensorStore, a fast, C++-backed reader and writer, and wraps it as a ZarrArray so it reads and writes through the uniform surface. A v3 array is opened through TensorStore's zarr3 driver, and a v2 array through its native zarr driver, so both formats read and write. abczarr.open opens an array through this driver. TensorStore has no group object of its own, so a group is read straight from the store by PathGroup, while each of its arrays is opened through TensorStore.

Classes

TensorStoreNode

TensorStoreNode(store_path: PathLike)

Bases: ZarrNode

The base class shared by the TensorStore array and group adapters.

TensorStore keeps no user attributes of its own. Both node types read attributes from their cached metadata. A write persists by rewriting the metadata document through the store, the same persistence path ZarrNode defines.

TensorStoreArray

TensorStoreArray(array: Any)

Bases: TensorStoreNode, ZarrArray

A ZarrArray backed by an open TensorStore array.

This class wraps a tensorstore.TensorStore handle so it reads and writes through the uniform surface. TensorStore's richer indexing, including its oindex and vindex selectors and its index transforms, stays reachable through native.

Attributes

metadata property
metadata: Any
zarr_version property
zarr_version: ZarrVersion
ndim property
ndim: int
shape property
shape: Shape
dtype property
dtype: DTypeLike
chunks property
chunks: Shape
shards property
shards: Shape | None

Methods:

__getitem__
__getitem__(index: Any) -> ArrayLike
__setitem__
__setitem__(index: Any, value: ArrayLike) -> None
as_async
as_async() -> AsyncTensorStoreArray

The native coroutine twin of this array.

Reads and writes await TensorStore's own futures directly, rather than blocking on .result().

AsyncTensorStoreArray

AsyncTensorStoreArray(sync: ZarrArray)

Bases: AsyncZarrArray

The native async twin of a TensorStoreArray.

Every TensorStore operation returns an awaitable future. getitem and setitem await that future directly, rather than blocking on its result. Its "async" capability reports Support.NATIVE.

Methods:

getitem async
getitem(index: Any) -> ArrayLike
setitem async
setitem(index: Any, value: ArrayLike) -> None

TensorStoreGroup

TensorStoreGroup(store_path: PathLike, mode: str = 'r')

Bases: TensorStoreNode, PathGroup

The group returned when the TensorStore driver opens a Zarr group.

TensorStore has no group object of its own. This class relies on PathGroup to read the group's own metadata and list the names of its members straight from the store, while each child array is opened through TensorStore. A subgroup is another TensorStoreGroup, so an entire hierarchy is reachable from a single opened group.

TensorStoreDriver

Bases: Driver

The TensorStore backend, as a driver.

This driver reports the v3 codecs TensorStore reads and writes, and opens a Zarr array through TensorStore itself. A v3 array is opened through TensorStore's zarr3 driver, and a v2 array through its native zarr driver. A group has no TensorStore object of its own, so it is read straight from the store through the path group.

Attributes

name class-attribute instance-attribute
name = 'tensorstore'
available property
available: bool

Methods:

capability
capability(capability: str) -> Support