class tensorstore.Spec

Specification for opening or creating a TensorStore.

Constructors

Spec(json: Any)

Constructs from the JSON representation.

Accessors

open_mode : OpenMode

Open mode with which the driver will be opened.

dtype : dtype | None

Data type, or None if unspecified.

transform : IndexTransform | None

The index transform, or None if unspecified.

domain : IndexDomain | None

Effective index domain, including any constraints implied by driver-specific options.

rank : int | None

Returns the rank of the domain, or None if unspecified.

ndim : int | None

Alias for rank.

schema : Schema

Effective schema, including any constraints implied by driver-specific options.

chunk_layout : ChunkLayout

Effective chunk layout, including any constraints implied by driver-specific options.

codec : CodecSpec | None

Effective codec, including any constraints implied by driver-specific options.

fill_value : ArrayLike | None

Effective fill value, including any constraints implied by driver-specific options.

dimension_units : tuple[Unit | None, ...] | None

Effective physical units of each dimension of the domain, including any constraints implied by driver-specific options.

kvstore : KvStore.Spec | None

Spec of the associated key-value store used as the underlying storage.

base : Spec | None

Spec of the underlying TensorStore, if this is an adapter of a single underlying TensorStore.

to_json(include_defaults: bool = False) Any

Converts to the JSON representation.

copy() Spec

Returns a copy of the spec.

origin : tuple[int, ...]

Inclusive lower bound of the domain.

shape : tuple[int, ...]

Shape of the domain.

size : int

Total number of elements in the domain.

Indexing

__getitem__(transform: IndexTransform) Spec

Transforms the spec using an explicit index transform.

__getitem__(domain: IndexDomain) Spec

Transforms the spec using an explicit index domain.

__getitem__(expr: DimExpression) Spec

Transforms the spec using a dimension expression.

__getitem__(indices: NumpyIndexingSpec) Spec

Transforms the spec using NumPy-style indexing with default index array semantics.

oindex[indices: NumpyIndexingSpec] Spec

Transforms the spec using NumPy-style indexing with outer indexing semantics.

vindex[indices: NumpyIndexingSpec] Spec

Transforms the spec using NumPy-style indexing with vectorized indexing semantics.

T : Spec

View with transposed domain (reversed dimension order).

translate_to[origins: Sequence[int | None] | int | None] Spec

Returns a new view with origin translated to the specified origin.

translate_by[offsets: Sequence[int | None] | int | None] Spec

Returns a new view with the origin translated by the specified offsets.

translate_backward_by[offsets] Spec

Returns a new view with the origin translated backward by the specified offsets.

label[labels: str | Sequence[str]] Spec

Returns a new view with the dimension labels changed.

mark_bounds_implicit[implicit: bool | None | slice] Spec

Returns a new view with the lower/upper bounds changed to implicit/explicit.

transpose(axes: DimSelectionLike | None = None) Spec

Returns a view with a transposed domain.

Comparison operators

__eq__(other: Spec) bool

Compares with another Spec for equality based on the JSON representation.

Mutators

update(*, open_mode: OpenMode | None = None, ...) None

Adds additional constraints or changes the open mode.

String representation

__repr__() str

Returns a string representation based on the JSON representation.