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, 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.

From xarray 2026.9 a lazy array combines with one whose index is materialized when the labels are equal; arithmetic keeps the left operand’s index, and the comparison reads every lazy label. Labels that differ, or reindexing to new labels, raise xarray’s AlignmentError, as every such mix did on earlier versions. Convert with lazy_coords=False to avoid the error.

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.