linopy.variables.Variable.where#
- Variable.where(cond, other=-1, **kwargs)#
Filter variables based on a condition.
This operation call
xarray.DataArray.where
but sets the default fill value to -1 and ensures preserving the linopy.Variable type.- Parameters:
cond (
DataArray
orcallable
) – 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 wherecond
is False. By default, these locations filled with -1.**kwargs – Keyword arguments passed to
xarray.DataArray.where
- Returns:
linopy.Variable