NDVar.sub(self, *args, **kwargs)

Retrieve a slice through the NDVar.

Return a new NDVar with a slice of the current NDVar’s data. The slice is specified using arguments and keyword arguments.

Indexes for dimensions can be either specified as arguments in the order of the data axes, or with dimension names as keywords; for:

>>> x = datasets.get_uts(True)['utsnd']
>>> x
<NDVar 'utsnd': 60 case, 5 sensor, 100 time>
>>> x.sub(time=0.1)
<NDVar 'utsnd': 60 case, 5 sensor>

x.sub(time=0.1) is equivalent to x.sub((), (), 0.1) and x[:, :, 0.1].

Tuples are reserved for slicing and are treated like slice objects. Use lists for indexing arbitrary sequences of elements.

The name of the new NDVar can be set with a name keyword (x.sub(time=0.1, name="new_name")). The default is the name of the current NDVar.