Isel

class of dascore.proc.coords
inherits from: PatchProcessor, DascoreBaseModel, pydantic.main.BaseModel
source

Isel(
    *args ,
    indexers: Any = None,
    drop: bool = False,
    missing_dims: str = raise,
    **kwargs ,
)-> None

Select sample positions with xarray-compatible dimension indexing.

Supports the DataArray.isel operations described below. Use Patch.select for DASCore’s tuple range notation, relative selections, and filtering that preserves dimensions and source order.

Parameters

Parameter Description
indexers Mapping of dimension names to integer positions, slices, or 1D integer
arrays or boolean masks. Supply this or keyword indexers.
drop Drop coordinates made scalar by indexing. By default they are retained
as scalar coordinates. Scalar indexers remove their dimension either way;
use a one-element list to retain a length-one dimension.
missing_dims How to handle absent dimensions: "raise", "warn", or "ignore".
**indexers_kwargs Dimension indexers supplied as keywords.
Note

Slices use Python’s exclusive stop and support strides and negative indices. Evenly sampled slice results stay compact; floating coordinate values can differ from xarray by rounding relative to the original range, as with select. Arrays preserve order and repetitions; arrays on multiple dimensions select every combination of positions. Out-of-bounds scalar and array indices raise. Labelled xarray indexers and multidimensional indexer arrays are not supported.

Examples

import dascore as dc
patch = dc.get_example_patch()
window = patch.isel(time=slice(0, 100, 2), distance=[3, 1, 3])
assert window.shape == (3, 50)
channel = patch.isel(distance=3)
assert channel.dims == ("time",)
assert channel.get_array("distance").shape == ()

See Also

Patch.sel : Xarray-compatible label indexing. Patch.select : Range filtering and relative selections.

Methods

Name Description
check Refuse a patch which does not carry what the operation needs.
get_metadata Return the indexed coordinates and the indexers behind them.
kernel Return the samples at the requested positions.
new Create new instance with some attributed updated.
isel Select sample positions with xarray-compatible dimension indexing.
reconcile Return the result’s metadata once the data are known; default as is.
run Run the operation: check, get_metadata, kernel, reconcile, record.