select

method of dascore.core.coordmanager.CoordManager source

select(
    self ,
    array: ndarray | None = None,
    relative = False,
    samples = False,
    **kwargs ,
)-> ‘tuple[Self, MaybeArray]’

Perform selection on coordinates.

Any dimension name can be passed as key, and the values can be: - a tuple of (min, max) for that dimension, or an equivalent slice. None and … both indicate open intervals, as does an infinite bound pointing away from the data, eg (min, np.inf). - an integer, when samples=True, to select a single row or column. - an array of values to select, which must be a subset of the coordinate array. - an array of booleans of the same length as the coordinate where True indicates values to keep. This form does not support samples=True.

Parameters

Parameter Description
array An array to which the selection will be applied.
relative If True, coordinate updates are relative. Does nothing if values
passed are numpy arrays.
samples If True, the query meaning is in samples.
**kwargs Used to specify dimension and select arguments.

Examples

import dascore as dc
patch = dc.get_example_patch()
coords = patch.coords

# Select subset of coordinates
new_coords, _ = coords.select(time=(0, 10))
assert 'time' in new_coords