- tensorstore.TensorStore.__setitem__(self, transform: IndexDomain, source: TensorStore | ArrayLike) None
Synchronously writes using an explicit index domain.
Example
>>> dataset = ts.open({ ... 'driver': 'n5', ... 'kvstore': { ... 'driver': 'memory' ... } ... }, ... dtype=ts.uint32, ... domain=ts.IndexDomain(shape=[60, 70, 80], ... labels=['x', 'y', 'z']), ... create=True).result() >>> domain = ts.IndexDomain(labels=['x', 'z'], ... inclusive_min=[5, 6], ... exclusive_max=[8, 9]) >>> dataset[domain] = 42 >>> dataset[5:10, 0, 5:10].read().result() array([[ 0, 42, 42, 42, 0], [ 0, 42, 42, 42, 0], [ 0, 42, 42, 42, 0], [ 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0]], dtype=uint32)
- Parameters:¶
- transform: IndexDomain¶
Index transform,
transform.output_rank
must equalself.rank
.- source: TensorStore | ArrayLike¶
Source array, broadcast-compatible with
self.domain[transform]
and with a data type convertible toself.dtype
. May be an existingTensorStore
or anyArrayLike
, including a scalar.
Warning
When not using a transaction, the subscript assignment syntax always blocks synchronously on the completion of the write operation. When performing multiple, fine-grained writes, it is recommended to either use a transaction or use the asynchronous
TensorStore.write
interface directly.