Impacts

Functions for computing environmental impacts.

lca_algebraic.compute_impacts(models, methods, axis=None, functional_unit: float | Expr = 1, return_params: bool = False, description: str | None = None, **params: Dict[str, float | List[float] | ndarray])[source]

Main parametric LCIA method : Computes LCA by expressing the foreground model as symbolic expression of background activities and parameters. Then, compute ‘static’ inventory of the referenced background activities. This enables a very fast recomputation of LCA with different parameters, useful for stochastic evaluation of parametrized model

Parameters

models :

Single model or List of model or List of (model, alpha) or Dict of model:amount In case of several models, you cannot use list of parameters

methods :

List of methods / impacts to consider

axis:

Designates the name of a custom attribute of foreground activities. You may set this attribute using the method myActivity.updateMeta(your_custom_attr=”some_value”)

The impacts will be ventilated by this attribute. This is useful to get impact by phase or sub-modules.

params:

Any other argument passed to this function is considered as a value of a parameter of the model : Values can be either single float values, list or ndarray of values. In the later case, all parameters should have the same number of values. Paremeters that are not provided will have their default value set.

functional_unit:

Quantity (static or Sympy formula) by which to divide impacts. Optional, 1 by default.

return_params:

If true, also returns the value of all parameters in as tabbed DataFrame

description:

Optional description/metadata to be added in output when using “return params” Dataframe

Returns

A dataframe with the results. If return_params is true, it returns TabbedDataframe, including all parameters values, that can be saved as a multi sheet excel file.

Examples

>>> compute_impacts(
>>>    mainAct1, # The root activity of the foreground model
>>>    [climate_change], # climate_change is the key (tuple) of the impact method
>>>    functional_unit=energy_expression, # energy expression is a Sympy expression computing the energy in kWh
>>>    axis="phase", # Split results by phase
>>>    return_params=True, # Return all parameter values
>>>
>>>    # Parameter values
>>>    p1=2.0,
>>>    p2=3.0)