diff --git a/.gitattributes b/.gitattributes index da7013811d..c0edca59f4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,6 @@ # Reduce the number of merge conflicts doc/whatsnew.rst merge=union +# Git LFS +*.csv.gz filter=lfs diff=lfs merge=lfs -text +*.xlsx filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 0b577ec6a8..f0be667003 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -17,12 +17,16 @@ jobs: with: # If the "Latest version testable on GitHub Actions" in pytest.yaml # is not the latest 3.x stable version, adjust here to match: - python-version: "3.10" + # python-version: "3.x" + # NB pint is normally implied by iam-units, but we force an earlier + # version to work around https://github.com/hgrecco/pint/issues/1767 type-hint-packages: >- genno iam-units + "pint < 0.21" pytest sdmx1 types-PyYAML + types-tqdm "ixmp @ git+https://github.com/iiasa/ixmp.git@main" "message-ix @ git+https://github.com/iiasa/message_ix.git@main" diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 1d578b4566..ca77b0ae16 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -22,15 +22,16 @@ jobs: # These should match the versions used in the "pytest" workflows of both # ixmp and message_ix. version: - - { os: macos-latest, python: "3.10" } - - { os: ubuntu-latest, python: "3.10" } - - { os: windows-latest, python: "3.10" } + - { os: macos-latest, python: "3.11" } + - { os: ubuntu-latest, python: "3.11" } + - { os: windows-latest, python: "3.11" } # Versions of both ixmp and message_ix to use upstream-version: # Temporarily disabled (iiasa/ixmp#477) # - v3.4.0 # Minimum version given in setup.cfg # - v3.5.0 - # - v3.6.0 # Latest released version + # - v3.6.0 + - v3.7.0 # Latest released version - main # Development version fail-fast: false @@ -39,6 +40,12 @@ jobs: name: ${{ matrix.version.os }}-py${{ matrix.version.python }}-upstream-${{ matrix.upstream-version }} steps: + - name: Cache test data + uses: actions/cache@v3 + with: + path: message-local-data + key: ${{ matrix.version.os }} + - name: Check out message-ix-models uses: actions/checkout@v3 with: @@ -62,12 +69,20 @@ jobs: pip install --upgrade "message-ix @ git+https://github.com/iiasa/message_ix.git@${{ matrix.upstream-version }}" pip install .[tests] + - name: Configure local data path + run: | + mkdir -p message-local-data/cache + mix-models config set "message local data" "$(realpath message-local-data)" + mix-models config show + shell: bash + - name: Run test suite using pytest run: | pytest message_ix_models \ -rA --verbose --color=yes --durations=20 \ --cov-report=term-missing --cov-report=xml \ - --numprocesses=auto + --numprocesses=auto \ + --local-cache --jvmargs="-Xmx6G" shell: bash - name: Test documentation build using Sphinx diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000000..9ec83e970d --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +prune message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline diff --git a/doc/api/model-snapshot.rst b/doc/api/model-snapshot.rst new file mode 100644 index 0000000000..9efcb4ee54 --- /dev/null +++ b/doc/api/model-snapshot.rst @@ -0,0 +1,35 @@ +.. currentmodule:: message_ix_models.model.snapshot + +Load MESSAGEix-GLOBIOM snapshots (:mod:`.model.snapshot`) +********************************************************* + +This code allows to fetch *snapshots* containing completely parametrized MESSAGEix-GLOBIOM model instances, and load these into :class:`Scenarios `. + +Usage +===== + +From the command line, download data for a single snapshot:: + + $ mix-models snapshot fetch 0 + +…where :program:`0` is the ID of a snapshot; see :data:`.SNAPSHOTS`. + +In code, use :func:`.snapshot.load`: + +.. code-block:: python + + from message_ix import Scenario + from message_ix_models.model import snapshot + + scenario = Scenario(...) + + snapshot.load(scenario, 0) + +.. note:: For snapshot 0, contrary to the `description of the Zenodo item `__, the file cannot be loaded using :meth:`.Scenario.read_excel`. + This limitation will be fixed in subsequent snapshots. + +Code reference +============== + +.. automodule:: message_ix_models.model.snapshot + :members: diff --git a/doc/api/util.rst b/doc/api/util.rst index bfab7c2af7..5e681ba775 100644 --- a/doc/api/util.rst +++ b/doc/api/util.rst @@ -12,6 +12,8 @@ Submodules: context importlib _logging + node + pooch scenarioinfo Commonly used: @@ -169,6 +171,15 @@ Commonly used: :members: :exclude-members: identify_nodes +:mod:`.util.pooch` +================== + +.. currentmodule:: message_ix_models.util.pooch + +.. automodule:: message_ix_models.util.pooch + :members: + + :mod:`.util.scenarioinfo` ========================= diff --git a/doc/conf.py b/doc/conf.py index 28fcff634f..f0cd7fcd5e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -98,6 +98,7 @@ def setup(app: "sphinx.application.Sphinx") -> None: None, ), "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), + "pooch": ("https://www.fatiando.org/pooch/latest/", None), "pytest": ("https://docs.pytest.org/en/stable/", None), "python": ("https://docs.python.org/3/", None), "sdmx": ("https://sdmx1.readthedocs.io/en/stable/", None), diff --git a/doc/index.rst b/doc/index.rst index 5dcafa8f55..58b23ddeb1 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -32,6 +32,7 @@ Among other tasks, the tools allow modelers to: api/model-bare api/model-build api/model-emissions + api/model-snapshot api/disutility api/project api/tools diff --git a/doc/water/index.rst b/doc/water/index.rst index 1b966904fb..2de4ed9b69 100644 --- a/doc/water/index.rst +++ b/doc/water/index.rst @@ -11,7 +11,7 @@ This work extends the water sector linkage described by Parkinson et al. (2019) CLI usage ========= -Use the :doc:`CLI ` command ``mix-data water`` to invoke the commands defined in :mod:`.water.cli`. Example: +Use the :doc:`CLI ` command ``mix-data water`` to invoke the commands defined in :mod:`.water.cli`. Example: ``mix-models --url=ixmp://ixmp_dev/ENGAGE_SSP2_v4.1.7/baseline_clone_test water cooling`` model and scenario specifications can be either set manually in ``cli.py`` or specified in the ``--url`` option diff --git a/doc/whatsnew.rst b/doc/whatsnew.rst index fbe5ecec13..88af26e3b8 100644 --- a/doc/whatsnew.rst +++ b/doc/whatsnew.rst @@ -1,8 +1,21 @@ What's new ********** -.. Next release -.. ============ +Next release +============ + +- Add code and CLI commands to :doc:`fetch and load MESSAGEix-GLOBIOM snapshots ` (:pull:`102`). +- Add :func:`.util.pooch.fetch`, a thin wrapper for using :doc:`Pooch ` (:pull:`102`). + +v2023.5.31 +========== + +- Adjust :mod:`sdmx` usage for version 2.10.0 (:pull:`101`). + +v2023.5.13 +========== + +- Adjust :func:`.generate_product` for pandas 2.0.0 (:pull:`98`). 2023.4.2 ======== diff --git a/message_ix_models/cli.py b/message_ix_models/cli.py index 4df15abfce..fc5f0162a0 100644 --- a/message_ix_models/cli.py +++ b/message_ix_models/cli.py @@ -18,6 +18,7 @@ from pathlib import Path import click +from ixmp.cli import main as ixmp_cli from message_ix_models.util._logging import mark_time from message_ix_models.util._logging import setup as setup_logging @@ -101,11 +102,16 @@ def debug(ctx): log.debug(ctx.local_data) +# Attach the ixmp "config" CLI +main.add_command(ixmp_cli.commands["config"]) + + #: List of submodules providing CLI (sub)commands accessible through `mix-models`. #: Each of these should contain a function named ``cli`` decorated with @click.command #: or @click.group. submodules = [ "message_ix_models.model.cli", + "message_ix_models.model.snapshot", "message_ix_models.model.structure", "message_ix_models.model.water.cli", ] diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/MERtoPPP.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/MERtoPPP.csv.gz new file mode 100644 index 0000000000..5d5ec457be --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/MERtoPPP.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd62eb8a67066d6efb686c26dafcf7e29370e43aefc070431c59f57b9cd74b12 +size 1205 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/abs_cost_activity_soft_lo.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/abs_cost_activity_soft_lo.csv.gz new file mode 100644 index 0000000000..924b2cdc8e --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/abs_cost_activity_soft_lo.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e99bfd431f367015bd3a4a090b66afe6d311413a73b821355eeed60a2218715b +size 26590 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/abs_cost_activity_soft_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/abs_cost_activity_soft_up.csv.gz new file mode 100644 index 0000000000..b3cabaa974 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/abs_cost_activity_soft_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68c8f6ef11e9a67d7c25a8bdc97ed06083975ed40baee00f0c1fbff421d71425 +size 27664 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/aeei.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/aeei.csv.gz new file mode 100644 index 0000000000..09196a47e1 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/aeei.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1ba002f82f34a895c39f446ad2d1540cea9ef83179b39b0f822d40dd1ed049f +size 14331 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_activity_lo.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_activity_lo.csv.gz new file mode 100644 index 0000000000..65c86a2010 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_activity_lo.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47ae034fe962a403e435042abecd31adc7a4dfd7919da3680a5e8b3d38aea5a7 +size 110572 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_activity_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_activity_up.csv.gz new file mode 100644 index 0000000000..dc9756aaf8 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_activity_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c10e716d6f6091fcf0c4b5ce3b5bf9728d5ff12b8061d9ec14362449e40b28d8 +size 121094 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_extraction_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_extraction_up.csv.gz new file mode 100644 index 0000000000..51c3d908cb --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_extraction_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f51a9d057afe87e99ac102bdb3e56539e41c89f9e37680c132cc351d77d70ac3 +size 1060 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_new_capacity_lo.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_new_capacity_lo.csv.gz new file mode 100644 index 0000000000..3a9b2b5858 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_new_capacity_lo.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6776daaa61575906e68e76bb05af3008b53c7f2ef42248b926d62582ce09b01c +size 5560 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_new_capacity_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_new_capacity_up.csv.gz new file mode 100644 index 0000000000..5325129258 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_new_capacity_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af815ab1a48aa420e03ce9ebee03e7a38fa20cc69f1e2548f2b648483500a425 +size 11121 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_total_capacity_lo.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_total_capacity_lo.csv.gz new file mode 100644 index 0000000000..3a896f0bc7 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_total_capacity_lo.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba3583bded4396db6e0e613981c82c64d85d29527c3942b373e3a47fea080ce5 +size 508 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_total_capacity_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_total_capacity_up.csv.gz new file mode 100644 index 0000000000..dd63a21d5b --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/bound_total_capacity_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c85db9596bf058c032e65400e6ecbfe4e3f2adf34cbaff623bd6cead8bb37c2 +size 185 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/capacity_factor.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/capacity_factor.csv.gz new file mode 100644 index 0000000000..a049f59478 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/capacity_factor.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2312cdbaee4b5cfd6533b0421e668490e5a21d20fe3ae7ab4a7c76b432de4932 +size 762396 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/construction_time.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/construction_time.csv.gz new file mode 100644 index 0000000000..7ffd932384 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/construction_time.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75b3012a84f24c4ecc20826cc92d06af3b5ffbd283506bab7c5c83594062cf48 +size 50927 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/cost_MESSAGE.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/cost_MESSAGE.csv.gz new file mode 100644 index 0000000000..4a4db68428 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/cost_MESSAGE.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:78edffff5cb63618bf032ce929f67f3d5d93f41b1ecee7d05ed0402e6e706700 +size 2632 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/demand.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/demand.csv.gz new file mode 100644 index 0000000000..45f7b16176 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/demand.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d88d17cd6ce852e6048926367921b86fe1ed4f9405b7e75b9cca1b231cb1592b +size 14404 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/demand_MESSAGE.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/demand_MESSAGE.csv.gz new file mode 100644 index 0000000000..5067cdd9ab --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/demand_MESSAGE.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a089f54156ea2fb8c63f0d804cebd3201cf9ca4a07821b561cf827b3b0091e4 +size 8505 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/depr.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/depr.csv.gz new file mode 100644 index 0000000000..5183536b8e --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/depr.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6458ce460b20e86769b13b70ece8611c17967613038af8ee762df64fb5616c0d +size 138 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/drate.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/drate.csv.gz new file mode 100644 index 0000000000..2b446f49a9 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/drate.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cff83cd80c120239e086a9dfbecddd85421241aac6abe8f0b18c3a2506d07f2a +size 139 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/duration_period.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/duration_period.csv.gz new file mode 100644 index 0000000000..6537c5766c --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/duration_period.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f2665df71d1816e7e031a57b46de89042fe261518447a028ad89a1ad9d4342fd +size 184 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/duration_time.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/duration_time.csv.gz new file mode 100644 index 0000000000..2f08f4d7be --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/duration_time.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59c33f45022540019d47946d42154353d2f8cea582ec0d4236399ca5616e6a15 +size 72 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/dynamic_land_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/dynamic_land_up.csv.gz new file mode 100644 index 0000000000..af814cba02 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/dynamic_land_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7780139998b084f4a9a0d8d304a7f5c55515a9b8333c28ea462584b45d6018b +size 90163 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/emission_factor.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/emission_factor.csv.gz new file mode 100644 index 0000000000..affc6b8d55 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/emission_factor.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48d0c3d075d495196ea2a428313fe1e79a5c7cd6cfd99c80da49c63b3b6f3c50 +size 16597 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/esub.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/esub.csv.gz new file mode 100644 index 0000000000..76c8103637 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/esub.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00d58275a275b926aa8d556c28efcaab40f3eb4b617199ef9e568b9a766f40c7 +size 142 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/fix_cost.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/fix_cost.csv.gz new file mode 100644 index 0000000000..298d6d9800 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/fix_cost.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a49a54e61230d8c0dfee24cc5abbd8d945a7ec8ae600d78de0bea10e87e9b5b6 +size 376341 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/gdp_calibrate.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/gdp_calibrate.csv.gz new file mode 100644 index 0000000000..77ab9cdedd --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/gdp_calibrate.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73346f69628edcd980cc9e6d25a8ef9e517a961e2dceb7c507f24757df4ac7ce +size 1662 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/grow.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/grow.csv.gz new file mode 100644 index 0000000000..1e911ff16a --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/grow.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ea856fcabc59b5063c97a5f5df74164baa3370f060b9f958a8e486d95806467 +size 2332 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_activity_lo.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_activity_lo.csv.gz new file mode 100644 index 0000000000..a2ee331434 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_activity_lo.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f2c3a348de99df54ba71f68cb08cffafda79901461a1da68af55b676e0fad285 +size 68959 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_activity_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_activity_up.csv.gz new file mode 100644 index 0000000000..3e74f83a6d --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_activity_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f7889575d676a906ef4261855daa46ec53610a4bac9f93611fd6b26573705b89 +size 107713 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_land_scen_lo.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_land_scen_lo.csv.gz new file mode 100644 index 0000000000..0d24f53d62 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_land_scen_lo.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:440686b6de7d73ff07c302945ff7fb95c1212af4a4a68a84c6207f43ed817585 +size 47014 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_land_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_land_up.csv.gz new file mode 100644 index 0000000000..46827a9ba8 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_land_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b60d75b12687c635f55cfd4c22d216a00dd035e2310c14262738087752d75ca8 +size 1418 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_new_capacity_lo.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_new_capacity_lo.csv.gz new file mode 100644 index 0000000000..e3793191b0 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_new_capacity_lo.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b51f686f3499d1aa990f6e3911d8e142d44f99a689677ca270b28b1b716e939 +size 770 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_new_capacity_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_new_capacity_up.csv.gz new file mode 100644 index 0000000000..cef4352e6d --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/growth_new_capacity_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b60a5e3d11870b8710d44bef08e3e925da151410251ec9d405afe8ea19cd92c2 +size 21678 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_activity.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_activity.csv.gz new file mode 100644 index 0000000000..364cd9222f --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_activity.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2f1279de34ac9d3063dc14f215d271e67c7a4866adf2faedfcd9cb685ce5b2a +size 158850 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_extraction.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_extraction.csv.gz new file mode 100644 index 0000000000..3bd616da14 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_extraction.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b82a305392856f4b17ea260aafdc29642ddd075afbbfc07f0f57f0fcdf711a32 +size 9655 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_gdp.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_gdp.csv.gz new file mode 100644 index 0000000000..d85bfdb397 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_gdp.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c325198440102ef0d48c601b04533886df5acef338e50822e3d78537f27c9a8 +size 228 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_land.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_land.csv.gz new file mode 100644 index 0000000000..0acd9bda55 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_land.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e540b4bfcb727a4114167f5d1e434eb3dabf0b152fc2599ebde3df2ad0237c51 +size 4851 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_new_capacity.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_new_capacity.csv.gz new file mode 100644 index 0000000000..cbab5b369c --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/historical_new_capacity.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f69bca88c67ee86e25751ebdcc9c32f34705f7ea2795b68c0255bb3e524b73d7 +size 62066 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/initial_activity_lo.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/initial_activity_lo.csv.gz new file mode 100644 index 0000000000..245db51227 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/initial_activity_lo.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8fd2d91d4f6b3cd8605280ac74556429aceddcda0ed3cfb141f714dc3f3d7720 +size 77611 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/initial_activity_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/initial_activity_up.csv.gz new file mode 100644 index 0000000000..e1a05b0f47 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/initial_activity_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6af0149a5f14b805d515c73992ca0612ff50152528e6092ad8e1399b8377dc7c +size 114008 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/initial_new_capacity_lo.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/initial_new_capacity_lo.csv.gz new file mode 100644 index 0000000000..bdf5d0a292 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/initial_new_capacity_lo.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b7dfcf6ef26f150b0379be553c3c2ead78e408bd65b571f56890375bbc6dbfe +size 726 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/initial_new_capacity_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/initial_new_capacity_up.csv.gz new file mode 100644 index 0000000000..5e592ef9c1 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/initial_new_capacity_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec8b5ee41dd12e48140ccf584a2bb0149939b1b774b39ed4dc7d14773018aa41 +size 20121 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/input.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/input.csv.gz new file mode 100644 index 0000000000..e11d06c68e --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/input.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a28563e1646a31446f07ab1096fc4e4dd65525eda099377485b14bdd1461aae2 +size 599921 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/interestrate.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/interestrate.csv.gz new file mode 100644 index 0000000000..4f73c01fc8 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/interestrate.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbb557a3550e3cbb21ffd575cd5121b577209d446fd5a114ef809f93a033835d +size 186 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/inv_cost.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/inv_cost.csv.gz new file mode 100644 index 0000000000..f7caaf6e56 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/inv_cost.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:edd46b835db7733173eea0d0100ea9319df56a1193ff710e17924077f5e0bd52 +size 214855 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/kgdp.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/kgdp.csv.gz new file mode 100644 index 0000000000..e9db9526d3 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/kgdp.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1f4e159e12f94c3f702f541fccf0cc8296b98bf2b36c548d825d26fe5200de2 +size 142 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/kpvs.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/kpvs.csv.gz new file mode 100644 index 0000000000..90ec4b615b --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/kpvs.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b9f4574ba93d223511a368ddec158a8181826bce277d95d089e646bd8feb256 +size 141 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/lakl.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/lakl.csv.gz new file mode 100644 index 0000000000..4162ead6f0 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/lakl.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a727a89276f3abdb1f7563ee6e70aab545224587eae033a6d88b715d7da11c7 +size 250 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/land_cost.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/land_cost.csv.gz new file mode 100644 index 0000000000..ad2b573cc0 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/land_cost.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a0a8ec7234fc0fa95236be03bbc4aea26170d4daf34cb8bc9ac0a59521f7b0d9 +size 142107 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/land_emission.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/land_emission.csv.gz new file mode 100644 index 0000000000..7bc3a04555 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/land_emission.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4994b1652b1084a49f68b397e76abbedbcd87cbbfefa67cba75e315e96c3701e +size 3587152 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/land_output.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/land_output.csv.gz new file mode 100644 index 0000000000..5f99094086 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/land_output.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a215baffbf7916a090bb1950f670a020e2933a64fb61bb1a5dbfe04e80a80d4e +size 12172514 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/land_use.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/land_use.csv.gz new file mode 100644 index 0000000000..7e2d8a9ccf --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/land_use.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:877aa402beb4e689bd12a4f0e5d0962bec298bc5742f8208f551050925b1a6a5 +size 368018 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/level_cost_activity_soft_lo.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/level_cost_activity_soft_lo.csv.gz new file mode 100644 index 0000000000..7559b3ee29 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/level_cost_activity_soft_lo.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9fe175e9ae9fe571b24354afc8e9e42eff8626a32b08daa617c7c7795fe73574 +size 67854 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/level_cost_activity_soft_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/level_cost_activity_soft_up.csv.gz new file mode 100644 index 0000000000..3d779d5d85 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/level_cost_activity_soft_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:217e29a761fb685466b970ab424218b59d8da4d111eff15601f61c5a1ce5640d +size 67854 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/level_cost_new_capacity_soft_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/level_cost_new_capacity_soft_up.csv.gz new file mode 100644 index 0000000000..f751e55af1 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/level_cost_new_capacity_soft_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bfd780d6548be5664a3243164908da36df48ce1f6d9cb9b304e6f5e69eb39c99 +size 2148 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/lotol.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/lotol.csv.gz new file mode 100644 index 0000000000..c6c7785f07 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/lotol.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36736697db6976cdcbd9a84d7f574404b50a4f5420ea55954b123f15e5dc398d +size 107 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/output.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/output.csv.gz new file mode 100644 index 0000000000..a8ce028a02 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/output.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0ea187c40219deadfc73fa31dec03dcae471ba01724da317cd336c122a370f6 +size 511192 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/prfconst.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/prfconst.csv.gz new file mode 100644 index 0000000000..f7efaaf711 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/prfconst.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21b2062ab9ac730c34b23c58128176462f1f1723cbdd9376371c885639fc4b19 +size 1049 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/price_MESSAGE.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/price_MESSAGE.csv.gz new file mode 100644 index 0000000000..8060b62bf0 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/price_MESSAGE.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e65fa94205048dcb14386e3a761aa61a41cb5e9b7b233ad35a09cfa80d506b04 +size 13095 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_activity.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_activity.csv.gz new file mode 100644 index 0000000000..857f8202a3 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_activity.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b316e77501bb92b8d66300906d511541ba1f43e92ac7ba23072517869178448f +size 1939604 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_lower.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_lower.csv.gz new file mode 100644 index 0000000000..9227f158ec --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_lower.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbed27baa5f32c4166f773ff0143d5edc1366e832000b3eb153d332eadf34caa +size 55632 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_new_capacity.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_new_capacity.csv.gz new file mode 100644 index 0000000000..4eee9a6c92 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_new_capacity.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3275fa51e928e074969a9ba9865c4f53c091ea3c7187e47159b3c8f7769603cd +size 829 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_total_capacity.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_total_capacity.csv.gz new file mode 100644 index 0000000000..c6a9421042 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_total_capacity.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c47b01b8b4c32f50a55bc3f9aba5c68859a2b6b4b0d79dd4166c6766a3e2dee7 +size 38485 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_upper.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_upper.csv.gz new file mode 100644 index 0000000000..0197251bee --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/relation_upper.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dff4ed1cbed405d55ecb4ade0225d11b94dbbdc57b8763afb25f414338be3060 +size 77061 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/resource_cost.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/resource_cost.csv.gz new file mode 100644 index 0000000000..ec91b2bab8 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/resource_cost.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22a3aafcf0dc006bd1b6f456ec4fb4901ca440caf88d6b75d84d51162e5c9aab +size 15195 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/resource_remaining.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/resource_remaining.csv.gz new file mode 100644 index 0000000000..0ec5eb3032 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/resource_remaining.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:399f8e93aaad3345db31dc02811c41b8803f249d8b0572d30b615313b5aa80c8 +size 6290 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/resource_volume.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/resource_volume.csv.gz new file mode 100644 index 0000000000..5bb4549407 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/resource_volume.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0b8e5201fae1d8e232060826e3016ec0972dd0d3105ce6d36b5d757f9d59b4b +size 2337 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/sets.xlsx b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/sets.xlsx new file mode 100644 index 0000000000..960df70f18 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/sets.xlsx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4bc8da22f37936456e7d0ab1585708fd3a284d42580da0362c5305c2b8afafd5 +size 49845 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/soft_activity_lo.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/soft_activity_lo.csv.gz new file mode 100644 index 0000000000..3734da4d18 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/soft_activity_lo.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2b96da2cfb7b1421a08514021bebfc541b60c79895db5dc46a05819c0f1fafa +size 80615 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/soft_activity_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/soft_activity_up.csv.gz new file mode 100644 index 0000000000..16e4ed1a4d --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/soft_activity_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98feb601aec9a816190999da88386e3eada3fde037dff2c8dbbd5570e46bb1c0 +size 81162 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/soft_new_capacity_up.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/soft_new_capacity_up.csv.gz new file mode 100644 index 0000000000..e43b85ea36 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/soft_new_capacity_up.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:89538e5f7b30b682517daf44cc3c3f67b85844c8faad78ce446bc27a223e154a +size 2114 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/technical_lifetime.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/technical_lifetime.csv.gz new file mode 100644 index 0000000000..d539ffd1d5 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/technical_lifetime.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48548ca339ccb76ac46b40b2c61fed124c98f1cebfb9b171fea86de242449490 +size 95763 diff --git a/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/var_cost.csv.gz b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/var_cost.csv.gz new file mode 100644 index 0000000000..1868875609 --- /dev/null +++ b/message_ix_models/data/test/MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline/var_cost.csv.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6ff79e43d1080e83897f147a95040928836884553ee218c2c1577d0caa360910 +size 157343 diff --git a/message_ix_models/data/unit/snapshot.yaml b/message_ix_models/data/unit/snapshot.yaml new file mode 100644 index 0000000000..de3bf9c150 --- /dev/null +++ b/message_ix_models/data/unit/snapshot.yaml @@ -0,0 +1,145 @@ +# All units appearing in snapshot 0 + +"???/yr": {} +"['???', 'GWa']": {} +"%": {} +"billion industrial GDP/yr": {} +"billion population/yr": {} +"billion USD_2005": {} +"billion USD_2005/billion industrial GDP/yr": {} +"billion USD_2005/yr": {} +"EJ_final": {} +"EJ_primary": {} +"EJ/yr": {} +"GW/yr": {} +"GWa": {} +"GWyr": {} +"GWyr/kt CH4/yr": {} +"GWyr/Mt C/yr": {} +"GWyr/yr": {} +"Index (2005 = 1)": {} +"kcal/cap/day": {} +"kg/capita/day": {} +"km3": {} +"kt BC/???/yr": {} +"kt BC/GWyr/yr": {} +"kt BC/kg/capita/day": {} +"kt BC/Mt C/yr": {} +"kt BC/yr": {} +"kt BC/yr": {} +"kt CF4-equiv./yr": {} +"kt CF4/GWyr/yr": {} +"kt CF4/kt CF4-equiv./yr": {} +"kt CF4/Mt CF4-equiv./yr": {} +"kt CF4/Mt CF4/yr": {} +"kt CF4/yr": {} +"kt CH4/GWyr/yr": {} +"kt CH4/kg/capita/day": {} +"kt CH4/million population/yr": {} +"kt CH4/million urban population/yr": {} +"kt CH4/Mt CH4/yr": {} +"kt CH4/yr": {} +"kt CO/???/yr": {} +"kt CO/GWyr/yr": {} +"kt CO/kg/capita/day": {} +"kt CO/Mt C/yr": {} +"kt CO/yr": {} +"kt HFC-134a-equiv./billion population/yr": {} +"kt HFC-134a-equiv./GWyr/yr": {} +"kt HFC-134a-equiv./Mt HFC-134a-equiv./yr": {} +"kt HFC-134a-equiv./yr": {} +"kt N2O/billion industrial GDP/yr": {} +"kt N2O/GWyr/yr": {} +"kt N2O/million population/yr": {} +"kt N2O/Mt N2O/yr": {} +"kt N2O/yr": {} +"kt NH3/???/yr": {} +"kt NH3/GWyr/yr": {} +"kt NH3/Mt C/yr": {} +"kt NH3/yr": {} +"kt NOx/???/yr": {} +"kt NOx/GWyr/yr": {} +"kt NOx/kg/capita/day": {} +"kt NOx/Mt C/yr": {} +"kt NOx/yr": {} +"kt OC/???/yr": {} +"kt OC/GWyr/yr": {} +"kt OC/kg/capita/day": {} +"kt OC/Mt C/yr": {} +"kt OC/yr": {} +"kt PM2/kg/capita/day": {} +"kt PM2/yr": {} +"kt SF6/GWyr/yr": {} +"kt SF6/Mt SF6/yr": {} +"kt SF6/yr": {} +"kt SO2/???/yr": {} +"kt SO2/GWyr/yr": {} +"kt SO2/kg/capita/day": {} +"kt SO2/Mt C/yr": {} +"kt SO2/yr": {} +"kt VOC/???/yr": {} +"kt VOC/GWyr/yr": {} +"kt VOC/kg/capita/day": {} +"kt VOC/Mt C/yr": {} +"kt VOC/yr": {} +"Mha": {} +"million ha": {} +"million m3/yr": {} +"million population/billion population/yr": {} +"million population/million urban population/yr": {} +"million population/yr": {} +"million t DM/yr": {} +"million urban population/yr": {} +"million": {} +"Mm3": {} +"Mt C-equiv./Mt CF4-equiv./yr": {} +"Mt C-equiv./Mt CH4/yr": {} +"Mt C-equiv./Mt HFC-134a-equiv./yr": {} +"Mt C-equiv./Mt N2O/yr": {} +"Mt C-equiv./Mt SF6/yr": {} +"Mt C-equiv./yr": {} +"Mt C/GWyr/yr": {} +"Mt C/Mt C-equiv./yr": {} +"Mt C/Mt CH4/yr": {} +"Mt C/yr": {} +"Mt CF4-equiv./yr": {} +"Mt CF4/yr": {} +"Mt CH4/yr": {} +"Mt CO2/yr": {} +"Mt HFC-134a-equiv./yr": {} +"Mt N2O/yr": {} +"Mt SF6/yr": {} +"MtCO2eq/year": {} +"t DM/ha/yr": {} +"t/yr": {} +"tCO2/ha": {} +"Tg N/yr": {} +"Tg P/yr": {} +"trillion USD_2005": {} +"unit": {} +"US$2005/GJ": {} +"US$2005/t CO2": {} +"USD_2005/(t /yr)": {} +"USD_2005/(t /yr)/yr": {} +"USD_2005/(t C/yr)": {} +"USD_2005/(t CF4/yr)": {} +"USD_2005/(t CH4/yr)": {} +"USD_2005/(t HFC-134a-equiv./yr)": {} +"USD_2005/(t N2O/yr)": {} +"USD_2005/(t SF6/yr)": {} +"USD_2005/kW": {} +"USD_2005/kW/yr": {} +"USD_2005/kWyr": {} +"USD_2005/t /yr": {} +"USD_2005/t C": {} +"USD_2005/t CF4": {} +"USD_2005/t CH4": {} +"USD_2005/t HFC-134a-equiv.": {} +"USD_2005/t N2O": {} +"USD_2005/t SF6": {} +"USD_2005/t": {} +"USD_2005/t/yr": {} +"USD": {} +"USD2000_GJprim": {} +"USD2000_tCO2eq": {} +"yr": {} diff --git a/message_ix_models/data/water/infrastructure/desalination.xlsx b/message_ix_models/data/water/infrastructure/desalination.xlsx index f9a66106ae..d99f886381 100644 Binary files a/message_ix_models/data/water/infrastructure/desalination.xlsx and b/message_ix_models/data/water/infrastructure/desalination.xlsx differ diff --git a/message_ix_models/data/water/infrastructure/extraction_techs.xlsx b/message_ix_models/data/water/infrastructure/extraction_techs.xlsx index 0cc9c6b5b3..144a7c891f 100644 Binary files a/message_ix_models/data/water/infrastructure/extraction_techs.xlsx and b/message_ix_models/data/water/infrastructure/extraction_techs.xlsx differ diff --git a/message_ix_models/data/water/infrastructure/water_distribution.xlsx b/message_ix_models/data/water/infrastructure/water_distribution.xlsx index db1320b267..8a11f6a4a3 100644 Binary files a/message_ix_models/data/water/infrastructure/water_distribution.xlsx and b/message_ix_models/data/water/infrastructure/water_distribution.xlsx differ diff --git a/message_ix_models/data/water/ppl_cooling_tech/power_plant_cooling_impact_MESSAGE.xlsx b/message_ix_models/data/water/ppl_cooling_tech/power_plant_cooling_impact_MESSAGE.xlsx index fa74610792..82d53f9a7a 100644 Binary files a/message_ix_models/data/water/ppl_cooling_tech/power_plant_cooling_impact_MESSAGE.xlsx and b/message_ix_models/data/water/ppl_cooling_tech/power_plant_cooling_impact_MESSAGE.xlsx differ diff --git a/message_ix_models/model/disutility.py b/message_ix_models/model/disutility.py index 0df01d5ba9..bd4089a0f5 100644 --- a/message_ix_models/model/disutility.py +++ b/message_ix_models/model/disutility.py @@ -1,5 +1,6 @@ import logging from collections import defaultdict +from copy import copy from functools import partial from itertools import product from typing import List, Mapping, MutableMapping, Sequence, Union @@ -94,7 +95,7 @@ def get_spec( Annotation(id="input", text=repr(input)), Annotation(id="output", text=repr(output)), ] - + [a.copy() for a in other_anno], + + [copy(a) for a in other_anno], ) # "commodity" set elements to add diff --git a/message_ix_models/model/snapshot.py b/message_ix_models/model/snapshot.py new file mode 100644 index 0000000000..17b9402afa --- /dev/null +++ b/message_ix_models/model/snapshot.py @@ -0,0 +1,137 @@ +"""Prepare base models from snapshot data.""" +import logging +from pathlib import Path + +import click +import pandas as pd +from message_ix import Scenario +from message_ix.models import MACRO +from tqdm import tqdm + +from message_ix_models import Spec +from message_ix_models.util.pooch import fetch + +from .build import apply_spec +from .structure import get_codes + +log = logging.getLogger(__name__) + +#: Available snapshots. +SNAPSHOTS = { + 0: dict( + base_url="doi:10.5281/zenodo.5793870", + registry={ + "MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline.xlsx": ( + "md5:222193405c25c3c29cc21cbae5e035f4" + ), + }, + ) +} + + +def unpack(path: Path) -> Path: + """Unpack :ref:`ixmp-format Excel file ` at `path`. + + The file is unpacked into a directory with the same name stem as the file (that is, + without the :file:`.xlsx` suffix). In this directory are created: + + - One :file:`.csv.gz` file for each MESSAGE and/or MACRO parameter. + - One file :file:`sets.xlsx` with only the :mod:`ixmp` sets, and no parameter data. + + If the files exist, they are not updated. + To force re-unpacking, delete the files. + + Returns + ------- + Path + Path to the directory containing the unpacked files. + """ + assert path.suffix == ".xlsx" + base = path.with_suffix("") + base.mkdir(exist_ok=True) + + # Get item name -> ixmp type mapping as a pd.Series + xf = pd.ExcelFile(path, engine="openpyxl") + name_type = xf.parse("ix_type_mapping") + + # Copied exactly from ixmp.backend.io + def parse_item_sheets(name): + """Read data for item *name*, possibly across multiple sheets.""" + dfs = [xf.parse(name)] + + # Collect data from repeated sheets due to max_row limit + for x in filter(lambda n: n.startswith(name + "("), xf.sheet_names): + dfs.append(xf.parse(x)) # pragma: no cover + + # Concatenate once and return + return pd.concat(dfs, axis=0) + + sets_path = base.joinpath("sets.xlsx") + sets_path.unlink(missing_ok=True) + + with pd.ExcelWriter(sets_path, engine="openpyxl") as ew: + for _, (name, ix_type) in tqdm(name_type.iterrows()): + item_path = base.joinpath(f"{name}.csv.gz") + if item_path.exists(): + continue + + df = parse_item_sheets(name) + + if ix_type == "set": + df.to_excel(ew, sheet_name=name, index=False) + else: # pragma: no cover + df.to_csv(item_path, index=False) + + name_type.query("ix_type == 'set'").to_excel(ew, sheet_name="ix_type_mapping") + + return base + + +def read_excel(scenario: Scenario, path: Path) -> None: + """Similar to :meth:`.Scenario.read_excel`, but using :func:`unpack`.""" + base = unpack(path) + + scenario.read_excel(base.joinpath("sets.xlsx")) + with scenario.transact(f"Read snapshot from {path}"): + for p in base.glob("*.csv.gz"): + name = p.name.split(".")[0] + data = pd.read_csv(p) + + # Correct units + if name == "inv_cost": + data.replace({"unit": {"USD_2005/t ": "USD_2005/t"}}, inplace=True) + + scenario.add_par(name, data) + + +def load(scenario: Scenario, snapshot_id: int) -> None: + """Fetch and load snapshot with ID `snapshot_id` into `scenario`. + + See also + -------- + SNAPSHOTS + """ + path = fetch(SNAPSHOTS[snapshot_id]) + + # Add units + spec = Spec() + spec.add.set["unit"] = get_codes("unit/snapshot") + apply_spec(scenario, spec) + + # Initialize MACRO items + with scenario.transact("Prepare scenario for snapshot data"): + MACRO.initialize(scenario) + + read_excel(scenario, path) + + +@click.group("snapshot", help="__doc__") +def cli(): # pragma: no cover + pass + + +@cli.command("fetch") +@click.argument("id_", metavar="ID", type=int) +def fetch_cmd(id_): # pragma: no cover + """Fetch snapshot ID from Zenodo.""" + fetch(SNAPSHOTS[id_], progressbar=True) diff --git a/message_ix_models/model/structure.py b/message_ix_models/model/structure.py index 3668df67d4..a603b2dac6 100644 --- a/message_ix_models/model/structure.py +++ b/message_ix_models/model/structure.py @@ -1,6 +1,7 @@ import logging import re from collections import ChainMap +from copy import copy from functools import lru_cache from itertools import product from typing import Dict, List, Mapping, MutableMapping, Tuple @@ -142,14 +143,14 @@ def _base(dim, match): # Iterate over the product of filtered codes for each dimension in for item in product(*[_base(*dm) for dm in dims.items()]): - result = template.copy() # Duplicate the template + result = copy(template) # Duplicate the template fmt = dict(zip(dims.keys(), item)) # Format the ID and name result.id = result.id.format(**fmt) result.name = str(result.name).format(**fmt) # type: ignore [assignment] codes.append(result) # Store code and indices - indices.append(item) + indices.append(tuple(map(str, item))) # - Convert length-N sequence of D-tuples to D iterables each of length N. # - Convert to D × 1-dimensional xr.DataArrays, each of length N. @@ -262,7 +263,7 @@ def process_units_anno(set_name: str, code: Code, quiet: bool = False) -> None: # Also annotate child codes for c in code.child: - c.annotations.append(units_anno.copy()) + c.annotations.append(copy(units_anno)) def process_commodity_codes(codes): diff --git a/message_ix_models/testing.py b/message_ix_models/testing.py index e1f20a48ff..2874661393 100644 --- a/message_ix_models/testing.py +++ b/message_ix_models/testing.py @@ -387,6 +387,9 @@ def export_test_data(context: Context): #: not implemented. NIE = pytest.mark.xfail(raises=NotImplementedError) +#: :data:`True` if tests occur on GitHub Actions. +GHA = "GITHUB_ACTIONS" in os.environ + def not_ci(reason=None, action="skip"): """Mark a test as xfail or skipif if on CI infrastructure. @@ -394,6 +397,4 @@ def not_ci(reason=None, action="skip"): Checks the ``GITHUB_ACTIONS`` environment variable; returns a pytest mark. """ action = "skipif" if action == "skip" else action - return getattr(pytest.mark, action)( - condition="GITHUB_ACTIONS" in os.environ, reason=reason - ) + return getattr(pytest.mark, action)(condition=GHA, reason=reason) diff --git a/message_ix_models/tests/model/test_snapshot.py b/message_ix_models/tests/model/test_snapshot.py new file mode 100644 index 0000000000..337f48fbe3 --- /dev/null +++ b/message_ix_models/tests/model/test_snapshot.py @@ -0,0 +1,46 @@ +import logging +import shutil +import sys + +import pytest +from message_ix import Scenario + +from message_ix_models.model import snapshot +from message_ix_models.testing import GHA +from message_ix_models.util import package_data_path + +log = logging.getLogger(__name__) + + +@pytest.fixture +def unpacked_snapshot_data(test_context, request): + """Already-unpacked data for a snapshot. + + This copies the .csv.gz files from message_ix_models/tests/data/… to the directory + where they *would* be unpacked by .model.snapshot._unpack. This causes the code to + skip unpacking them, which can be very slow. + """ + snapshot_id = request.getfixturevalue("snapshot_id") + assert 0 == snapshot_id, f"No unpacked data for snapshot {snapshot_id}" + + dest = test_context.get_cache_path("MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline") + log.debug(f"{dest = }") + + snapshot_data_path = package_data_path( + "test", "MESSAGEix-GLOBIOM_1.1_R11_no-policy_baseline" + ) + log.debug(f"{snapshot_data_path = }") + + shutil.copytree(snapshot_data_path, dest, dirs_exist_ok=True) + + +@pytest.mark.skipif( + condition=GHA and sys.platform in ("darwin", "win32"), reason="Slow." +) +@pytest.mark.usefixtures("unpacked_snapshot_data") +@pytest.mark.parametrize("snapshot_id", snapshot.SNAPSHOTS.keys()) +def test_load(test_context, snapshot_id): + mp = test_context.get_platform() + base = Scenario(mp, model="MODEL", scenario="baseline", version="new") + + snapshot.load(base, snapshot_id) diff --git a/message_ix_models/tests/test_util.py b/message_ix_models/tests/test_util.py index b7ae040659..8043341a60 100644 --- a/message_ix_models/tests/test_util.py +++ b/message_ix_models/tests/test_util.py @@ -154,7 +154,10 @@ def test_convert_units(recwarn): # With store="quantity", a series of pint.Quantity is returned result = convert_units(*args, store="quantity") - assert all(np.isclose(a, b, atol=1e-4) for a, b in zip(exp.values, result.values)) + assert all( + np.isclose(a, b, atol=1e-4 * registry.kg) + for a, b in zip(exp.values, result.values) + ) # With store="magnitude", a series of floats exp = pd.Series([q.magnitude for q in exp.values], name="bar") diff --git a/message_ix_models/tests/util/test_context.py b/message_ix_models/tests/util/test_context.py index 4958da1c87..8eeaeb3c7d 100644 --- a/message_ix_models/tests/util/test_context.py +++ b/message_ix_models/tests/util/test_context.py @@ -111,9 +111,13 @@ def test_deepcopy(self, session_context): def test_get_cache_path(self, pytestconfig, test_context): """cache_path() returns the expected output.""" # One of two values depending on whether the user has given --local-cache - assert test_context.get_cache_path("pytest", "bar.pkl") in ( - test_context.local_data.joinpath("cache", "pytest", "bar.pkl"), - Path(pytestconfig.cache.makedir("cache")).joinpath("pytest", "bar.pkl"), + assert ( + test_context.get_cache_path("pytest", "bar.pkl") + in ( + test_context.local_data.joinpath("cache", "pytest", "bar.pkl"), + Path(pytestconfig.cache.makedir("cache")).joinpath("pytest", "bar.pkl"), + ) + or pytestconfig.option.local_cache ) def test_get_local_path(self, tmp_path_factory, session_context): diff --git a/message_ix_models/util/pooch.py b/message_ix_models/util/pooch.py new file mode 100644 index 0000000000..4117f92e98 --- /dev/null +++ b/message_ix_models/util/pooch.py @@ -0,0 +1,45 @@ +"""Utilities for using :doc:`Pooch `.""" +import logging +from pathlib import Path + +import pooch + +from .context import Context + +log = logging.getLogger(__name__) + + +def fetch(args, **kwargs) -> Path: + """Create a :class:`~pooch.Pooch` instance and fetch a single file. + + Files are stored under the directory identified by :meth:`.Context.get_cache_path`, + unless `args` provides another location. + + Parameters + ---------- + args + Passed to :func:`pooch.create`. + kwargs + Passed to :meth:`pooch.Pooch.fetch`. + + Returns + ------- + Path + Path to the fetched file. + + See also + -------- + :func:`.snapshot.load` + """ + args.setdefault("path", Context.get_instance(-1).get_cache_path()) + + p = pooch.create(**args) + + if len(p.registry) > 1: # pragma: no cover + raise NotImplementedError("fetch() with registries with >1 files") + + path = Path(p.fetch(next(iter(p.registry.keys())), **kwargs)) + + log.info(f"Fetched {path}") + + return path diff --git a/pyproject.toml b/pyproject.toml index 25a911df87..eefff7b84f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,7 @@ classifiers = [ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: R", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Information Analysis" @@ -38,10 +39,12 @@ dependencies = [ "genno >= 1.8.0", "iam_units", "message_ix >= 3.4.0", + "pooch", "pyam-iamc >= 0.6", "pycountry", "PyYAML", "sdmx1 >= 2.8.0", + "tqdm", ] [project.urls] @@ -79,6 +82,7 @@ exclude = ["doc/"] module = [ "colorama", "message_data.*", + "pooch", "pycountry", # Indirectly via message_ix # This should be a subset of the list in message_ix's pyproject.toml