- tensorstore.TensorStore.oindex.__setitem__(self, indices: NumpyIndexingSpec, source: TensorStore | ArrayLike)
Synchronously writes using NumPy-style indexing with outer indexing semantics.
This is similar to
__setitem__(indices)
, but differs in that any integer or boolean array indexing terms are applied orthogonally:>>> dataset = ts.open({ ... 'driver': 'zarr', ... 'kvstore': { ... 'driver': 'memory' ... } ... }, ... dtype=ts.uint32, ... shape=[70, 80], ... create=True).result() >>> dataset.oindex[[5, 6, 8], [2, 5]] = [1, 2] >>> dataset[5:10, 0:6].read().result() array([[0, 0, 1, 0, 0, 2], [0, 0, 1, 0, 0, 2], [0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 2], [0, 0, 0, 0, 0, 0]], dtype=uint32)
- Parameters:¶
- indices: NumpyIndexingSpec¶
NumPy-style indexing terms.
- source: TensorStore | ArrayLike¶
Source array, broadcast-compatible with
self.oindex[indices].domain
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.