Compute fair national emissions allocations using transparent, reproducible workflows. Designed by researchers for researchers.
- Introduction
- Installation Instructions
- Obtaining Input Data
- Usage Overview
- Developer Instructions
- Referencing this Repository
This package combines a variety of data sources to compute fair national emissions allocations, study variability, and compare results with NDC estimates and cost-optimal scenario projections.
- Gather country-level data (population, GDP, historical emissions, etc.)
- Compute global future emission pathways based on configurable scenarios
- Calculate allocations for countries/regions using various effort-sharing rules
- Compare allocations, NDCs, and cost-optimal scenarios
- Conduct variance decomposition (Sobol analysis)
If you want to use some of the existing functionality, simply install from PyPI:
pip install effort-sharingIf you plan to develop the code or modify notebooks/scripts, install from source (see Developer Instructions).
We're working to provide input data directly or via original sources. For now, contact mailto:mark.dekker@pbl.nl for quick access.
Run step-by-step workflows using the CLI:
effortsharing --help
effortsharing generate-config
effortsharing get-input-data
effortsharing global-pathways
effortsharing policy-scenarios
effortsharing allocate NLD
effortsharing aggregate 2040
# You can also overwrite defaults
effortsharing allocate NLD --config config.yml --log-level WARNING --gas CO2 --lulucf excl
# Or ask for help to see all options:
effortsharing aggregate --helpThe CLI lets you quickly run complete workflows or focus on specific countries/years.
Automate workflows using scripts in the scripts folder.
Example: scripts/cabe_export.py loads data, calculates pathways/allocations, aggregates results, and exports everything.
Edit parameters at the top of the script, then run with:
python scripts/cabe_export.pyScripts are not included in the PyPI package.
Import high-level and low-level functions in Python or Jupyter notebooks for custom analysis and visualization.
The internal structure of the effortsharing package is documented in apidocs.md. While unpolished, it may serve as a starting point when diving into the internals of the code.
See the notebooks folder for examples.
Note: Notebooks may be outdated as the package evolves, but dedicated releases ensure reproducibility for published results.
Many commands require a configuration file.
Generate a default config:
effortsharing generate-configThe config file controls:
- Data paths
- Whether to load/save intermediate results
- Experiment parameters
- Dimension ranges for pathway parameters (shorter ranges = faster runs, but less variability)
See comments in the generated config for details.
If you plan to contribute, please follow these guidelines and respect the code of conduct.
Clone the repo and set up a (conda) environment:
git clone https://github.com/imagepbl/effort-sharing
cd effort-sharing
conda env create --file environment.yml
conda activate effortsharing_env
conda env update -f environment.ymlFor reproducibility, use the conda-lock file:
conda-lock lock
conda-lock install --name effortsharing_env
pip install -e .[dev] # conda-lock doesn't install local librariesWe use ruff for linting and formatting.
Configuration is in pyproject.toml.
ruff check src
ruff check --fix src
ruff format srcVS Code users: install the ruff plugin for in-editor feedback.
API docs are generated from docstrings using pydoc-markdown:
uvx pydoc-markdown -I src --render-toc > apidocs.mdA test script is included to quickly check if / how the results have been affected since a previous run. Use it as such:
pytest -v --confcutdir=$PWD/scripts/compare_dirs \
scripts/compare_dirs/test.py \
--reference-dir data/reference \
--current-dir data/current \
--atol 1e-9 --rtol 1e-5where you replace the paths to reference and current with actual folders you want to compare.
We release at least when publishing new results (e.g. journal, Carbon Budget Explorer). To generate a new release, open a new issue using the release template and follow the steps in the checklist.
If you use this code in your work, please cite it using the following reference:
Dekker, M., Würschinger, C., Kalverla, P., & Verhoeven, S. Effort sharing [Computer software]. https://github.com/imagepbl/effort-sharing