Python
Installation¶
While the Python package has not been released yet, you have to install it from GitHub source using:
# when using poetry
poetry add git+https://github.com:PhilippVerpoort/scenario-vetting-criteria.git
# when using pip
pip install git+https://github.com:PhilippVerpoort/scenario-vetting-criteria.git
Raw file paths¶
The package contains definition files for the criteria. The paths to those files are contained in file_paths.
from scenario_vetting_criteria import file_paths
for component_id, component_path in file_paths.items():
print(f"{component_id}: ...{str(component_path)[-40:]}")
operations: ...io_vetting_criteria/data/operations.yaml criteria-thresholds: ...ng_criteria/data/criteria-thresholds.csv criteria-types: ...etting_criteria/data/criteria-types.yaml sources: ...enario_vetting_criteria/data/sources.bib criteria-metadata: ...ing_criteria/data/criteria-metadata.yaml
Load functions¶
Instead of loading the data from these files manually, it is recommended to use the built-in load functions from the package via load_criteria. For instance, the following will load the definition of the thresholds values.
from scenario_vetting_criteria import load_criteria
load_criteria('criteria-thresholds')
| criterion | region | year | variable | reference_data | unit | level_of_concern | lower | upper | |
|---|---|---|---|---|---|---|---|---|---|
| 0 | hist_pop | World | 2010, 2015, 2020, 2025 | Population | range(WDI-2025, WDI-2025-extrapol25, WDI-2025-... | dimensionless | strong | 0.75 | 1.25 |
| 1 | hist_pop | All Countries | 2010, 2015, 2020, 2025 | Population | range(WDI-2025, WDI-2025-extrapol25, WDI-2025-... | dimensionless | strong | 0.65 | 1.35 |
| 2 | hist_gdp | World | 2010, 2015, 2020, 2025 | GDP|PPP | range(WDI-2025, WDI-2025-extrapol25, WDI-2025-... | dimensionless | strong | 0.75 | 1.25 |
| 3 | hist_gdp | All Countries | 2010, 2015, 2020, 2025 | GDP|PPP | range(WDI-2025, WDI-2025-extrapol25, WDI-2025-... | dimensionless | strong | 0.65 | 1.35 |
| 4 | hist_emi_afolu | World | 2010, 2015, 2020 | Emissions|CO2|AFOLU | range(EDGAR-2024, FAO-2025, PRIMAP-2020-HISTCR... | dimensionless | strong | 0.80 | 1.20 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 91 | sustainable_deforestation | World | 2030 | Forest Area Change|Deforestation | NaN | million ha/yr | medium | NaN | 0.00 |
| 92 | sustainable_primary_deforestation | World | 2030 | Forest Area Change|Deforestation|Primary | NaN | million ha/yr | medium | NaN | 0.00 |
| 93 | sustainable_biodiversity_intactness | World | 2030 | Terrestrial Biodiversity|BII, Terrestrial Biod... | NaN | %/yr | medium | NaN | 0.00 |
| 94 | sustainable_bioenergy | World | 2025, 2030, 2035, 2040, 2045, 2050 | Primary Energy|Biomass | NaN | EJ/yr | strong | NaN | 100.00 |
| 95 | sustainable_hydropower | World | 2050 | Capacity|Electricity|Hydro | NaN | GW | strong | NaN | 1500.00 |
96 rows × 9 columns
Multiple files can be loaded in one go.
criteria = load_criteria(['criteria-thresholds', 'operations'])
display(criteria['operations'])
[{'criterion_type': 'historical',
'level_of_concern': 'strong',
'threshold_type': ['upper', 'lower'],
'operation': 'drop'},
{'criterion_id': 'nearterm_land_cover',
'level_of_concern': 'strong',
'threshold_type': ['upper', 'lower'],
'operation': 'drop'},
{'criterion_type': 'near_term_feasibility',
'level_of_concern': 'strong',
'threshold_type': ['upper', 'lower'],
'operation': 'flag',
'colour': 'red'},
{'criterion_type': 'near_term_feasibility',
'level_of_concern': 'medium',
'threshold_type': ['upper', 'lower'],
'operation': 'flag',
'colour': 'yellow'},
{'criterion_type': 'long_term_feasibility',
'level_of_concern': 'strong',
'threshold_type': ['upper', 'lower'],
'operation': 'flag',
'colour': 'red'},
{'criterion_type': 'long_term_feasibility',
'level_of_concern': 'medium',
'threshold_type': ['upper', 'lower'],
'operation': 'flag',
'colour': 'yellow'},
{'criterion_type': 'sustainability',
'level_of_concern': 'strong',
'threshold_type': ['upper', 'lower'],
'operation': 'flag',
'colour': 'purple'}]
Formatting citations and sources¶
Loading the reference sources from the BibTeX file will return a pybtex object.
sources = load_criteria('sources')
The entries in this object can be formatted according to some predefined style.
from scenario_vetting_criteria.formatting import format_sources
sources_formatted = format_sources(sources)
display(sources_formatted['Creutzig-2014'])
{'cite_auth': 'Creutzig',
'cite_year': '2014',
'cite': 'Creutzig (2014)',
'citep': '(Creutzig, 2014)',
'bib': 'Felix Creutzig, N. H. Ravindranath, Göran Berndes, Simon Bolwig, Ryan Bright, Francesco Cherubini, Helena Chum, Esteve Corbera, Mark Delucchi, Andre Faaij, Joseph Fargione, Helmut Haberl, Garvin Heath, Oswaldo Lucon, Richard Plevin, Alexander Popp, Carmenza Robledo?Abad, Steven Rose, Pete Smith, Anders Stromman, Sangwon Suh, and Omar Masera. Bioenergy and climate change mitigation: an assessment. GCB Bioenergy, 7(5):916–944, July 2014. doi:10.1111/gcbb.12205.',
'doi': '10.1111/gcbb.12205',
'link': 'https://doi.org/10.1111/gcbb.12205'}
The insert_citations function can be used to insert citations into text with citation patterns.
from scenario_vetting_criteria.formatting import insert_citations
text = load_criteria('criteria-metadata')['sustainable_bioenergy']['justification_threshold']
text_inserted = insert_citations(text, sources_formatted)
print(text[:30], '... → ', text_inserted[:30], '...')
{{cite:Creutzig-2014}} have de ... → Creutzig (2014) have derived a ...
Apply vetting criteria to scenarios¶
A tutorial on how to apply the vetting criteria to a list of scenarios based on the IAMC Nomenclature package will be made available later.