linopy.variables.Variable.where#
- Variable.where(cond, other=None, **kwargs)#
Filter variables based on a condition.
This operation call
xarray.DataArray.wherebut sets the default fill value to -1 and ensures preserving the linopy.Variable type.- Parameters:
cond (
DataArrayorcallable) – Locations at which to preserve this object’s values. dtype must be bool. If a callable, it must expect this object as its only parameter.other (
scalar,DataArray,Variable, optional) – Value to use for locations in this object wherecondis False. By default, these locations filled with -1.**kwargs – Keyword arguments passed to
xarray.DataArray.where
- Returns:
linopy.Variable