bw2calc.multi_lca
#
Module Contents#
Classes#
Perform LCA on multiple demands, impact categories, and normalization and weighting sets. |
|
Container for storing and interpreting MultiLCA results. |
Attributes#
- class bw2calc.multi_lca.MultiLCA(demands: dict[str, dict[int, float]], method_config: dict, data_objs: Iterable[pathlib.Path | fs.base.FS | bw_processing.DatapackageBase], remapping_dicts: Iterable[dict] | None = None, log_config: dict | None = None, seed_override: int | None = None, use_arrays: bool | None = False, use_distributions: bool | None = False, selective_use: dict | None = None)[source]#
Bases:
bw2calc.lca.LCABase
Perform LCA on multiple demands, impact categories, and normalization and weighting sets.
Builds only one technosphere and biosphere matrix which can cover all demands.
Main differences from the base LCA class:
Many attributes are plural, such as supply_arrays, inventories, characterization_matrices`
demands must be a dictionary with str keys, e.g. {‘my truck’: {12345: 1}}
demands must have integer IDs; you can’t pass (‘database’, ‘code’) or Activity objects.
Calculation results are a dictionary with keys of functional units and impact categories
The calculation procedure is the same as for singular LCA: lci(), lcia(), and next(). See the LCA documentation for these methods and their input arguments.
Parameters#
- demandsdict[str, dict[int, float]]
The demands for which the LCA will be calculated. The keys identify functional unit sets.
- method_configdict
Dictionary satisfying the MethodConfig specification.
- data_objslist[bw_processing.Datapackage]
List of bw_processing.Datapackage objects. Should include data for all needed matrices.
- remapping_dictsdict[str, dict]
Dict of remapping dictionaries that link Brightway Node ids to (database, code) tuples. remapping_dicts can provide such remapping for any of activity, product, biosphere.
- log_configdict
Optional arguments to pass to logging. Not yet implemented.
- seed_overrideint
RNG seed to use in place of Datapackage seed, if any.
- use_arraysbool
Use arrays instead of vectors from the given data_objs
- use_distributionsbool
Use probability distributions from the given data_objs
- selective_usedict[str, dict]
Dictionary that gives more control on whether use_arrays or use_distributions should be used. Has the form {matrix_label: {“use_arrays”|”use_distributions”: bool}. Standard matrix labels are technosphere_matrix, biosphere_matrix, and characterization_matrix.
- property scores: dict[source]#
The LCIA score as a
float
.Note that this is a property, so it is
foo.lca
, notfoo.score()
- matrix_list_labels = ['characterization_mm_dict', 'normalization_mm_dict', 'weighting_mm_dict'][source]#
- build_demand_array(demands: dict | None = None) None [source]#
Turn the demand dictionary into a NumPy array of correct size.
- Args:
demand (dict, optional): Demand dictionary. Optional, defaults to
self.demand
.
- Returns:
A 1-dimensional NumPy array
- filter_package_by_identifier(data_objs: Iterable[bw_processing.DatapackageBase], identifier: list[str]) list[bw_processing.DatapackageBase] [source]#
Filter the datapackage resources in data_objs whose “identifier” attribute equals input argument identifier.
Used in splitting up impact categories, normalization, and weighting matrices.
- lci_calculation() None [source]#
The actual LCI calculation.
Separated from
lci
to be reusable in cases where the matrices are already built, e.g.redo_lci
and Monte Carlo classes.
- lcia_calculation() None [source]#
The actual LCIA calculation.
Separated from
lcia
to be reusable in cases where the matrices are already built, e.g.redo_lcia
and Monte Carlo classes.
- load_lcia_data(data_objs: Iterable[bw_processing.DatapackageBase] | None = None) None [source]#
Load data and create characterization matrices.
This method will filter out regionalized characterization factors.
- load_normalization_data(data_objs: Iterable[bw_processing.DatapackageBase] | None = None) None [source]#
Load normalization data.