CoordIndex

class of dascore.xarray.index
inherits from: xarray.core.indexes.CoordinateTransformIndex, xarray.core.indexes.Index
source

CoordIndex(
    transform: CoordTransform ,
)

An xarray index serving a DASCore coordinate’s labels.

Selection answers as Patch.sel answers, which is as a materialized pandas index answers: partial datetime strings name their periods, slices include both endpoints, and method and tolerance work as pandas has them. A slice isel or a concatenation whose parts chain returns a new lazy index; fancy indexing, an empty slice, a slice whose labels a coordinate would recompute (a float range, or a stride over segments), or a concatenation which reorders or overlaps holds just the labels concerned, still as a CoordIndex, so arrays derived from one another align. Aligning with a CoordIndex whose labels differ materializes both, costing what aligning materialized indexes costs.

xarray matches an index only with indexes of its own type: combining a lazy array with one whose index is materialized, or reindexing it to new labels, raises xarray’s AlignmentError even where the labels agree. Convert with lazy_coords=False for those.

Methods

Name Description
concat Concatenate indexes, staying lazy when their coordinates chain.
isel A slice keeps a lazy index where its labels stay exact; else materialize.
join Join as materialized indexes join.
reindex_like Reindex as a materialized index reindexes.
sel Resolve label selection as Patch.sel does.
from_coord Serve a range or segmented DASCore coordinate as name.
to_pandas_index The materialized pandas form, computed on demand.