tensorstore.TensorStore.__setitem__(self, transform: DimExpression, source: TensorStore | ArrayLike) None

Synchronously writes using a dimension expression.

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()
>>> dataset[ts.d['x', 'z'][5:10, 6:9]] = [1, 2, 3]
>>> dataset[5:10, 0, 5:10].read().result()
array([[0, 1, 2, 3, 0],
       [0, 1, 2, 3, 0],
       [0, 1, 2, 3, 0],
       [0, 1, 2, 3, 0],
       [0, 1, 2, 3, 0]], dtype=uint32)

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.