linopy.expressions.merge

Contents

linopy.expressions.merge#

linopy.expressions.merge(*exprs, dim='_term', cls=<class 'linopy.expressions.LinearExpression'>, **kwargs)#

Merge multiple expression together.

This function is a bit faster than summing over multiple linear expressions. In case a list of LinearExpression with exactly the same shape is passed and the dimension to concatenate on is TERM_DIM, the concatenation uses the coordinates of the first object as a basis which overrides the coordinates of the consecutive objects.

Parameters:
  • *exprs (tuple/list) – List of linear expressions to merge.

  • dim (str) – Dimension along which the expressions should be concatenated.

  • cls (type) – Type of the resulting expression.

  • **kwargs – Additional keyword arguments passed to xarray.concat. Defaults to {coords: “minimal”, compat: “override”} or, in the special case described above, to {coords: “minimal”, compat: “override”, “join”: “override”}.

Returns:

res (linopy.LinearExpression)