dynamic-characterization 1.4.1__tar.gz → 1.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/LICENSE +2 -0
- dynamic_characterization-1.4.3/PKG-INFO +121 -0
- dynamic_characterization-1.4.3/README.md +79 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/__init__.py +1 -1
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/dynamic_characterization.py +39 -18
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/__init__.py +4 -2
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/agtp.py +3 -3
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/agwp.py +6 -5
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/config.py +20 -3
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/radiative_forcing.py +13 -6
- dynamic_characterization-1.4.3/dynamic_characterization.egg-info/PKG-INFO +121 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization.egg-info/SOURCES.txt +1 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/pyproject.toml +1 -0
- dynamic_characterization-1.4.3/tests/test_characterize_prospective_fallback.py +68 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/tests/test_prospective.py +66 -0
- dynamic_characterization-1.4.1/PKG-INFO +0 -284
- dynamic_characterization-1.4.1/README.md +0 -243
- dynamic_characterization-1.4.1/dynamic_characterization.egg-info/PKG-INFO +0 -284
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/MANIFEST.in +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/classes.py +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/ipcc_ar6/__init__.py +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/ipcc_ar6/data/decay_multipliers.json +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/ipcc_ar6/data/hodnebrog20.csv +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/ipcc_ar6/radiative_forcing.py +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/original_temporalis_functions/__init__.py +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/original_temporalis_functions/radiative_forcing.py +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_001.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_002.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_003.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_004.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_009.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_010.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_011.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_012.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_013.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_014.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_015.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_016.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_017.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_018.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_019.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_020.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_021.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_022.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_023.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_024.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_025.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data/es5c12391_si_026.xlsx +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization/prospective/data_loader.py +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization.egg-info/dependency_links.txt +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization.egg-info/requires.txt +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/dynamic_characterization.egg-info/top_level.txt +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/setup.cfg +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/tests/test_characterize_dynamic_inventory.py +0 -0
- {dynamic_characterization-1.4.1 → dynamic_characterization-1.4.3}/tests/test_default_characterization_functions.py +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dynamic_characterization
|
|
3
|
+
Version: 1.4.3
|
|
4
|
+
Summary: Collection of functions for characterizing life cycle inventories with temporal information
|
|
5
|
+
Author-email: Timo Diepers <timo.diepers@ltt.rwth-aachen.de>
|
|
6
|
+
Maintainer-email: Timo Diepers <timo.diepers@ltt.rwth-aachen.de>
|
|
7
|
+
Project-URL: source, https://github.com/brightway-lca/dynamic_characterization
|
|
8
|
+
Project-URL: homepage, https://github.com/brightway-lca/dynamic_characterization
|
|
9
|
+
Project-URL: tracker, https://github.com/brightway-lca/dynamic_characterization/issues
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
17
|
+
Classifier: Natural Language :: English
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: pandas
|
|
24
|
+
Requires-Dist: numpy
|
|
25
|
+
Requires-Dist: bw2data
|
|
26
|
+
Requires-Dist: loguru
|
|
27
|
+
Requires-Dist: matplotlib>=3.9.4
|
|
28
|
+
Requires-Dist: openpyxl>=3.1.5
|
|
29
|
+
Provides-Extra: testing
|
|
30
|
+
Requires-Dist: pytest; extra == "testing"
|
|
31
|
+
Requires-Dist: pytest-cov; extra == "testing"
|
|
32
|
+
Requires-Dist: python-coveralls; extra == "testing"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: build; extra == "dev"
|
|
35
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
36
|
+
Requires-Dist: pylint; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-randomly; extra == "dev"
|
|
40
|
+
Requires-Dist: setuptools; extra == "dev"
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
|
|
43
|
+
# dynamic_characterization
|
|
44
|
+
|
|
45
|
+
[](https://dynamic-characterization.readthedocs.io/en/latest/)
|
|
46
|
+
[](https://pypi.org/project/dynamic-characterization/)
|
|
47
|
+
[](https://anaconda.org/diepers/dynamic_characterization)
|
|
48
|
+

|
|
49
|
+
[](https://mybinder.org/v2/gh/brightway-lca/dynamic_characterization/main?labpath=notebooks%2Fdynamic_characterization_demo.ipynb)
|
|
50
|
+
|
|
51
|
+
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](https://github.com/brightway-lca/bw_temporalis), [bw_timex](https://github.com/brightway-lca/bw_timex) or [optimex](https://github.com/RWTH-LTT/optimex).
|
|
52
|
+
|
|
53
|
+
The following dynamic characterization functions are currently included:
|
|
54
|
+
|
|
55
|
+
| module | impact category | metric | covered emissions | source |
|
|
56
|
+
|--------|-----------------|--------|-------------------|--------|
|
|
57
|
+
| `ipcc_ar6` | climate change | radiative forcing, GWP | 247 GHGs | radiative efficiencies & lifetimes from [IPCC AR6 Ch.7](https://www.ipcc.ch/report/ar6/wg1/chapter/chapter-7/) |
|
|
58
|
+
| `prospective` | climate change | prospective radiative forcing, pGWP, pGTP | CO2, CH4, N2O | [Watanabe et al. (2026)](https://pubs.acs.org/doi/10.1021/acs.est.5c12391) |
|
|
59
|
+
| `original_temporalis_functions` | climate change | radiative forcing | CO2, CH4 | [bw_temporalis](https://github.com/brightway-lca/bw_temporalis/tree/main) |
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
```console
|
|
64
|
+
$ pip install dynamic-characterization
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The same thing with [uv](https://docs.astral.sh/uv/) is `uv add dynamic-characterization`, and with conda `conda install -c conda-forge -c diepers dynamic_characterization`. See the [installation guide](https://dynamic-characterization.readthedocs.io/en/latest/content/installation/) for the details.
|
|
68
|
+
|
|
69
|
+
## Quick start
|
|
70
|
+
|
|
71
|
+
You bring a dynamic inventory - a DataFrame of `date`, `amount`, `flow`, `activity`, one row per emission at one point in time - and say which metric you want:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from dynamic_characterization import characterize
|
|
75
|
+
from dynamic_characterization.ipcc_ar6 import characterize_co2, characterize_ch4
|
|
76
|
+
|
|
77
|
+
df_characterized = characterize(
|
|
78
|
+
dynamic_inventory_df,
|
|
79
|
+
metric="radiative_forcing", # or GWP, pGWP, pGTP, prospective_radiative_forcing
|
|
80
|
+
characterization_functions={1: characterize_co2, 3: characterize_ch4},
|
|
81
|
+
time_horizon=100,
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Each function turns one row of the inventory into the characterized time series it causes, so the result carries a value per point in time rather than a single score.
|
|
86
|
+
|
|
87
|
+
If you work with [Brightway](https://docs.brightway.dev/en/latest/), pass an impact assessment method as `base_lcia_method` instead of the function dictionary, and the flows it characterizes are matched to our functions automatically, by name or CAS number.
|
|
88
|
+
|
|
89
|
+
## Documentation
|
|
90
|
+
|
|
91
|
+
The full documentation is at [dynamic-characterization.readthedocs.io](https://dynamic-characterization.readthedocs.io/en/latest/):
|
|
92
|
+
|
|
93
|
+
- [Usage](https://dynamic-characterization.readthedocs.io/en/latest/content/usage/) - the workflow in full, and every metric you can ask for
|
|
94
|
+
- [Prospective characterization](https://dynamic-characterization.readthedocs.io/en/latest/content/prospective/) - scenario-based characterization factors: choosing an IAM-SSP-RCP scenario, the IPCC fallback for unsupported GHGs, and scenario-dependent radiative efficiency and CO2 impulse response
|
|
95
|
+
- [Examples](https://dynamic-characterization.readthedocs.io/en/latest/content/examples/) - the demo notebooks, rendered
|
|
96
|
+
- [API reference](https://dynamic-characterization.readthedocs.io/en/latest/api/) - including how to write your own characterization function
|
|
97
|
+
|
|
98
|
+
## Contributing
|
|
99
|
+
|
|
100
|
+
Contributions are very welcome.
|
|
101
|
+
To learn more, see the [Contributor Guide][Contributor Guide].
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
Distributed under the terms of the [BSD 3-Clause license][License],
|
|
106
|
+
_dynamic_characterization_ is free and open source software.
|
|
107
|
+
|
|
108
|
+
## Issues
|
|
109
|
+
|
|
110
|
+
If you encounter any problems,
|
|
111
|
+
please [file an issue][Issue Tracker] along with a detailed description.
|
|
112
|
+
|
|
113
|
+
## Support
|
|
114
|
+
|
|
115
|
+
If you have any questions or need help, do not hesitate to contact Timo Diepers ([timo.diepers@ltt.rwth-aachen.de](mailto:timo.diepers@ltt.rwth-aachen.de))
|
|
116
|
+
|
|
117
|
+
<!-- github-only -->
|
|
118
|
+
|
|
119
|
+
[License]: https://github.com/brightway-lca/dynamic_characterization/blob/main/LICENSE
|
|
120
|
+
[Contributor Guide]: https://github.com/brightway-lca/dynamic_characterization/blob/main/CONTRIBUTING.md
|
|
121
|
+
[Issue Tracker]: https://github.com/brightway-lca/dynamic_characterization/issues
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# dynamic_characterization
|
|
2
|
+
|
|
3
|
+
[](https://dynamic-characterization.readthedocs.io/en/latest/)
|
|
4
|
+
[](https://pypi.org/project/dynamic-characterization/)
|
|
5
|
+
[](https://anaconda.org/diepers/dynamic_characterization)
|
|
6
|
+

|
|
7
|
+
[](https://mybinder.org/v2/gh/brightway-lca/dynamic_characterization/main?labpath=notebooks%2Fdynamic_characterization_demo.ipynb)
|
|
8
|
+
|
|
9
|
+
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](https://github.com/brightway-lca/bw_temporalis), [bw_timex](https://github.com/brightway-lca/bw_timex) or [optimex](https://github.com/RWTH-LTT/optimex).
|
|
10
|
+
|
|
11
|
+
The following dynamic characterization functions are currently included:
|
|
12
|
+
|
|
13
|
+
| module | impact category | metric | covered emissions | source |
|
|
14
|
+
|--------|-----------------|--------|-------------------|--------|
|
|
15
|
+
| `ipcc_ar6` | climate change | radiative forcing, GWP | 247 GHGs | radiative efficiencies & lifetimes from [IPCC AR6 Ch.7](https://www.ipcc.ch/report/ar6/wg1/chapter/chapter-7/) |
|
|
16
|
+
| `prospective` | climate change | prospective radiative forcing, pGWP, pGTP | CO2, CH4, N2O | [Watanabe et al. (2026)](https://pubs.acs.org/doi/10.1021/acs.est.5c12391) |
|
|
17
|
+
| `original_temporalis_functions` | climate change | radiative forcing | CO2, CH4 | [bw_temporalis](https://github.com/brightway-lca/bw_temporalis/tree/main) |
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```console
|
|
22
|
+
$ pip install dynamic-characterization
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The same thing with [uv](https://docs.astral.sh/uv/) is `uv add dynamic-characterization`, and with conda `conda install -c conda-forge -c diepers dynamic_characterization`. See the [installation guide](https://dynamic-characterization.readthedocs.io/en/latest/content/installation/) for the details.
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
You bring a dynamic inventory - a DataFrame of `date`, `amount`, `flow`, `activity`, one row per emission at one point in time - and say which metric you want:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from dynamic_characterization import characterize
|
|
33
|
+
from dynamic_characterization.ipcc_ar6 import characterize_co2, characterize_ch4
|
|
34
|
+
|
|
35
|
+
df_characterized = characterize(
|
|
36
|
+
dynamic_inventory_df,
|
|
37
|
+
metric="radiative_forcing", # or GWP, pGWP, pGTP, prospective_radiative_forcing
|
|
38
|
+
characterization_functions={1: characterize_co2, 3: characterize_ch4},
|
|
39
|
+
time_horizon=100,
|
|
40
|
+
)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Each function turns one row of the inventory into the characterized time series it causes, so the result carries a value per point in time rather than a single score.
|
|
44
|
+
|
|
45
|
+
If you work with [Brightway](https://docs.brightway.dev/en/latest/), pass an impact assessment method as `base_lcia_method` instead of the function dictionary, and the flows it characterizes are matched to our functions automatically, by name or CAS number.
|
|
46
|
+
|
|
47
|
+
## Documentation
|
|
48
|
+
|
|
49
|
+
The full documentation is at [dynamic-characterization.readthedocs.io](https://dynamic-characterization.readthedocs.io/en/latest/):
|
|
50
|
+
|
|
51
|
+
- [Usage](https://dynamic-characterization.readthedocs.io/en/latest/content/usage/) - the workflow in full, and every metric you can ask for
|
|
52
|
+
- [Prospective characterization](https://dynamic-characterization.readthedocs.io/en/latest/content/prospective/) - scenario-based characterization factors: choosing an IAM-SSP-RCP scenario, the IPCC fallback for unsupported GHGs, and scenario-dependent radiative efficiency and CO2 impulse response
|
|
53
|
+
- [Examples](https://dynamic-characterization.readthedocs.io/en/latest/content/examples/) - the demo notebooks, rendered
|
|
54
|
+
- [API reference](https://dynamic-characterization.readthedocs.io/en/latest/api/) - including how to write your own characterization function
|
|
55
|
+
|
|
56
|
+
## Contributing
|
|
57
|
+
|
|
58
|
+
Contributions are very welcome.
|
|
59
|
+
To learn more, see the [Contributor Guide][Contributor Guide].
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
Distributed under the terms of the [BSD 3-Clause license][License],
|
|
64
|
+
_dynamic_characterization_ is free and open source software.
|
|
65
|
+
|
|
66
|
+
## Issues
|
|
67
|
+
|
|
68
|
+
If you encounter any problems,
|
|
69
|
+
please [file an issue][Issue Tracker] along with a detailed description.
|
|
70
|
+
|
|
71
|
+
## Support
|
|
72
|
+
|
|
73
|
+
If you have any questions or need help, do not hesitate to contact Timo Diepers ([timo.diepers@ltt.rwth-aachen.de](mailto:timo.diepers@ltt.rwth-aachen.de))
|
|
74
|
+
|
|
75
|
+
<!-- github-only -->
|
|
76
|
+
|
|
77
|
+
[License]: https://github.com/brightway-lca/dynamic_characterization/blob/main/LICENSE
|
|
78
|
+
[Contributor Guide]: https://github.com/brightway-lca/dynamic_characterization/blob/main/CONTRIBUTING.md
|
|
79
|
+
[Issue Tracker]: https://github.com/brightway-lca/dynamic_characterization/issues
|
|
@@ -31,6 +31,15 @@ from dynamic_characterization.prospective.radiative_forcing import (
|
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
|
|
34
|
+
# Characterization functions from the Watanabe module. These are the only ones that
|
|
35
|
+
# accept the `time_varying_re` argument.
|
|
36
|
+
_PROSPECTIVE_CHARACTERIZATION_FUNCTIONS = (
|
|
37
|
+
prospective_characterize_co2,
|
|
38
|
+
prospective_characterize_co2_uptake,
|
|
39
|
+
prospective_characterize_ch4,
|
|
40
|
+
prospective_characterize_n2o,
|
|
41
|
+
)
|
|
42
|
+
|
|
34
43
|
# Building the default characterization functions reloads decay_multipliers.json and
|
|
35
44
|
# issues one biosphere DB query per method flow. The result only depends on the BW
|
|
36
45
|
# project, the method, and the boolean flags, so it is memoized across calls.
|
|
@@ -548,6 +557,24 @@ def _calculate_dynamic_time_horizon(
|
|
|
548
557
|
return time_horizon
|
|
549
558
|
|
|
550
559
|
|
|
560
|
+
def _apply_characterization_function(
|
|
561
|
+
char_func,
|
|
562
|
+
row,
|
|
563
|
+
time_horizon,
|
|
564
|
+
time_varying_re: bool = False,
|
|
565
|
+
) -> CharacterizedRow:
|
|
566
|
+
"""
|
|
567
|
+
Call a characterization function, passing `time_varying_re` only to those that accept it.
|
|
568
|
+
|
|
569
|
+
Flows that are not covered by the Watanabe module (e.g. CO and the GHGs from
|
|
570
|
+
decay_multipliers.json) are characterized with IPCC AR6 functions, which have no
|
|
571
|
+
`time_varying_re` parameter.
|
|
572
|
+
"""
|
|
573
|
+
if char_func in _PROSPECTIVE_CHARACTERIZATION_FUNCTIONS:
|
|
574
|
+
return char_func(row, time_horizon, time_varying_re=time_varying_re)
|
|
575
|
+
return char_func(row, time_horizon)
|
|
576
|
+
|
|
577
|
+
|
|
551
578
|
def _characterize_radiative_forcing(
|
|
552
579
|
characterization_functions, row, time_horizon
|
|
553
580
|
) -> CharacterizedRow:
|
|
@@ -601,7 +628,8 @@ def _characterize_pgwp(
|
|
|
601
628
|
emission_year = int(str(emission_date.to_numpy())[:4])
|
|
602
629
|
|
|
603
630
|
# Calculate AGWP for the gas using its characterization function
|
|
604
|
-
radiative_forcing_ghg =
|
|
631
|
+
radiative_forcing_ghg = _apply_characterization_function(
|
|
632
|
+
characterization_functions[row.flow],
|
|
605
633
|
row,
|
|
606
634
|
dynamic_time_horizon,
|
|
607
635
|
time_varying_re=time_varying_re,
|
|
@@ -673,9 +701,11 @@ def _characterize_pgtp(
|
|
|
673
701
|
else:
|
|
674
702
|
# For other GHGs, fall back to using integrated RF as proxy
|
|
675
703
|
# This may not be as accurate but provides a fallback
|
|
676
|
-
radiative_forcing_ghg =
|
|
704
|
+
radiative_forcing_ghg = _apply_characterization_function(
|
|
705
|
+
char_func,
|
|
677
706
|
row,
|
|
678
707
|
dynamic_time_horizon,
|
|
708
|
+
time_varying_re=time_varying_re,
|
|
679
709
|
)
|
|
680
710
|
agtp_gas = radiative_forcing_ghg.amount.sum()
|
|
681
711
|
|
|
@@ -705,22 +735,13 @@ def _characterize_prospective_radiative_forcing(
|
|
|
705
735
|
"""
|
|
706
736
|
Calculate prospective radiative forcing using Watanabe et al. (2026) characterization.
|
|
707
737
|
|
|
708
|
-
For GHGs available in Watanabe (CO2, CH4, N2O), uses scenario-based radiative
|
|
738
|
+
For GHGs available in Watanabe (CO2, CH4, N2O), uses scenario-based radiative
|
|
739
|
+
efficiencies; for CO2 the impulse response function is scenario-based as well.
|
|
709
740
|
For other GHGs (when fallback_to_ipcc=True), uses standard IPCC AR6 functions.
|
|
710
741
|
"""
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
prospective_characterize_co2_uptake,
|
|
717
|
-
prospective_characterize_ch4,
|
|
718
|
-
prospective_characterize_n2o,
|
|
742
|
+
return _apply_characterization_function(
|
|
743
|
+
characterization_functions[row.flow],
|
|
744
|
+
row,
|
|
745
|
+
time_horizon,
|
|
746
|
+
time_varying_re=time_varying_re,
|
|
719
747
|
)
|
|
720
|
-
|
|
721
|
-
if char_func in prospective_functions:
|
|
722
|
-
# Watanabe functions support time_varying_re
|
|
723
|
-
return char_func(row, time_horizon, time_varying_re=time_varying_re)
|
|
724
|
-
else:
|
|
725
|
-
# IPCC fallback functions don't support time_varying_re
|
|
726
|
-
return char_func(row, time_horizon)
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Prospective characterization factors based on Watanabe et al. (2026).
|
|
3
3
|
|
|
4
|
-
Implements scenario-based characterization using
|
|
5
|
-
efficiencies
|
|
4
|
+
Implements scenario-based characterization using IAM-SSP-RCP scenarios. Both the
|
|
5
|
+
radiative efficiencies and, for CO2, the impulse response function depend on the
|
|
6
|
+
scenario: RE changes with the projected background concentrations, and the CO2 IRF
|
|
7
|
+
changes with the carbon cycle feedbacks of the RCP. CH4 and N2O keep fixed lifetimes.
|
|
6
8
|
|
|
7
9
|
Reference: https://doi.org/10.1021/acs.est.5b01118
|
|
8
10
|
"""
|
|
@@ -93,7 +93,7 @@ def agtp_co2(
|
|
|
93
93
|
Parameters
|
|
94
94
|
----------
|
|
95
95
|
emission_year : int
|
|
96
|
-
Year of emission (
|
|
96
|
+
Year of emission (2020-2150, clamped if outside)
|
|
97
97
|
time_horizon : int
|
|
98
98
|
Integration period in years
|
|
99
99
|
time_varying_re : bool
|
|
@@ -151,7 +151,7 @@ def agtp_ch4(
|
|
|
151
151
|
Parameters
|
|
152
152
|
----------
|
|
153
153
|
emission_year : int
|
|
154
|
-
Year of emission (
|
|
154
|
+
Year of emission (2020-2150, clamped if outside)
|
|
155
155
|
time_horizon : int
|
|
156
156
|
Integration period in years
|
|
157
157
|
time_varying_re : bool
|
|
@@ -206,7 +206,7 @@ def agtp_n2o(
|
|
|
206
206
|
Parameters
|
|
207
207
|
----------
|
|
208
208
|
emission_year : int
|
|
209
|
-
Year of emission (
|
|
209
|
+
Year of emission (2020-2150, clamped if outside)
|
|
210
210
|
time_horizon : int
|
|
211
211
|
Integration period in years
|
|
212
212
|
time_varying_re : bool
|
|
@@ -51,9 +51,10 @@ def _get_year_index(emission_year: int, years: np.ndarray) -> int:
|
|
|
51
51
|
"""
|
|
52
52
|
Get index for emission year in RE data, with clamping and warnings.
|
|
53
53
|
|
|
54
|
-
RE data
|
|
54
|
+
The bounds are taken from the RE data itself (currently 2020-2150), so they
|
|
55
|
+
follow the data instead of the narrower range reported in the paper tables.
|
|
55
56
|
"""
|
|
56
|
-
min_year, max_year =
|
|
57
|
+
min_year, max_year = int(years[0]), int(years[-1])
|
|
57
58
|
|
|
58
59
|
if emission_year < min_year:
|
|
59
60
|
warnings.warn(
|
|
@@ -87,7 +88,7 @@ def agwp_co2(
|
|
|
87
88
|
Parameters
|
|
88
89
|
----------
|
|
89
90
|
emission_year : int
|
|
90
|
-
Year of emission (
|
|
91
|
+
Year of emission (2020-2150, clamped if outside)
|
|
91
92
|
time_horizon : int
|
|
92
93
|
Integration period in years
|
|
93
94
|
time_varying_re : bool
|
|
@@ -144,7 +145,7 @@ def agwp_ch4(
|
|
|
144
145
|
Parameters
|
|
145
146
|
----------
|
|
146
147
|
emission_year : int
|
|
147
|
-
Year of emission (
|
|
148
|
+
Year of emission (2020-2150, clamped if outside)
|
|
148
149
|
time_horizon : int
|
|
149
150
|
Integration period in years
|
|
150
151
|
time_varying_re : bool
|
|
@@ -195,7 +196,7 @@ def agwp_n2o(
|
|
|
195
196
|
Parameters
|
|
196
197
|
----------
|
|
197
198
|
emission_year : int
|
|
198
|
-
Year of emission (
|
|
199
|
+
Year of emission (2020-2150, clamped if outside)
|
|
199
200
|
time_horizon : int
|
|
200
201
|
Integration period in years
|
|
201
202
|
time_varying_re : bool
|
|
@@ -33,6 +33,25 @@ VALID_SCENARIOS: Set[Tuple[str, str, str]] = {
|
|
|
33
33
|
# Module-level state
|
|
34
34
|
_current_scenario: Optional[Dict[str, str]] = None
|
|
35
35
|
|
|
36
|
+
# Raised when a prospective characterization factor is requested before a scenario is
|
|
37
|
+
# chosen. This is often the first time users see this package: the prospective metrics
|
|
38
|
+
# are usually calculated through another package (e.g. bw_timex), so the message spells
|
|
39
|
+
# out the full import path and does not assume anything is imported already.
|
|
40
|
+
NO_SCENARIO_MESSAGE = """No scenario set.
|
|
41
|
+
|
|
42
|
+
The prospective characterization factors (Watanabe et al. 2026) used for the metrics
|
|
43
|
+
"pGWP", "pGTP" and "prospective_radiative_forcing" depend on a future scenario, so you
|
|
44
|
+
have to choose one before calculating them:
|
|
45
|
+
|
|
46
|
+
from dynamic_characterization.prospective import set_scenario
|
|
47
|
+
set_scenario(iam="IMAGE", ssp="SSP1", rcp="2.6")
|
|
48
|
+
|
|
49
|
+
This is done once per Python session and applies to all following calculations.
|
|
50
|
+
|
|
51
|
+
Each IAM comes with one SSP: IMAGE-SSP1, MESSAGE-SSP2, AIM-SSP3, GCAM4-SSP4,
|
|
52
|
+
REMIND-SSP5. The available RCPs are "2.6", "4.5", "6.0" and "8.5", but not for every
|
|
53
|
+
IAM - see dynamic_characterization.prospective.VALID_SCENARIOS for the full list."""
|
|
54
|
+
|
|
36
55
|
|
|
37
56
|
def set_scenario(iam: str, ssp: str, rcp: str) -> None:
|
|
38
57
|
"""
|
|
@@ -79,9 +98,7 @@ def get_scenario() -> Dict[str, str]:
|
|
|
79
98
|
If no scenario has been set
|
|
80
99
|
"""
|
|
81
100
|
if _current_scenario is None:
|
|
82
|
-
raise RuntimeError(
|
|
83
|
-
"No scenario set. Call prospective.set_scenario(iam, ssp, rcp) first."
|
|
84
|
-
)
|
|
101
|
+
raise RuntimeError(NO_SCENARIO_MESSAGE)
|
|
85
102
|
return _current_scenario.copy()
|
|
86
103
|
|
|
87
104
|
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Watanabe prospective characterization functions.
|
|
3
3
|
|
|
4
4
|
Returns radiative forcing time series matching the existing ipcc_ar6 API,
|
|
5
|
-
but using scenario-based radiative efficiencies
|
|
5
|
+
but using scenario-based radiative efficiencies and, for CO2, a scenario-based
|
|
6
|
+
impulse response function from Watanabe et al. (2026).
|
|
6
7
|
|
|
7
8
|
Reference: https://doi.org/10.1021/acs.est.5b01118
|
|
8
9
|
"""
|
|
@@ -47,9 +48,10 @@ def _get_year_index(emission_year: int, years: np.ndarray) -> int:
|
|
|
47
48
|
"""
|
|
48
49
|
Get index for emission year in RE data, with clamping and warnings.
|
|
49
50
|
|
|
50
|
-
RE data
|
|
51
|
+
The bounds are taken from the RE data itself (currently 2020-2150), so they
|
|
52
|
+
follow the data instead of the narrower range reported in the paper tables.
|
|
51
53
|
"""
|
|
52
|
-
min_year, max_year =
|
|
54
|
+
min_year, max_year = int(years[0]), int(years[-1])
|
|
53
55
|
|
|
54
56
|
if emission_year < min_year:
|
|
55
57
|
warnings.warn(
|
|
@@ -81,7 +83,8 @@ def characterize_co2(
|
|
|
81
83
|
"""
|
|
82
84
|
Calculate radiative forcing time series for 1 kg CO2 emission.
|
|
83
85
|
|
|
84
|
-
Uses scenario-based radiative efficiencies
|
|
86
|
+
Uses scenario-based radiative efficiencies and a scenario-based (RCP-specific)
|
|
87
|
+
CO2 impulse response function from Watanabe et al. (2026).
|
|
85
88
|
Scenario must be set via prospective.set_scenario() before calling.
|
|
86
89
|
|
|
87
90
|
Parameters
|
|
@@ -193,7 +196,9 @@ def characterize_ch4(
|
|
|
193
196
|
"""
|
|
194
197
|
Calculate radiative forcing time series for 1 kg CH4 emission.
|
|
195
198
|
|
|
196
|
-
Uses scenario-based radiative efficiencies from Watanabe et al. (2026).
|
|
199
|
+
Uses scenario-based radiative efficiencies from Watanabe et al. (2026). The
|
|
200
|
+
impulse response function uses a fixed atmospheric lifetime; only CO2 has a
|
|
201
|
+
scenario-dependent IRF.
|
|
197
202
|
Scenario must be set via prospective.set_scenario() before calling.
|
|
198
203
|
|
|
199
204
|
This includes only direct effects. For indirect effects (ozone, water vapor),
|
|
@@ -282,7 +287,9 @@ def characterize_n2o(
|
|
|
282
287
|
"""
|
|
283
288
|
Calculate radiative forcing time series for 1 kg N2O emission.
|
|
284
289
|
|
|
285
|
-
Uses scenario-based radiative efficiencies from Watanabe et al. (2026).
|
|
290
|
+
Uses scenario-based radiative efficiencies from Watanabe et al. (2026). The
|
|
291
|
+
impulse response function uses a fixed atmospheric lifetime; only CO2 has a
|
|
292
|
+
scenario-dependent IRF.
|
|
286
293
|
Scenario must be set via prospective.set_scenario() before calling.
|
|
287
294
|
|
|
288
295
|
Parameters
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dynamic_characterization
|
|
3
|
+
Version: 1.4.3
|
|
4
|
+
Summary: Collection of functions for characterizing life cycle inventories with temporal information
|
|
5
|
+
Author-email: Timo Diepers <timo.diepers@ltt.rwth-aachen.de>
|
|
6
|
+
Maintainer-email: Timo Diepers <timo.diepers@ltt.rwth-aachen.de>
|
|
7
|
+
Project-URL: source, https://github.com/brightway-lca/dynamic_characterization
|
|
8
|
+
Project-URL: homepage, https://github.com/brightway-lca/dynamic_characterization
|
|
9
|
+
Project-URL: tracker, https://github.com/brightway-lca/dynamic_characterization/issues
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
17
|
+
Classifier: Natural Language :: English
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: pandas
|
|
24
|
+
Requires-Dist: numpy
|
|
25
|
+
Requires-Dist: bw2data
|
|
26
|
+
Requires-Dist: loguru
|
|
27
|
+
Requires-Dist: matplotlib>=3.9.4
|
|
28
|
+
Requires-Dist: openpyxl>=3.1.5
|
|
29
|
+
Provides-Extra: testing
|
|
30
|
+
Requires-Dist: pytest; extra == "testing"
|
|
31
|
+
Requires-Dist: pytest-cov; extra == "testing"
|
|
32
|
+
Requires-Dist: python-coveralls; extra == "testing"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: build; extra == "dev"
|
|
35
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
36
|
+
Requires-Dist: pylint; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-randomly; extra == "dev"
|
|
40
|
+
Requires-Dist: setuptools; extra == "dev"
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
|
|
43
|
+
# dynamic_characterization
|
|
44
|
+
|
|
45
|
+
[](https://dynamic-characterization.readthedocs.io/en/latest/)
|
|
46
|
+
[](https://pypi.org/project/dynamic-characterization/)
|
|
47
|
+
[](https://anaconda.org/diepers/dynamic_characterization)
|
|
48
|
+

|
|
49
|
+
[](https://mybinder.org/v2/gh/brightway-lca/dynamic_characterization/main?labpath=notebooks%2Fdynamic_characterization_demo.ipynb)
|
|
50
|
+
|
|
51
|
+
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](https://github.com/brightway-lca/bw_temporalis), [bw_timex](https://github.com/brightway-lca/bw_timex) or [optimex](https://github.com/RWTH-LTT/optimex).
|
|
52
|
+
|
|
53
|
+
The following dynamic characterization functions are currently included:
|
|
54
|
+
|
|
55
|
+
| module | impact category | metric | covered emissions | source |
|
|
56
|
+
|--------|-----------------|--------|-------------------|--------|
|
|
57
|
+
| `ipcc_ar6` | climate change | radiative forcing, GWP | 247 GHGs | radiative efficiencies & lifetimes from [IPCC AR6 Ch.7](https://www.ipcc.ch/report/ar6/wg1/chapter/chapter-7/) |
|
|
58
|
+
| `prospective` | climate change | prospective radiative forcing, pGWP, pGTP | CO2, CH4, N2O | [Watanabe et al. (2026)](https://pubs.acs.org/doi/10.1021/acs.est.5c12391) |
|
|
59
|
+
| `original_temporalis_functions` | climate change | radiative forcing | CO2, CH4 | [bw_temporalis](https://github.com/brightway-lca/bw_temporalis/tree/main) |
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
```console
|
|
64
|
+
$ pip install dynamic-characterization
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The same thing with [uv](https://docs.astral.sh/uv/) is `uv add dynamic-characterization`, and with conda `conda install -c conda-forge -c diepers dynamic_characterization`. See the [installation guide](https://dynamic-characterization.readthedocs.io/en/latest/content/installation/) for the details.
|
|
68
|
+
|
|
69
|
+
## Quick start
|
|
70
|
+
|
|
71
|
+
You bring a dynamic inventory - a DataFrame of `date`, `amount`, `flow`, `activity`, one row per emission at one point in time - and say which metric you want:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from dynamic_characterization import characterize
|
|
75
|
+
from dynamic_characterization.ipcc_ar6 import characterize_co2, characterize_ch4
|
|
76
|
+
|
|
77
|
+
df_characterized = characterize(
|
|
78
|
+
dynamic_inventory_df,
|
|
79
|
+
metric="radiative_forcing", # or GWP, pGWP, pGTP, prospective_radiative_forcing
|
|
80
|
+
characterization_functions={1: characterize_co2, 3: characterize_ch4},
|
|
81
|
+
time_horizon=100,
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Each function turns one row of the inventory into the characterized time series it causes, so the result carries a value per point in time rather than a single score.
|
|
86
|
+
|
|
87
|
+
If you work with [Brightway](https://docs.brightway.dev/en/latest/), pass an impact assessment method as `base_lcia_method` instead of the function dictionary, and the flows it characterizes are matched to our functions automatically, by name or CAS number.
|
|
88
|
+
|
|
89
|
+
## Documentation
|
|
90
|
+
|
|
91
|
+
The full documentation is at [dynamic-characterization.readthedocs.io](https://dynamic-characterization.readthedocs.io/en/latest/):
|
|
92
|
+
|
|
93
|
+
- [Usage](https://dynamic-characterization.readthedocs.io/en/latest/content/usage/) - the workflow in full, and every metric you can ask for
|
|
94
|
+
- [Prospective characterization](https://dynamic-characterization.readthedocs.io/en/latest/content/prospective/) - scenario-based characterization factors: choosing an IAM-SSP-RCP scenario, the IPCC fallback for unsupported GHGs, and scenario-dependent radiative efficiency and CO2 impulse response
|
|
95
|
+
- [Examples](https://dynamic-characterization.readthedocs.io/en/latest/content/examples/) - the demo notebooks, rendered
|
|
96
|
+
- [API reference](https://dynamic-characterization.readthedocs.io/en/latest/api/) - including how to write your own characterization function
|
|
97
|
+
|
|
98
|
+
## Contributing
|
|
99
|
+
|
|
100
|
+
Contributions are very welcome.
|
|
101
|
+
To learn more, see the [Contributor Guide][Contributor Guide].
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
Distributed under the terms of the [BSD 3-Clause license][License],
|
|
106
|
+
_dynamic_characterization_ is free and open source software.
|
|
107
|
+
|
|
108
|
+
## Issues
|
|
109
|
+
|
|
110
|
+
If you encounter any problems,
|
|
111
|
+
please [file an issue][Issue Tracker] along with a detailed description.
|
|
112
|
+
|
|
113
|
+
## Support
|
|
114
|
+
|
|
115
|
+
If you have any questions or need help, do not hesitate to contact Timo Diepers ([timo.diepers@ltt.rwth-aachen.de](mailto:timo.diepers@ltt.rwth-aachen.de))
|
|
116
|
+
|
|
117
|
+
<!-- github-only -->
|
|
118
|
+
|
|
119
|
+
[License]: https://github.com/brightway-lca/dynamic_characterization/blob/main/LICENSE
|
|
120
|
+
[Contributor Guide]: https://github.com/brightway-lca/dynamic_characterization/blob/main/CONTRIBUTING.md
|
|
121
|
+
[Issue Tracker]: https://github.com/brightway-lca/dynamic_characterization/issues
|
|
@@ -82,5 +82,6 @@ dynamic_characterization/prospective/data/es5c12391_si_024.xlsx
|
|
|
82
82
|
dynamic_characterization/prospective/data/es5c12391_si_025.xlsx
|
|
83
83
|
dynamic_characterization/prospective/data/es5c12391_si_026.xlsx
|
|
84
84
|
tests/test_characterize_dynamic_inventory.py
|
|
85
|
+
tests/test_characterize_prospective_fallback.py
|
|
85
86
|
tests/test_default_characterization_functions.py
|
|
86
87
|
tests/test_prospective.py
|
|
@@ -22,6 +22,7 @@ classifiers = [
|
|
|
22
22
|
"Programming Language :: Python :: 3.10",
|
|
23
23
|
"Programming Language :: Python :: 3.11",
|
|
24
24
|
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"License :: OSI Approved :: BSD License",
|
|
25
26
|
"Natural Language :: English",
|
|
26
27
|
"Operating System :: OS Independent",
|
|
27
28
|
"Topic :: Scientific/Engineering"
|