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 callableLocations at which to preserve array’s values. Must have dtype=bool.callable –> replace with cond(array).other: UNSET, scalar, DataArray, Dataset, or callable, optionalValue 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: FalseIf True, coordinate labels that only correspond to False values ofthe condition are dropped from the result.skip_if_no_matching_dims: bool, default: TrueIf 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.