Collection of functions for characterizing life cycle inventories with temporal information
Project description
dynamic_characterization
This is a package for the dynamic characterization of Life Cycle Inventories with temporal information. It includes a collection of dynamic characterization functions for various environmental flows. We also provide a simple interface to apply these functions to an existing dynamic LCI (coming from, e.g., bw_temporalis or bw_timex).
The following dynamic characterization functions are currently included:
| module | impact category | metric | covered emissions | source |
|---|---|---|---|---|
| ipcc_ar6 | climate change | radiative forcing, GWP | 247 GHGs | radiative efficiencies & lifetimes from IPCC AR6 Ch.7 |
| prospective | climate change | prospective_radiative_forcing, pGWP, pGTP | CO2, CH4, N2O | prospective characterization factors from Barbosa Watanabe et al. (2026) |
| original_temporalis_functions | climate change | radiative forcing | CO2, CH4 | bw_temporalis |
What do dynamic characterization functions do?
The functions are meant to work with a common input format of the dynamic inventory, collected in a pandas DataFrame that looks like this:
| date | amount | flow | activity |
|---|---|---|---|
| 101 | 33 | 1 | 2 |
| 312 | 21 | 4 | 2 |
Each function takes one row of this dynamic inventory dataframe (i.e., one emission at one point in time) and transform it according to some metric. The output generated by applying a very simple function to both rows of the input dataframe could look like:
| date | amount | flow | activity |
|---|---|---|---|
| 101 | 33 | 1 | 2 |
| 102 | 31 | 1 | 2 |
| 103 | 31 | 1 | 2 |
| 312 | 21 | 4 | 2 |
| 313 | 20 | 4 | 2 |
| 314 | 19 | 4 | 2 |
How do I use this package?
The workflow could look like this:
import pandas as pd
from dynamic_characterization import characterize
from dynamic_characterization.ipcc_ar6 import characterize_co2, characterize_ch4
# defining a dummy dynamic inventory that you somehow got
dynamic_inventory_df = pd.DataFrame(
data={
"date": pd.Series(
data=[
"15-12-2020",
"20-12-2020",
"25-05-2022",
],
dtype="datetime64[s]",
),
"amount": pd.Series(data=[10.0, 20.0, 50.0], dtype="float64"),
"flow": pd.Series(data=[1, 1, 3], dtype="int"),
"activity": pd.Series(data=[2, 2, 4], dtype="int"),
}
)
df_characterized = characterize(
dynamic_inventory_df,
metric="radiative_forcing", # could also be GWP
characterization_functions={
1: characterize_co2,
3: characterize_ch4,
},
time_horizon=2,
)
If you use this package with Brightway, stuff can get even easier: if you have an impact assessment method at hand, you can pass it to the characterize function via the base_lcia_method attribute and we'll try to automatically match the flows that are characterized in that method to the flows we have characterization functions for. This matching is based on the names or the CAS numbers, depending on the flow. The function call could look like this then:
method = ('EF v3.1', 'climate change', 'global warming potential (GWP100)')
df_characterized = characterize(
dynamic_inventory_df,
metric="radiative_forcing", # could also be GWP
base_lcia_method=method,
time_horizon=2,
)
Prospective Characterization
The prospective module provides prospective characterization factors based on Barbosa Watanabe et al. (2026). These factors account for how radiative efficiencies change over time under different climate scenarios, making them more appropriate for future-oriented LCA studies.
For an interactive demo of pLCIA, open the example notebook on Binder
Setting up a scenario
Before using prospective metrics, you must set a background scenario:
import dynamic_characterization.prospective as prospective
# Set the scenario (required before using pGWP or pGTP)
prospective.set_scenario(iam="IMAGE", ssp="SSP1", rcp="2.6")
Available scenario combinations:
- IAMs: IMAGE, AIM, GCAM4, MESSAGE, REMIND
- SSPs: SSP1-SSP5 (availability depends on IAM)
- RCPs: 2.6, 4.5, 6.0, 8.5
Using prospective metrics
from dynamic_characterization import characterize
# Using prospective radiative forcing (W/m² time series)
df_prf = characterize(
dynamic_inventory_df,
metric="prospective_radiative_forcing",
base_lcia_method=method,
time_horizon=100,
)
# Using prospective GWP (kg CO2eq)
df_pgwp = characterize(
dynamic_inventory_df,
metric="pGWP",
base_lcia_method=method,
time_horizon=100,
)
# Using prospective GTP (kg CO2eq)
df_pgtp = characterize(
dynamic_inventory_df,
metric="pGTP",
base_lcia_method=method,
time_horizon=100,
)
Fallback to IPCC for unsupported GHGs
The Watanabe module only provides prospective characterization for CO2, CH4, and N2O. By default, other GHGs (like CO and the 244 other GHGs from IPCC AR6) fall back to standard IPCC characterization:
# Default: use IPCC for GHGs not in Watanabe (fallback_to_ipcc=True)
df_prf = characterize(
dynamic_inventory_df,
metric="prospective_radiative_forcing",
base_lcia_method=method,
fallback_to_ipcc=True, # default
)
# Strict mode: only characterize CO2, CH4, N2O
df_prf_strict = characterize(
dynamic_inventory_df,
metric="prospective_radiative_forcing",
base_lcia_method=method,
fallback_to_ipcc=False, # skip GHGs not in Watanabe
)
Time-varying radiative efficiency
By default, the radiative efficiency (RE) is fixed at the emission year (IPCC standard approach). You can enable time-varying RE for more physical accuracy:
df_pgwp = characterize(
dynamic_inventory_df,
metric="pGWP",
base_lcia_method=method,
time_varying_re=True, # RE evolves as gas decays
)
What do dynamic characterization functions look like?
Here's an example of what such a function could look like:
def example_characterization_function(series: namedtuple, period: int = 2) -> namedtuple:
date_beginning: np.datetime64 = series.date.to_numpy()
dates_characterized: np.ndarray = date_beginning + np.arange(
start=0, stop=period, dtype="timedelta64[D]"
).astype("timedelta64[s]")
amount_beginning: float = series.amount
# in reality, this would probably something more complex like an exponential decay function
amount_characterized: np.ndarray = amount_beginning - np.arange(
start=0, stop=period, dtype="int"
)
return namedtuple("CharacterizedRow", ["date", "amount", "flow", "activity"])(
date=np.array(dates_characterized, dtype="datetime64[s]"),
amount=amount_characterized,
flow=series.flow,
activity=series.activity,
)
Installation
You can install dynamic_characterization via [pip] from [PyPI]:
$ pip install dynamic_characterization
Alternatively, you can also use conda:
$ conda install -c diepers dynamic_characterization
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the BSD 3 Clause license, dynamic_characterization is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Support
If you have any questions or need help, do not hesitate to contact Timo Diepers (timo.diepers@ltt.rwth-aachen.de)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dynamic_characterization-1.3.0.tar.gz.
File metadata
- Download URL: dynamic_characterization-1.3.0.tar.gz
- Upload date:
- Size: 964.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bd9da3ee3ae3a8e9c57fbc84325babbe021570bae2210da2bcda9c77b38cfe0
|
|
| MD5 |
4c40a61d9fe7f69dfc57e83bee1a9faa
|
|
| BLAKE2b-256 |
9fe647a28dfc1935f356c887475bf8ba4dea98b9f57afa3a49da957cffdaf89e
|
File details
Details for the file dynamic_characterization-1.3.0-py3-none-any.whl.
File metadata
- Download URL: dynamic_characterization-1.3.0-py3-none-any.whl
- Upload date:
- Size: 962.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b55f8184dd19e4e383803f45ba6689e1f15cc9fa6aabe229081f4d0f2b37104e
|
|
| MD5 |
66ca31b5d2d860859e73110bca56f22b
|
|
| BLAKE2b-256 |
274e49d7d116d2e6ba7f8540017fc912660c4e11c8d9a5ca20b2b5660a568ed9
|