tensorstore.Spec.__getitem__(self, transform: IndexTransform) Spec

Transforms the spec using an explicit index transform.

This composes self.transform with transform.

Example

>>> spec = ts.Spec({
...     'driver': 'zarr',
...     'kvstore': {
...         'driver': 'memory'
...     },
...     'transform': {
...         'input_shape': [[70], [80]],
...     }
... })
>>> transform = ts.IndexTransform(
...     input_shape=[3],
...     output=[
...         ts.OutputIndexMap(index_array=[1, 2, 3]),
...         ts.OutputIndexMap(index_array=[5, 4, 3])
...     ])
>>> spec[transform]
Spec({
  'driver': 'zarr',
  'kvstore': {'driver': 'memory'},
  'transform': {
    'input_exclusive_max': [3],
    'input_inclusive_min': [0],
    'output': [{'index_array': [1, 2, 3]}, {'index_array': [5, 4, 3]}],
  },
})
Parameters:
transform: IndexTransform

Index transform, transform.output_rank must equal self.rank.

Returns:

New spec of rank transform.input_rank and transform self.transform[transform].

Raises:

ValueError – If self.transform is None.