class tensorstore.Schema

Driver-independent options for defining a TensorStore schema.

Constructors

Schema(json: Any)

Constructs from its JSON representation.

Schema(*, rank: int | None = None, dtype: dtype | None = None, ...)

Constructs from component parts.

Mutators

update(*, rank: int | None = None, ...) None

Adds additional constraints.

Accessors

rank : int | None

Rank of the schema, or None if unspecified.

ndim : int | None

Alias for rank.

dtype : dtype | None

Data type, or None if unspecified.

domain : IndexDomain | None

Domain of the schema, or None if unspecified.

chunk_layout : ChunkLayout

Chunk layout constraints specified by the schema.

codec : CodecSpec | None

Codec constraints specified by the schema.

fill_value : ArrayLike | None

Fill value specified by the schema.

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

Physical units of each dimension of the domain.

to_json(include_defaults: bool = False) Any

Converts to the JSON representation.

copy() Schema

Returns a copy of the schema.

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.

String representation

__repr__() str

Returns a string representation based on the JSON representation.

Indexing

__getitem__(transform: IndexTransform) Schema

Transforms the schema using an explicit index transform.

__getitem__(domain: IndexDomain) Schema

Transforms the schema using an explicit index domain.

__getitem__(expr: DimExpression) Schema

Transforms the schema using a dimension expression.

__getitem__(indices: NumpyIndexingSpec) Schema

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

oindex[indices: NumpyIndexingSpec] Schema

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

vindex[indices: NumpyIndexingSpec] Schema

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

T : Schema

View with transposed domain (reversed dimension order).

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

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

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

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

translate_backward_by[offsets] Schema

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

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

Returns a new view with the dimension labels changed.

mark_bounds_implicit[implicit: bool | None | slice] Schema

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

transpose(axes: DimSelectionLike | None = None) Schema

Returns a view with a transposed domain.

Comparison operators

__eq__(other: Schema) bool

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