xarray.Index.sel#

Index.sel(labels)[source]#

Query the index with arbitrary coordinate label indexers.

Implementation is optional but required in order to support label-based selection. Otherwise it will raise an error when trying to call Dataset.sel() with labels for this index coordinates.

Coordinate label indexers can be of many kinds, e.g., scalar, list, tuple, array-like, slice, Variable, DataArray, etc. It is the responsibility of the index to handle those indexers properly.

Parameters:

labels (dict) – A dictionary of coordinate label indexers passed from Dataset.sel() and where the entries have been filtered for the current index.

Returns:

sel_results (IndexSelResult) – An index query result object that contains dimension positional indexers. It may also contain new indexes, coordinate variables, etc.