PlasmaCalcs.tools.xarray_tools.xarray_indexing.xarray_where
- PlasmaCalcs.tools.xarray_tools.xarray_indexing.xarray_where(array, cond, other=UNSET, *, drop=False, skip_if_no_matching_dims=True)
- like xarray’s builtin where, but return array unchanged if it has no dims matching cond.
- array: xarray.DataArray or xarray.Dataset
- array to apply condition to.
- cond: xarray.DataArray, xarray.Dataset, or callable
- Locations at which to preserve array’s values. Must have dtype=bool.callable –> replace with cond(array).
- other: UNSET, scalar, DataArray, Dataset, or callable, optional
- Value to use for locations in array where cond is False.By default, these locations are filled with NA.callable –> replace with other(array).UNSET –> do not pass this arg to xarray.where()
- drop: bool, default: False
- If True, coordinate labels that only correspond to False values ofthe condition are dropped from the result.
- skip_if_no_matching_dims: bool, default: True
- If True, return array unchanged if it has no dims matching cond.if Dataset, keep data_vars unchanged if they have no dims matching cond.If False, return array.where(cond, other=other, drop=drop) directly.