tensorstore.TensorStore.resize(self, inclusive_min: Sequence[int | None] | None = None, exclusive_max: Sequence[int | None] | None = None, resize_metadata_only: bool = False, resize_tied_bounds: bool = False, expand_only: bool = False, shrink_only: bool = False) Future[TensorStore]

Resizes the current domain, persistently modifying the stored representation.

Depending on the :py:param`resize_metadata_only`, if the bounds are shrunk, existing elements outside of the new bounds may be deleted. If the bounds are expanded, elements outside the existing bounds will initially contain either the fill value, or existing out-of-bounds data remaining after a prior resize operation.

Example

>>> dataset = await ts.open(
...     {
...         'driver': 'zarr',
...         'kvstore': {
...             'driver': 'memory'
...         }
...     },
...     dtype=ts.uint32,
...     shape=[3, 3],
...     create=True)
>>> await dataset.write(np.arange(9, dtype=np.uint32).reshape((3, 3)))
>>> dataset = await dataset.resize(exclusive_max=(3, 2))
>>> await dataset.read()
array([[0, 1],
       [3, 4],
       [6, 7]], dtype=uint32)
Parameters:
inclusive_min: Sequence[int | None] | None = None

Sequence of length self.rank() specifying the new inclusive min bounds. A bound of None indicates no change.

exclusive_max: Sequence[int | None] | None = None

Sequence of length self.rank() specifying the new exclusive max bounds. A bound of None indicates no change.

resize_metadata_only: bool = False

Requests that, if applicable, the resize operation affect only the metadata but not delete data chunks that are outside of the new bounds.

resize_tied_bounds: bool = False

Requests that the resize be permitted even if other bounds tied to the specified bounds must also be resized. This option should be used with caution.

expand_only: bool = False

Fail if any bounds would be reduced.

shrink_only: bool = False

Fail if any bounds would be increased.

Returns:

Future that resolves to a copy of self with the updated bounds, once the resize operation completes.