xdas.DataArray.sel#

DataArray.sel(indexers=None, method=None, endpoint=True, drop=False, **indexers_kwargs)[source]#

Return a new DataArray selecting index labels along the specified dimension(s).

In contrast to DataArray.isel, indexers for this method should use labels instead of integers.

Parameters:
  • indexers (dict, optional) – A dict with keys matching dimensions and values given by scalars, slices or arrays of tick labels.

  • method (str, optional) – Method to use for inexact matches. None (default) means only exact matches. “nearest” finds the nearest index value.

  • endpoint (bool, optional) – Whether to include the endpoint of a slice. Default is True.

  • drop (bool, optional) – If drop=True, drop coordinates variables in indexers instead of making them scalar.

  • **indexers_kwargs (dict, optional) – The keyword arguments form of integers. Overwrite indexers input if both are provided.

Returns:

The selected part of the original data array.

Return type:

DataArray