tensorstore.TensorStore.vindex.__setitem__(self, indices: NumpyIndexingSpec, source: TensorStore | ArrayLike)

Synchronously writes using NumPy-style indexing with vectorized indexing semantics.

This is similar to __setitem__(indices), but differs in that if indices specifies any array indexing terms, the broadcasted array dimensions are unconditionally added as the first dimensions of the domain to be aligned to source:

>>> dataset = ts.open({
...     'driver': 'zarr',
...     'kvstore': {
...         'driver': 'memory'
...     }
... },
...                   dtype=ts.uint32,
...                   shape=[2, 70, 80],
...                   create=True).result()
>>> dataset.vindex[:, [5, 6, 8], [2, 5, 6]] = [[1, 2], [3, 4], [5, 6]]
>>> dataset[:, 5:10, 0:6].read().result()
array([[[0, 0, 1, 0, 0, 0],
        [0, 0, 0, 0, 0, 3],
        [0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0]],

       [[0, 0, 2, 0, 0, 0],
        [0, 0, 0, 0, 0, 4],
        [0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0]]], dtype=uint32)
Parameters:
indices: NumpyIndexingSpec

NumPy-style indexing terms.

source: TensorStore | ArrayLike

Source array, broadcast-compatible with self.vindex[indices].domain and with a data type convertible to self.dtype. May be an existing TensorStore or any ArrayLike, 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.