xarray.Dataset.sel_points

Dataset.sel_points(dim='points', method=None, tolerance=None, **indexers)

Returns a new dataset with each array indexed pointwise by tick labels along the specified dimension(s).

In contrast to Dataset.isel_points, indexers for this method should use labels instead of integers.

In contrast to Dataset.sel, this method selects points along the diagonal of multi-dimensional arrays, not the intersection.

Parameters:

dim : str or DataArray or pandas.Index or other list-like object, optional

Name of the dimension to concatenate along. If dim is provided as a string, it must be a new dimension name, in which case it is added along axis=0. If dim is provided as a DataArray or Index or list-like object, its name, which must not be present in the dataset, is used as the dimension to concatenate along and the values are added as a coordinate.

method : {None, ‘nearest’, ‘pad’/’ffill’, ‘backfill’/’bfill’}, optional

Method to use for inexact matches (requires pandas>=0.16):

  • None (default): only exact matches
  • pad / ffill: propagate last valid index value forward
  • backfill / bfill: propagate next valid index value backward
  • nearest: use nearest valid index value

tolerance : optional

Maximum distance between original and new labels for inexact matches. The values of the index at the matching locations most satisfy the equation abs(index[indexer] - target) <= tolerance. Requires pandas>=0.17.

**indexers : {dim: indexer, ...}

Keyword arguments with names matching dimensions and values given by array-like objects. All indexers must be the same length and 1 dimensional.

Returns:

obj : Dataset

A new Dataset with the same contents as this dataset, except each array and dimension is indexed by the appropriate indexers. With pointwise indexing, the new Dataset will always be a copy of the original.