linopy.expressions.LinearExpression.where#
- LinearExpression.where(cond, other=<NA>, **kwargs)#
Filter variables based on a condition.
This operation call
xarray.Dataset.where
but sets the default fill value to -1 for variables and ensures preserving the linopy.LinearExpression 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.**kwargs – Keyword arguments passed to
xarray.Dataset.where
- Returns:
linopy.LinearExpression