LCA Processor¶
Time-explicit LCA data processing for optimization.
This module provides classes and utilities for performing time-explicit Life Cycle Assessment (LCA) computations using Brightway. It processes temporal distributions of product demands, constructs foreground and background inventory tensors, and prepares characterization factors for optimization.
Key Classes¶
LCAConfig: Configuration dataclass for LCA computationsLCADataProcessor: Main class for time-explicit LCA processing
Module Reference¶
Time-explicit LCA data processing for optimization.
This module provides classes and utilities for performing time-explicit Life Cycle Assessment (LCA) computations using Brightway. It processes temporal distributions of product demands, constructs foreground and background inventory tensors, and prepares characterization factors for optimization.
Key classes: - LCAConfig: Configuration for LCA computations - LCADataProcessor: Main class for time-explicit LCA processing
Classes¶
MetricEnum
¶
Bases: str, Enum
Supported metrics for dynamic impact characterization.
Attributes: GWP: Global Warming Potential - time-dependent radiative forcing metric CRF: Cumulative Radiative Forcing - integrated radiative forcing over time horizon
TemporalResolutionEnum
¶
Bases: str, Enum
Supported temporal resolutions for the optimization model.
Attributes: year: Annual time steps (currently the only supported resolution)
CharacterizationMethodConfig
¶
Bases: BaseModel
Configuration for a single LCIA characterization method.
Attributes: category_name: User-defined identifier for the impact category (e.g., 'climate_change_dynamic_gwp'). brightway_method: Brightway method identifier tuple, either 2 or 3 elements (e.g., ('GWP', 'example') or ('IPCC', 'climate change', 'GWP 100a')). metric: Impact metric used for dynamic characterization. None implies static method. Supported values: 'GWP', 'CRF'.
TemporalConfig
¶
Bases: BaseModel
Configuration related to temporal aspects of the model.
Attributes:
start_date: The start date of the time horizon.
temporal_resolution: Temporal resolution for the model.
Options: 'year', 'month', 'day'.
time_horizon: Length of the time horizon (in units of temporal_resolution).
fixed_time_horizon: If True, the time horizon is calculated from the time of the functional
unit (FU) instead of the time of emission
database_dates: Mapping from database names to their respective reference dates.
BackgroundInventoryConfig
¶
Bases: BaseModel
Configuration for background inventory data.
Attributes: cutoff: Cutoff threshold for the number of top elementary flows to retain based on impact magnitude. calculation_method: Method for calculating the inventory tensor. Options: 'sequential', 'parallel'. path_to_save: Optional path to save the inventory tensor. path_to_load: Optional path to load the inventory tensor.
LCAConfig
¶
Bases: BaseModel
Configuration class for Life Cycle Assessment (LCA) data processing.
Attributes: demand: Dictionary {product_node: temporal_distribution} containing time-explicit demands for each product. Keys must be Brightway product node objects (bd.get_node(...)). temporal: Temporal configuration for model time behavior. characterization_methods: List of characterization method configurations. background_inventory: Configuration for background inventory data calculation. foreground_db_name: Name of the foreground Brightway database.
LCADataProcessor(config: LCAConfig, foreground_db_name: str = 'foreground')
¶
Class to perform time-explicit Life Cycle Assessment (LCA) computations and gather necessary data for building an optimization model.
This class is primarily responsible for executing the LCA-based computations
required to collect all the data needed for building OptimizationModelInputs. It is reliant on
Brightway2, an open-source framework for Life Cycle Assessment, to perform the
calculations and retrieve LCA results.
Initialize the LCADataProcessor with the LCA configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
LCAConfig
|
The configuration object containing all settings for demand, temporal parameters, characterization methods, and background inventory. |
required |
foreground_db_name
|
str
|
The name of the foreground Brightway database, by default "foreground". |
'foreground'
|
Source code in src/optimex/lca_processor.py
Attributes¶
processes: dict
property
¶
Read-only access to the processes dictionary.
intermediate_flows: dict
property
¶
Read-only access to the intermediate flows dictionary.
elementary_flows: dict
property
¶
Read-only access to the elementary flows dictionary.
reference_products: set
property
¶
Read-only access to the functional flows list.
system_time: set
property
¶
Read-only access to the system time list.
category: set
property
¶
Read-only access to the impact categories list.
process_time: set
property
¶
Read-only access to the process time list.
foreground_technosphere: dict
property
¶
Read-only access to the foreground technosphere tensor.
foreground_biosphere: dict
property
¶
Read-only access to the foreground biosphere tensor.
foreground_production: dict
property
¶
Read-only access to the foreground production tensor.
background_inventory: dict
property
¶
Read-only access to the inventory tensor.
mapping: dict
property
¶
Read-only access to the mapping matrix.
characterization: dict
property
¶
Read-only access to the characterization matrix.
demand: dict
property
¶
Read-only access to the parsed demand dictionary.
operation_flow: dict
property
¶
Read-only access to the operation flow dictionary.
operation_time_limits: dict
property
¶
Read-only access to the operation time limits dictionary.
products: dict
property
¶
Read-only access to the products dictionary.
internal_demand_technosphere: dict
property
¶
Read-only access to the internal demand technosphere tensor.
foreground_technosphere_vintages: Optional[dict]
property
¶
Read-only access to vintage-specific technosphere values.
foreground_biosphere_vintages: Optional[dict]
property
¶
Read-only access to vintage-specific biosphere values.
foreground_production_vintages: Optional[dict]
property
¶
Read-only access to vintage-specific production values.
vintage_improvements: Optional[dict]
property
¶
Read-only access to vintage improvement scaling factors.
reference_vintages: Optional[list]
property
¶
Read-only access to reference vintage years.
Functions¶
parallel_inventory_tensor_calculation(cutoff=10000.0, n_jobs=None) -> dict
¶
Not yet implemented. Could improve performance significantly by parallelizing