Skip to content

Exact reproduction of WG3 database #798

Exact reproduction of WG3 database

Exact reproduction of WG3 database #798

Workflow file for this run

name: Exact reproduction of WG3 database
# Note: CICERO not included because of a fix that has since been made to its heat uptake,
# see https://github.com/openscm/openscm-runner/pull/89
on:
# Uncomment these two lines for debugging, but leave them commented on 'main'
pull_request:
branches: [ main ]
push:
branches: [ main ]
schedule:
# 05:00 UTC = 06:00 CET = 07:00 CEST
- cron: "0 5 * * *"
jobs:
fair:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install poetry
shell: bash
run: |
pipx install poetry
which poetry
poetry --version # Check poetry installation
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: poetry
- name: Install test dependencies and package
shell: bash
run: |
poetry install --no-interaction --all-extras --only 'main,tests'
- name: Get infiller database
env:
SCENARIO_EXPLORER_USER: ${{ secrets.SCENARIO_EXPLORER_USER }}
SCENARIO_EXPLORER_PASSWORD: ${{ secrets.SCENARIO_EXPLORER_PASSWORD }}
INFILLER_DATABASE_NAME: "1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv"
INFILLER_DATABASE_DIR: "data"
INFILLER_HASH: "30fae0530d76cbcb144f134e9ed0051f"
run:
poetry run python -c 'import os.path; from climate_assessment.testing import _get_infiller_download_link, _file_available_or_downloaded; infiller_link = _get_infiller_download_link(os.environ.get("INFILLER_DATABASE_NAME")); _file_available_or_downloaded(os.path.join(os.environ.get("INFILLER_DATABASE_DIR"), os.environ.get("INFILLER_DATABASE_NAME")), os.environ.get("INFILLER_HASH"), infiller_link)'
- name: Test with pytest
# scenario explorer stuff needed here too so we don't skip the run with
# pytest
env:
SCENARIO_EXPLORER_USER: ${{ secrets.SCENARIO_EXPLORER_USER }}
SCENARIO_EXPLORER_PASSWORD: ${{ secrets.SCENARIO_EXPLORER_PASSWORD }}
run: |
# Uncomment notebooks for now, need to think a bit more what the right approach is there
# pytest notebooks/run-example-fair.ipynb -r a --nbval-lax --no-cov
poetry run pytest tests/nightly/test_wg3_reproduction_fair.py -m wg3 -r a -vv
magicc:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install poetry
shell: bash
run: |
pipx install poetry
which poetry
poetry --version # Check poetry installation
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: poetry
- name: Install test dependencies and package
shell: bash
run: |
poetry install --no-interaction --all-extras --only 'main,tests'
- name: Get infiller database
env:
SCENARIO_EXPLORER_USER: ${{ secrets.SCENARIO_EXPLORER_USER }}
SCENARIO_EXPLORER_PASSWORD: ${{ secrets.SCENARIO_EXPLORER_PASSWORD }}
INFILLER_DATABASE_NAME: "1652361598937-ar6_emissions_vetted_infillerdatabase_10.5281-zenodo.6390768.csv"
INFILLER_DATABASE_DIR: "data"
INFILLER_HASH: "30fae0530d76cbcb144f134e9ed0051f"
run:
poetry run python -c 'import os.path; from climate_assessment.testing import _get_infiller_download_link, _file_available_or_downloaded; infiller_link = _get_infiller_download_link(os.environ.get("INFILLER_DATABASE_NAME")); _file_available_or_downloaded(os.path.join(os.environ.get("INFILLER_DATABASE_DIR"), os.environ.get("INFILLER_DATABASE_NAME")), os.environ.get("INFILLER_HASH"), infiller_link)'
- name: Download MAGICC
env:
MAGICC_RUN_DIR: bin/magicc/magicc-v7.5.3/run/
run: |
mkdir -p bin/magicc/magicc-v7.5.3
wget -O "bin/magicc/magicc-v7.5.3.tar.gz" "${{ secrets.MAGICC_LINK_FROM_MAGICC_DOT_ORG }}"
tar -xf bin/magicc/magicc-v7.5.3.tar.gz -C bin/magicc/magicc-v7.5.3
mkdir -p data/magicc-drawnsets
wget -O "data/magicc-drawnsets/magicc-ar6-0fd0f62-f023edb-drawnset.tar.gz" "${{ secrets.MAGICC_PROB_DISTRIBUTION_LINK_FROM_MAGICC_DOT_ORG }}"
tar -xf "data/magicc-drawnsets/magicc-ar6-0fd0f62-f023edb-drawnset.tar.gz" -C data/magicc-drawnsets
- name: Test with pytest
# scenario explorer stuff needed here too so we don't skip the run with
# pytest
env:
SCENARIO_EXPLORER_USER: ${{ secrets.SCENARIO_EXPLORER_USER }}
SCENARIO_EXPLORER_PASSWORD: ${{ secrets.SCENARIO_EXPLORER_PASSWORD }}
MAGICC_EXECUTABLE_7: /home/runner/work/climate-assessment/climate-assessment/bin/magicc/magicc-v7.5.3/bin/magicc
MAGICC_LINK_FROM_MAGICC_DOT_ORG: ${{ secrets.MAGICC_LINK_FROM_MAGICC_DOT_ORG }}
MAGICC_PROB_DISTRIBUTION_LINK_FROM_MAGICC_DOT_ORG: ${{ secrets.MAGICC_PROB_DISTRIBUTION_LINK_FROM_MAGICC_DOT_ORG }}
MAGICC_WORKER_NUMBER: 4
MAGICC_WORKER_ROOT_DIR: /tmp
MAGICC_PROBABILISTIC_FILE: data/magicc-drawnsets/0fd0f62-derived-metrics-id-f023edb-drawnset.json
run: |
# Uncomment notebooks for now, need to think a bit more what the right approach is there
# pytest notebooks/run-example-magicc.ipynb -r a --nbval-lax --no-cov
poetry run pytest tests/nightly/test_wg3_reproduction_magicc.py -m wg3 -r a -vv