tensorstore.TensorStore.__getitem__(self, indices: NumpyIndexingSpec) TensorStore

Computes a virtual view using NumPy-style indexing with default index array semantics.

This operation does not actually read any data; it merely returns a virtual view that reflects the result of the indexing operation. To read data, call read on the returned view.

Example

>>> dataset = await ts.open(
...     {
...         'driver': 'zarr',
...         'kvstore': {
...             'driver': 'memory'
...         }
...     },
...     dtype=ts.uint32,
...     shape=[70, 80],
...     create=True)
>>> view = dataset[[5, 10, 20], 6:10]
>>> view
TensorStore({
  'context': {
    'cache_pool': {},
    'data_copy_concurrency': {},
    'memory_key_value_store': {},
  },
  'driver': 'zarr',
  'dtype': 'uint32',
  'kvstore': {'driver': 'memory'},
  'metadata': {
    'chunks': [70, 80],
    'compressor': {
      'blocksize': 0,
      'clevel': 5,
      'cname': 'lz4',
      'id': 'blosc',
      'shuffle': -1,
    },
    'dimension_separator': '.',
    'dtype': '<u4',
    'fill_value': None,
    'filters': None,
    'order': 'C',
    'shape': [70, 80],
    'zarr_format': 2,
  },
  'transform': {
    'input_exclusive_max': [3, 10],
    'input_inclusive_min': [0, 6],
    'output': [{'index_array': [[5], [10], [20]]}, {'input_dimension': 1}],
  },
})