Impacts

Functions for computing environmental impacts.

Compute impacts

lca_algebraic.compute_impacts(models, methods, axis=None, functional_unit=1, return_params=False, description=None, **params)[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)

Compute inventory

lca_algebraic.compute_inventory(model: ActivityExtended, functional_unit=1, as_dict=False, impact_method=None, fields=['database', 'name', 'location', 'unit'], **params)[source]

This method computes the inventory of background activities for a given scenario / values of parameters.

Parameters

model:

Root activity

functional_unit:

Quantitity to divide the inventory. 1 by default

as_dict:

If true, returns a dict of act => value. If false (default) returns a dataframe

fields:

List of fields to be added in the ouput dataframe

impact_method:

If provided, return the impact for each activity, rather that its quantity

params:

All other attributes are treated as values of lca_algebraic parameters. If not specified, each parameters takes its default value.

Returns

Dataframe or Dict of act => value