xarray_sel
- PlasmaCalcs.tools.xarray_tools.xarray_indexing.xarray_sel(array, indexers=None, *, promote_dims_if_needed=True, method=None, tolerance=None, drop=False, **indexers_as_kwargs)
array.sel(…) but prioritize general applicability over efficiency:
- promote non-dimension coordinate dims first if applicable- (if coord.dtype is object) check coord equality,e.g. 0==Fluid(‘e’, 0)==’e’, so could use Fluid(‘e’, 0), ‘e’, or 0 in sel.- can also use list, tuple, or 1D non-string iterable,e.g. [‘e’, 3, ‘Fe+’] to get multiple fluids.- can also use slice,e.g. slice(‘e’, ‘Fe+’, 2) to get every other fluid,starting from ‘e’, stopping before the first ‘Fe+’ match.- if indexer has ‘iseler’ attr, use indexer.iseler(values) to determine indexes.Assumes all indexing is for 1D dims. For indexing 2D+ dims, use xarray methods directly.- promote_dims_if_needed: bool
- whether to promote non-dimension coords to dimensions.if False, raise DimensionKeyError if any relevant coord is not already a dimension.
- method: None or str
- method to use for inexact matches, for non-object dtype coords.
xarray.DataArray.sel docs copied below:—————————————-str(object=’’) -> strstr(bytes_or_buffer[, encoding[, errors]]) -> strCreate a new string object from the given object. If encoding orerrors is specified, then the object must expose a data bufferthat will be decoded using the given encoding and error handler.Otherwise, returns the result of object.__str__() (if defined)or repr(object).encoding defaults to sys.getdefaultencoding().errors defaults to ‘strict’.