dynamic-characterization 1.4.2__tar.gz → 2.0.0__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.2 → dynamic_characterization-2.0.0}/LICENSE +2 -0
- dynamic_characterization-2.0.0/PKG-INFO +121 -0
- dynamic_characterization-2.0.0/README.md +79 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/__init__.py +8 -3
- dynamic_characterization-2.0.0/dynamic_characterization/ar6_dispatch.py +224 -0
- dynamic_characterization-2.0.0/dynamic_characterization/ar6_prospective.py +227 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/dynamic_characterization.py +188 -226
- dynamic_characterization-2.0.0/dynamic_characterization/flows.py +104 -0
- dynamic_characterization-2.0.0/dynamic_characterization/ipcc_ar6/ar6_core.py +434 -0
- dynamic_characterization-2.0.0/dynamic_characterization/ipcc_ar6/data/ar6_parameters.json +123 -0
- dynamic_characterization-2.0.0/dynamic_characterization/ipcc_ar6/data/precursor_parameters.json +597 -0
- dynamic_characterization-2.0.0/dynamic_characterization/ipcc_ar6/gases.py +325 -0
- dynamic_characterization-2.0.0/dynamic_characterization/ipcc_ar6/radiative_forcing.py +157 -0
- dynamic_characterization-2.0.0/dynamic_characterization/options.py +155 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/__init__.py +8 -4
- dynamic_characterization-2.0.0/dynamic_characterization/prospective/_common.py +44 -0
- dynamic_characterization-2.0.0/dynamic_characterization/prospective/agtp.py +25 -0
- dynamic_characterization-2.0.0/dynamic_characterization/prospective/agwp.py +58 -0
- dynamic_characterization-2.0.0/dynamic_characterization/prospective/radiative_forcing.py +99 -0
- dynamic_characterization-2.0.0/dynamic_characterization/prospective/watanabe2026.py +335 -0
- dynamic_characterization-2.0.0/dynamic_characterization.egg-info/PKG-INFO +121 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization.egg-info/SOURCES.txt +26 -2
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/pyproject.toml +1 -0
- dynamic_characterization-2.0.0/tests/test_ar6_core.py +209 -0
- dynamic_characterization-2.0.0/tests/test_ar6_dispatch.py +190 -0
- dynamic_characterization-2.0.0/tests/test_ar6_prospective.py +228 -0
- dynamic_characterization-2.0.0/tests/test_characterize_prospective_fallback.py +128 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/tests/test_default_characterization_functions.py +15 -1
- dynamic_characterization-2.0.0/tests/test_flows.py +126 -0
- dynamic_characterization-2.0.0/tests/test_paper_watanabe2026.py +208 -0
- dynamic_characterization-2.0.0/tests/test_precursors.py +274 -0
- dynamic_characterization-2.0.0/tests/test_prospective.py +299 -0
- dynamic_characterization-1.4.2/PKG-INFO +0 -284
- dynamic_characterization-1.4.2/README.md +0 -243
- dynamic_characterization-1.4.2/dynamic_characterization/ipcc_ar6/data/decay_multipliers.json +0 -1
- dynamic_characterization-1.4.2/dynamic_characterization/ipcc_ar6/radiative_forcing.py +0 -466
- dynamic_characterization-1.4.2/dynamic_characterization/prospective/agtp.py +0 -250
- dynamic_characterization-1.4.2/dynamic_characterization/prospective/agwp.py +0 -235
- dynamic_characterization-1.4.2/dynamic_characterization/prospective/radiative_forcing.py +0 -359
- dynamic_characterization-1.4.2/dynamic_characterization.egg-info/PKG-INFO +0 -284
- dynamic_characterization-1.4.2/tests/test_characterize_prospective_fallback.py +0 -68
- dynamic_characterization-1.4.2/tests/test_prospective.py +0 -1211
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/MANIFEST.in +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/classes.py +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/ipcc_ar6/__init__.py +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/ipcc_ar6/data/hodnebrog20.csv +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/original_temporalis_functions/__init__.py +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/original_temporalis_functions/radiative_forcing.py +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/config.py +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_001.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_002.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_003.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_004.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_009.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_010.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_011.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_012.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_013.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_014.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_015.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_016.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_017.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_018.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_019.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_020.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_021.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_022.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_023.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_024.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_025.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data/es5c12391_si_026.xlsx +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization/prospective/data_loader.py +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization.egg-info/dependency_links.txt +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization.egg-info/requires.txt +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/dynamic_characterization.egg-info/top_level.txt +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/setup.cfg +0 -0
- {dynamic_characterization-1.4.2 → dynamic_characterization-2.0.0}/tests/test_characterize_dynamic_inventory.py +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dynamic_characterization
|
|
3
|
+
Version: 2.0.0
|
|
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
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Collection of dynamic characterization functions for life cycle inventories with temporal information.
|
|
3
3
|
|
|
4
4
|
Provides:
|
|
5
|
-
- ipcc_ar6: IPCC AR6
|
|
6
|
-
|
|
5
|
+
- ipcc_ar6: characterization functions following the IPCC AR6 emission metrics (CO2, CH4, N2O,
|
|
6
|
+
halocarbons) and the indirect effects of CO, VOC, H2 and NOx
|
|
7
|
+
- prospective: prospective characterization after Barbosa Watanabe & Cherubini (2026)
|
|
7
8
|
- original_temporalis_functions: Legacy functions from bw_temporalis
|
|
8
9
|
|
|
9
10
|
For prospective metrics (pGWP, pGTP), set the scenario first:
|
|
@@ -15,15 +16,19 @@ __all__ = (
|
|
|
15
16
|
"__version__",
|
|
16
17
|
"characterize",
|
|
17
18
|
"create_characterization_functions_from_method",
|
|
19
|
+
"compare_with_static",
|
|
20
|
+
"CharacterizationOptions",
|
|
18
21
|
"original_temporalis_functions",
|
|
19
22
|
"ipcc_ar6",
|
|
20
23
|
"prospective",
|
|
21
24
|
)
|
|
22
25
|
|
|
23
|
-
__version__ = "
|
|
26
|
+
__version__ = "2.0.0"
|
|
24
27
|
|
|
25
28
|
from . import ipcc_ar6, original_temporalis_functions, prospective
|
|
26
29
|
from .dynamic_characterization import (
|
|
27
30
|
characterize,
|
|
31
|
+
compare_with_static,
|
|
28
32
|
create_characterization_functions_from_method,
|
|
29
33
|
)
|
|
34
|
+
from .options import CharacterizationOptions
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"""Default characterization functions of the ``"ar6"`` parameter set, matched to biosphere flows."""
|
|
2
|
+
|
|
3
|
+
from typing import Callable, Dict, Iterable, NamedTuple, Optional
|
|
4
|
+
|
|
5
|
+
from loguru import logger
|
|
6
|
+
|
|
7
|
+
from dynamic_characterization import ar6_prospective
|
|
8
|
+
from dynamic_characterization.flows import is_co2_uptake, normalize_cas
|
|
9
|
+
from dynamic_characterization.ipcc_ar6 import ar6_core, gases
|
|
10
|
+
from dynamic_characterization.ipcc_ar6.radiative_forcing import (
|
|
11
|
+
characterize_co2_ar6,
|
|
12
|
+
characterize_co2_uptake_ar6,
|
|
13
|
+
make_characterization_function,
|
|
14
|
+
)
|
|
15
|
+
from dynamic_characterization.options import CharacterizationOptions
|
|
16
|
+
|
|
17
|
+
SPECIES_BY_CAS = {
|
|
18
|
+
"124-38-9": "CO2",
|
|
19
|
+
"74-82-8": "CH4",
|
|
20
|
+
"10024-97-2": "N2O",
|
|
21
|
+
"630-08-0": "CO",
|
|
22
|
+
"1333-74-0": "H2",
|
|
23
|
+
"10102-43-9": "NO",
|
|
24
|
+
"10102-44-0": "NO2",
|
|
25
|
+
"11104-93-1": "NOx",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# exact (lower-case) names, for flows without a CAS number. Never match by substring:
|
|
29
|
+
# "methane" is also part of "Methane, dichloro-", "Tetrafluoromethane", ...
|
|
30
|
+
SPECIES_BY_NAME = {
|
|
31
|
+
"carbon dioxide": "CO2",
|
|
32
|
+
"carbon dioxide, fossil": "CO2",
|
|
33
|
+
"carbon dioxide, non-fossil": "CO2",
|
|
34
|
+
"carbon dioxide, from soil or biomass stock": "CO2",
|
|
35
|
+
"carbon dioxide, to soil or biomass stock": "CO2",
|
|
36
|
+
"carbon dioxide, in air": "CO2",
|
|
37
|
+
"methane": "CH4",
|
|
38
|
+
"methane, fossil": "CH4",
|
|
39
|
+
"methane, non-fossil": "CH4",
|
|
40
|
+
"methane, from soil or biomass stock": "CH4",
|
|
41
|
+
"dinitrogen monoxide": "N2O",
|
|
42
|
+
"carbon monoxide": "CO",
|
|
43
|
+
"carbon monoxide, fossil": "CO",
|
|
44
|
+
"carbon monoxide, non-fossil": "CO",
|
|
45
|
+
"carbon monoxide, from soil or biomass stock": "CO",
|
|
46
|
+
"hydrogen": "H2",
|
|
47
|
+
"voc, volatile organic compounds": "VOC",
|
|
48
|
+
"nmvoc, non-methane volatile organic compounds": "VOC",
|
|
49
|
+
"nitric oxide": "NO",
|
|
50
|
+
"nitrogen dioxide": "NO2",
|
|
51
|
+
"nitrogen oxides": "NOx",
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
_NAMED_SPECIES = ("CO2", "CO2 uptake", "CH4", "N2O", "CO", "H2", "VOC", "NO", "NO2", "NOx")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class FlowClass(NamedTuple):
|
|
58
|
+
species: Optional[str] # one of _NAMED_SPECIES, a canonical CAS, or None
|
|
59
|
+
origin: Optional[str] # "fossil", "non-fossil" or None (not stated in the flow name)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def origin_from_name(name: str) -> Optional[str]:
|
|
63
|
+
"""Fossil or non-fossil origin as stated in an ecoinvent-style flow name, else None.
|
|
64
|
+
|
|
65
|
+
"from soil or biomass stock" counts as fossil, as in the ecoinvent IPCC 2021 implementation
|
|
66
|
+
(carbon released from a stock, not recently taken up).
|
|
67
|
+
"""
|
|
68
|
+
name = name.lower()
|
|
69
|
+
if ", non-fossil" in name:
|
|
70
|
+
return "non-fossil"
|
|
71
|
+
if ", fossil" in name or "from soil or biomass stock" in name:
|
|
72
|
+
return "fossil"
|
|
73
|
+
return None
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def classify_flow(node, options: Optional[CharacterizationOptions] = None) -> FlowClass:
|
|
77
|
+
"""Species and origin of a biosphere flow, for the ``"ar6"`` default functions."""
|
|
78
|
+
options = options or CharacterizationOptions()
|
|
79
|
+
name = (node.get("name") or "").strip()
|
|
80
|
+
origin = origin_from_name(name)
|
|
81
|
+
cas = normalize_cas(node.get("CAS number"))
|
|
82
|
+
|
|
83
|
+
if cas is not None:
|
|
84
|
+
species = SPECIES_BY_CAS.get(cas, cas)
|
|
85
|
+
else:
|
|
86
|
+
species = SPECIES_BY_NAME.get(name.lower())
|
|
87
|
+
|
|
88
|
+
if species == "CO2" and is_co2_uptake(node):
|
|
89
|
+
species = "CO2 uptake"
|
|
90
|
+
|
|
91
|
+
override = options.override_for(node)
|
|
92
|
+
if override:
|
|
93
|
+
species = override.get("species", species)
|
|
94
|
+
if species is not None and species not in _NAMED_SPECIES:
|
|
95
|
+
species = normalize_cas(species) or species
|
|
96
|
+
origin = override.get("origin", origin)
|
|
97
|
+
return FlowClass(species, origin)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def function_for(
|
|
101
|
+
flow_class: FlowClass,
|
|
102
|
+
options: CharacterizationOptions,
|
|
103
|
+
flow_label: str = "",
|
|
104
|
+
prospective: bool = False,
|
|
105
|
+
) -> Optional[Callable]:
|
|
106
|
+
"""
|
|
107
|
+
The ``"ar6"`` characterization function for a classified flow, or None.
|
|
108
|
+
|
|
109
|
+
With ``prospective=True`` the function follows the scenario of ``prospective.set_scenario``
|
|
110
|
+
(see ``ar6_prospective``): CO2 terms use the scenario CO2 response, CH4 and N2O the
|
|
111
|
+
scenario radiative efficiencies.
|
|
112
|
+
"""
|
|
113
|
+
ccf = ar6_core.ccf_parameters(options.ccf_parameters) if options.climate_carbon_feedback else None
|
|
114
|
+
precursor_ccf = ccf if options.precursor_ccf else None
|
|
115
|
+
species, origin = flow_class
|
|
116
|
+
|
|
117
|
+
if species is None:
|
|
118
|
+
return None
|
|
119
|
+
method = options.prospective_method
|
|
120
|
+
if species == "CO2":
|
|
121
|
+
return ar6_prospective.co2_function(method) if prospective else characterize_co2_ar6
|
|
122
|
+
if species == "CO2 uptake":
|
|
123
|
+
return ar6_prospective.co2_function(method, uptake=True) if prospective else characterize_co2_uptake_ar6
|
|
124
|
+
if prospective and method == "watanabe2026" and species in ("CH4", "N2O"):
|
|
125
|
+
if species == "CH4" and origin is None:
|
|
126
|
+
logger.warning(
|
|
127
|
+
"Flow {!r} does not state a fossil or non-fossil origin; the Watanabe & Cherubini "
|
|
128
|
+
"(2026) CH4 metric does not distinguish them.",
|
|
129
|
+
flow_label,
|
|
130
|
+
)
|
|
131
|
+
return ar6_prospective.paper_function(species)
|
|
132
|
+
if species == "CH4":
|
|
133
|
+
if origin is None:
|
|
134
|
+
origin = options.unspecified_origin
|
|
135
|
+
logger.warning(
|
|
136
|
+
"Flow {!r} does not state a fossil or non-fossil origin; treated as {} CH4 "
|
|
137
|
+
"(set 'unspecified_origin' or 'flow_overrides' to change this).",
|
|
138
|
+
flow_label,
|
|
139
|
+
origin,
|
|
140
|
+
)
|
|
141
|
+
ch4_options = dict(
|
|
142
|
+
origin=origin,
|
|
143
|
+
biogenic_oxidation_co2=options.biogenic_oxidation_co2,
|
|
144
|
+
oxidation_yield=options.ch4_oxidation_yield,
|
|
145
|
+
ccf=ccf,
|
|
146
|
+
)
|
|
147
|
+
if prospective:
|
|
148
|
+
return ar6_prospective.make_prospective_function(
|
|
149
|
+
ar6_prospective.Recipe(kind="CH4", method="ar6", options=tuple(sorted(ch4_options.items())))
|
|
150
|
+
)
|
|
151
|
+
spec = gases.ch4(**ch4_options)
|
|
152
|
+
elif species == "N2O":
|
|
153
|
+
if prospective:
|
|
154
|
+
return ar6_prospective.make_prospective_function(
|
|
155
|
+
ar6_prospective.Recipe(kind="N2O", method="ar6", options=(("ccf", ccf),))
|
|
156
|
+
)
|
|
157
|
+
spec = gases.n2o(ccf=ccf)
|
|
158
|
+
elif species == "CO":
|
|
159
|
+
if "CO" in options.include_precursors:
|
|
160
|
+
if origin is None:
|
|
161
|
+
origin = options.unspecified_origin
|
|
162
|
+
spec = gases.co(
|
|
163
|
+
origin=origin,
|
|
164
|
+
parameter_set=options.precursor_parameter_set("CO"),
|
|
165
|
+
biogenic_oxidation_co2="explicit" if options.biogenic_oxidation_co2 == "explicit" else "neutral",
|
|
166
|
+
ccf=precursor_ccf,
|
|
167
|
+
)
|
|
168
|
+
else:
|
|
169
|
+
spec = gases.co_oxidation()
|
|
170
|
+
elif species == "VOC":
|
|
171
|
+
if "VOC" not in options.include_precursors:
|
|
172
|
+
return None
|
|
173
|
+
spec = gases.voc(options.precursor_parameter_set("VOC"), ccf=precursor_ccf)
|
|
174
|
+
elif species == "H2":
|
|
175
|
+
if "H2" not in options.include_precursors:
|
|
176
|
+
return None
|
|
177
|
+
spec = gases.h2(options.precursor_parameter_set("H2"), ccf=precursor_ccf)
|
|
178
|
+
elif species in ("NO", "NO2", "NOx"):
|
|
179
|
+
if not options.include_nox:
|
|
180
|
+
return None
|
|
181
|
+
spec = gases.nox(
|
|
182
|
+
emitted_as="NO" if species == "NO" else "NO2",
|
|
183
|
+
parameter_set=options.precursor_parameter_set("NOx"),
|
|
184
|
+
nitrate=options.nox_nitrate,
|
|
185
|
+
nitrate_parameter_set=options.precursor_parameter_set("nitrate"),
|
|
186
|
+
ccf=precursor_ccf,
|
|
187
|
+
)
|
|
188
|
+
else:
|
|
189
|
+
spec = gases.halocarbon(species, ccf=ccf)
|
|
190
|
+
if spec is None:
|
|
191
|
+
return None
|
|
192
|
+
if prospective:
|
|
193
|
+
return ar6_prospective.fixed(spec, method=method)
|
|
194
|
+
return make_characterization_function(spec)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
SCENARIO_SPECIES = ("CO2", "CO2 uptake", "CH4", "N2O")
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def build_functions(
|
|
201
|
+
nodes: Iterable,
|
|
202
|
+
options: CharacterizationOptions,
|
|
203
|
+
characterize_uptake: bool = True,
|
|
204
|
+
prospective: bool = False,
|
|
205
|
+
fallback_to_ipcc: bool = True,
|
|
206
|
+
) -> Dict[int, Callable]:
|
|
207
|
+
"""
|
|
208
|
+
``{node.id: function}`` for all nodes that have an ``"ar6"`` characterization function.
|
|
209
|
+
|
|
210
|
+
With ``prospective=True`` the functions follow the prospective scenario; with
|
|
211
|
+
``fallback_to_ipcc=False`` only the gases with scenario data (CO2, CH4, N2O) are included.
|
|
212
|
+
"""
|
|
213
|
+
functions = {}
|
|
214
|
+
for node in nodes:
|
|
215
|
+
flow_class = classify_flow(node, options)
|
|
216
|
+
if flow_class.species == "CO2 uptake" and not characterize_uptake:
|
|
217
|
+
continue
|
|
218
|
+
if prospective and not fallback_to_ipcc and flow_class.species not in SCENARIO_SPECIES:
|
|
219
|
+
continue
|
|
220
|
+
label = f"{node.get('name')} {tuple(node.get('categories') or ())}"
|
|
221
|
+
func = function_for(flow_class, options, flow_label=label, prospective=prospective)
|
|
222
|
+
if func is not None:
|
|
223
|
+
functions[node.id] = func
|
|
224
|
+
return functions
|