Skip to content

Commit 236c878

Browse files
authored
Merge pull request #289 from iiasa/transport/2025-w05
Transport improvements from 2025-W05
2 parents 0475c81 + 9a38ac2 commit 236c878

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1299
-638
lines changed

.github/workflows/pytest.yaml

+1-6
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ jobs:
7575
# - Latest supported Python version for those or other dependencies.
7676
# Minimum version given in pyproject.toml + earlier version of Python
7777
# For this job only, the oldest version of Python supported by message-ix-models
78-
- { upstream: v3.6.0, python: "3.9" } # Released 2022-08-18
79-
- { upstream: v3.7.0, python: "3.11" } # 2023-05-17
78+
- { upstream: v3.7.0, python: "3.9" } # Released 2023-05-17
8079
- { upstream: v3.8.0, python: "3.12" } # 2024-01-12
8180
# Latest released version + latest released Python
8281
- { upstream: v3.9.0, python: "3.13" } # 2024-06-04
@@ -86,7 +85,6 @@ jobs:
8685
exclude:
8786
# Specific version combinations that are invalid / not to be used
8887
# These versions of ixmp are not able locate the arm64 GAMS API binaries
89-
- { os: macos-latest, version: { upstream: v3.6.0 }}
9088
- { os: macos-latest, version: { upstream: v3.7.0 }}
9189
- { os: macos-latest, version: { upstream: v3.8.0 }}
9290
- { os: macos-latest, version: { upstream: v3.9.0 }}
@@ -133,9 +131,6 @@ jobs:
133131
134132
v, result = "${{ matrix.version.upstream }}".replace("main", "vmain"), []
135133
for condition, dependency in (
136-
(v <= "v3.6.0", "dask < 2024.3.0"), # dask[dataframe] >= 2024.3.0 requires dask-expr and in turn pandas >= 2.0 (#156)
137-
(v <= "v3.6.0", "numpy < 2.0"),
138-
(v <= "v3.6.0", "pandas < 2.0"),
139134
(v >= "v3.7.0", "dask[dataframe] < 2024.11.0"), # dask >= 2024.11.0 changes handling of dict (will be addressed in #225)
140135
(v <= "v3.7.0", "genno < 1.25"), # Upstream versions < 3.8.0 import genno.computations, removed in 1.25.0 (#156)
141136
(v < "v3.9.0", "pytest == 8.0.0"), # Upstream versions < 3.9.0 use a hook argument removed in pytest 8.1.0 (#155)

.github/workflows/transport.yaml

+57-20
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,46 @@ env:
77
target-workflow: transport
88

99
# Starting point of the workflow.
10+
#
1011
# Use this value to build from a certain scenario:
1112
# base: --url="ixmp://ixmp-dev/MESSAGEix-GLOBIOM 1.1-R12/baseline_DEFAULT#21"
13+
#
1214
# Use this value to allow the workflow to determine model & scenario names
1315
# and versions:
1416
base: --platform=ixmp-dev
1517

16-
# Set this to a particular step to truncate the workflow
18+
# Set this to a particular step to truncate the workflow.
1719
from-step: ""
1820

21+
# Workflow steps/labels to run. These correspond to the 'TARGET' argument to
22+
# 'mix-models transport run'. Each label triggers 1 job in the target-repo/
23+
# target-workflow.
24+
#
25+
# - Delete lines to disable some runs.
26+
# - Ensure there is NO trailing comma on the last line.
27+
labels: >-
28+
[
29+
"SSP1",
30+
"SSP1 policy",
31+
"SSP2",
32+
"SSP2 policy",
33+
"SSP3",
34+
"SSP3 policy",
35+
"SSP4",
36+
"SSP4 policy",
37+
"SSP5",
38+
"SSP5 policy",
39+
"EDITS-CA",
40+
"EDITS-HA",
41+
"LED-SSP1",
42+
"LED-SSP2"
43+
]
44+
45+
# Currently disabled:
46+
# [
47+
#
48+
# ]
49+
1950
on:
2051
# Uncomment these lines for debugging, but leave them commented on 'main'
2152
# pull_request:
@@ -36,22 +67,28 @@ jobs:
3667
runs-on: ubuntu-latest
3768

3869
steps:
39-
- name: Invoke "${{ env.target-workflow }}" workflow in ${{ env.target-repo }}
40-
env:
41-
GH_TOKEN: ${{ secrets.MESSAGE_DATA_DISPATCH_TOKEN }}
42-
run: |
43-
gh workflow run \
44-
${{ env.target-workflow }}.yaml \
45-
--repo=${{ env.target-repo }} \
46-
--ref=${{ env.target-ref }} \
47-
--field ref=${{ github.ref }} \
48-
--field sha=${{ github.sha }} \
49-
--field base=${{ env.base }} \
50-
--field from-step=${{ env.from-step }}
51-
52-
sleep 5
53-
54-
gh run list \
55-
--workflow=${{ env.target-workflow.yaml }} --repo=${{ env.target-repo }} \
56-
--json url,status \
57-
--jq 'map(select(.status != "completed"))[0].url' >> $GITHUB_STEP_SUMMARY
70+
- name: Assemble JSON payload
71+
run: |
72+
echo '{
73+
"ref": "${{ github.ref }}",
74+
"sha": "${{ github.sha }}",
75+
"base": "${{ env.base }}",
76+
"from-step": "${{ env.from-step }}",
77+
"labels": ${{ env.labels }}
78+
}' | jq -r -c '.labels = (.labels | tostring)' | tee payload.json
79+
80+
- name: Invoke "${{ env.target-workflow }}" workflow in ${{ env.target-repo }}
81+
env:
82+
GH_TOKEN: ${{ secrets.MESSAGE_DATA_DISPATCH_TOKEN }}
83+
run: |
84+
cat payload.json | gh workflow run --json \
85+
${{ env.target-workflow }}.yaml \
86+
--repo=${{ env.target-repo }} \
87+
--ref=${{ env.target-ref }}
88+
89+
sleep 5
90+
91+
gh run list \
92+
--workflow=${{ env.target-workflow.yaml }} --repo=${{ env.target-repo }} \
93+
--json url,status \
94+
--jq 'map(select(.status != "completed"))[0].url' >>$GITHUB_STEP_SUMMARY

doc/api/report/index.rst

-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ Utilities
172172
.. autosummary::
173173

174174
add_replacements
175-
as_quantity
176175
collapse
177176
collapse_gwp_info
178177
copy_ts

doc/api/util.rst

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ Commonly used:
5454
private_data_path
5555
same_node
5656
same_time
57-
series_of_pint_quantity
5857
show_versions
5958

6059
.. automodule:: message_ix_models.util

doc/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
.. role:: underline
7676
7777
.. |c| replace:: :math:`c`
78+
.. |l| replace:: :math:`l`
7879
.. |n| replace:: :math:`n`
7980
.. |t| replace:: :math:`t`
8081
.. |y| replace:: :math:`y`

doc/transport/input.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ node = R12_SAS [2]_
204204
.. [2] A. Javaid, `message_data#180 (comment) <https://github.com/iiasa/message_data/issues/180#issuecomment-1941860412>`_.
205205
.. [3] A. Javaid, `message_data#538 (comment) <https://github.com/iiasa/message_data/issues/538#issuecomment-1934663340>`__.
206206
207+
.. _transport-pdt-cap-proj:
208+
207209
:file:`pdt-cap.csv` → ``P activity:scenario-n-t-y:exo``
208210
-------------------------------------------------------
209211

@@ -221,7 +223,6 @@ PDT per capita.
221223

222224
.. todo:: Transcribe the method into this document.
223225

224-
225226
:file:`pdt-cap-ref.csv` → ``pdt:n:capita+ref``
226227
----------------------------------------------
227228

doc/whatsnew.rst

+18-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ What's new
44
Next release
55
============
66

7-
- Support for :mod:`ixmp` and :mod:`message_ix` versions 3.4.x and 3.5.x is dropped in accordance with the :ref:`policy-upstream-versions` (:pull:`288`).
8-
The minimum version of both packages is 3.6.0.
7+
- Support for :mod:`ixmp` and :mod:`message_ix` versions 3.4, 3.5, and 3.6 is dropped in accordance with the :ref:`policy-upstream-versions` (:pull:`288`, :pull:`289`).
8+
The minimum version of both packages is 3.7.0.
99
- Update :class:`.IEA_EWEB` to support :py:`transform="B"` / :func:`.transform_B` (:issue:`230`, :pull:`259`).
1010
- Add :func:`.prepare_method_B` to :mod:`.ssp.transport` (:pull:`259`).
1111
- New utility :class:`.sdmx.AnnotationsMixIn` (:pull:`259`).
12+
- Drop obsolete :py:`series_of_pint_quantity()` (:pull:`289`).
1213

1314
By topic:
1415

@@ -19,13 +20,22 @@ By topic:
1920
Transport
2021
---------
2122

22-
Update :doc:`/transport/index` (:pull:`259`).
23+
Update :doc:`/transport/index` (:pull:`259`, :pull:`289`).
2324

2425
- Adjust constraints on :py:`t="conm_ar"`.
2526
- Recompute :attr:`.minimum_activity` for transport technologies.
26-
- Adjust freight activity, freight and passenger mode shares for some regions.
27+
- Improve freight representation:
28+
29+
- Adjust freight activity, freight and passenger mode shares for some regions.
30+
- Add dynamic constraints on activity of freight technologies.
31+
- Fix alignment of freight technology outputs with demand |l|.
32+
33+
- Implement LED override using exogenous passenger activity data from :ref:`transport-pdt-cap-proj`.
2734
- Drop :file:`base-scenario-url.json`; store base scenario URLs in :ref:`CL_TRANSPORT_SCENARIO`.
35+
- Generate SDMX-ML structural metadata, including data flow definitions, and SDMX-{CSV,ML} data outputs for certain reported quantities.
36+
- Expand use of fixed/shared keys from :mod:`.transport.key`.
2837
- Simplify and consolidate tests.
38+
- Improve :func:`.simulated_solution` to load ‘simulated’ solution data from file to reduce test durations.
2939

3040
Documentation
3141
-------------
@@ -49,6 +59,8 @@ Documentation
4959
:doc:`project/sparccle`, and
5060
:doc:`project/uptake` (:pull:`282`).
5161

62+
- New utility :class:`.sdmx.AnnotationsMixIn` (:pull:`259`).
63+
- Bug fix: adjust or guard some Python usage that was not compatible with Python 3.9—the earliest version supported by :mod:`message_ix_models` (:pull:`295`, :issue:`294`).
5264

5365
v2025.1.10
5466
==========
@@ -443,12 +455,12 @@ Earlier releases
443455
2021.7.27
444456
---------
445457

446-
- Improve caching using mod:`genno` v1.8.0 (:pull:`29`).
458+
- Improve caching using :mod:`genno` v1.8.0 (:pull:`29`).
447459

448460
2021.7.22
449461
---------
450462

451-
- Migrate utilities :func:`.cached`, :func:`.check_support`, :func:`.convert_units`, :func:`.maybe_query`, :func:`.series_of_pint_quantity` (:pull:`27`)
463+
- Migrate utilities :func:`.cached`, :func:`.check_support`, :func:`.convert_units`, :func:`.maybe_query`, :py:`series_of_pint_quantity()` (:pull:`27`)
452464
- Add :data:`.testing.NIE`.
453465
- Add the ``--jvmargs`` option to :command:`pytest` (see :func:`.pytest_addoption`).
454466
- Remove :py:`.Context.get_config_file()`, :py:`.get_path()`, :py:`.load_config()`, and :py:`.units`, all deprecated since 2021-02-28.

message_ix_models/data/sdmx/IIASA_ECE_CL_TRANSPORT_SCENARIO(1.0.0).xml

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<mes:Header>
44
<mes:ID>none</mes:ID>
55
<mes:Test>false</mes:Test>
6-
<mes:Prepared>2025-01-15T10:37:47.926181</mes:Prepared>
6+
<mes:Prepared>2025-02-20T10:44:16.460424</mes:Prepared>
77
<mes:Sender id="none"/>
8-
<mes:Source xml:lang="en">Generated by message_ix_models 2025.1.11.dev1+gabce19674.d20250113</mes:Source>
8+
<mes:Source xml:lang="en">Generated by message_ix_models 2025.1.11.dev97+gdf7a6cee.d20250211</mes:Source>
99
</mes:Header>
1010
<mes:Structures>
1111
<str:Codelists>
12-
<str:Codelist isExternalReference="none" isFinal="none" agencyID="IIASA_ECE" version="1.0.0" id="CL_TRANSPORT_SCENARIO" urn="urn:sdmx:org.sdmx.infomodel.codelist.Codelist=IIASA_ECE:CL_TRANSPORT_SCENARIO(1.0.0)">
12+
<str:Codelist isExternalReference="false" isFinal="false" agencyID="IIASA_ECE" version="1.0.0" id="CL_TRANSPORT_SCENARIO" urn="urn:sdmx:org.sdmx.infomodel.codelist.Codelist=IIASA_ECE:CL_TRANSPORT_SCENARIO(1.0.0)">
1313
<str:Code id="SSP1">
1414
<com:Annotations>
1515
<com:Annotation id="SSP-URN">
@@ -22,7 +22,7 @@
2222
<com:AnnotationText xml:lang="en">None</com:AnnotationText>
2323
</com:Annotation>
2424
<com:Annotation id="base-scenario-URL">
25-
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP1_v1.1/baseline_DEFAULT_step_13'</com:AnnotationText>
25+
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP1_v2.1/baseline_DEFAULT_step_13'</com:AnnotationText>
2626
</com:Annotation>
2727
</com:Annotations>
2828
</str:Code>
@@ -38,7 +38,7 @@
3838
<com:AnnotationText xml:lang="en">None</com:AnnotationText>
3939
</com:Annotation>
4040
<com:Annotation id="base-scenario-URL">
41-
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP2_v1.1/baseline_DEFAULT_step_13'</com:AnnotationText>
41+
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP2_v2.1/baseline_DEFAULT_step_13'</com:AnnotationText>
4242
</com:Annotation>
4343
</com:Annotations>
4444
</str:Code>
@@ -54,7 +54,7 @@
5454
<com:AnnotationText xml:lang="en">None</com:AnnotationText>
5555
</com:Annotation>
5656
<com:Annotation id="base-scenario-URL">
57-
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP3_v1.1/baseline_DEFAULT_step_13'</com:AnnotationText>
57+
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP3_v2.1/baseline_DEFAULT_step_13'</com:AnnotationText>
5858
</com:Annotation>
5959
</com:Annotations>
6060
</str:Code>
@@ -70,7 +70,7 @@
7070
<com:AnnotationText xml:lang="en">None</com:AnnotationText>
7171
</com:Annotation>
7272
<com:Annotation id="base-scenario-URL">
73-
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP4_v1.1/baseline_DEFAULT_step_13'</com:AnnotationText>
73+
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP4_v2.1/baseline_DEFAULT_step_13'</com:AnnotationText>
7474
</com:Annotation>
7575
</com:Annotations>
7676
</str:Code>
@@ -86,7 +86,7 @@
8686
<com:AnnotationText xml:lang="en">None</com:AnnotationText>
8787
</com:Annotation>
8888
<com:Annotation id="base-scenario-URL">
89-
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP5_v1.1/baseline_DEFAULT_step_13'</com:AnnotationText>
89+
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP5_v2.1/baseline_DEFAULT_step_13'</com:AnnotationText>
9090
</com:Annotation>
9191
</com:Annotations>
9292
</str:Code>
@@ -102,7 +102,7 @@
102102
<com:AnnotationText xml:lang="en">None</com:AnnotationText>
103103
</com:Annotation>
104104
<com:Annotation id="base-scenario-URL">
105-
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP1_v1.1/baseline_DEFAULT_step_13'</com:AnnotationText>
105+
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP1_v2.1/baseline_DEFAULT_step_13'</com:AnnotationText>
106106
</com:Annotation>
107107
</com:Annotations>
108108
<com:Name xml:lang="en">Low Energy Demand/High-with-Low scenario with SSP1 demographics</com:Name>
@@ -119,7 +119,7 @@
119119
<com:AnnotationText xml:lang="en">None</com:AnnotationText>
120120
</com:Annotation>
121121
<com:Annotation id="base-scenario-URL">
122-
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP2_v1.1/baseline_DEFAULT_step_13'</com:AnnotationText>
122+
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP2_v2.1/baseline_DEFAULT_step_13'</com:AnnotationText>
123123
</com:Annotation>
124124
</com:Annotations>
125125
<com:Name xml:lang="en">Low Energy Demand/High-with-Low scenario with SSP2 demographics</com:Name>
@@ -136,7 +136,7 @@
136136
<com:AnnotationText xml:lang="en">'CA'</com:AnnotationText>
137137
</com:Annotation>
138138
<com:Annotation id="base-scenario-URL">
139-
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP2_v1.1/baseline_DEFAULT_step_13'</com:AnnotationText>
139+
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP2_v2.1/baseline_DEFAULT_step_13'</com:AnnotationText>
140140
</com:Annotation>
141141
</com:Annotations>
142142
<com:Name xml:lang="en">EDITS scenario with ITF PASTA 'CA' activity</com:Name>
@@ -153,7 +153,7 @@
153153
<com:AnnotationText xml:lang="en">'HA'</com:AnnotationText>
154154
</com:Annotation>
155155
<com:Annotation id="base-scenario-URL">
156-
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP2_v1.1/baseline_DEFAULT_step_13'</com:AnnotationText>
156+
<com:AnnotationText xml:lang="en">'ixmp://ixmp-dev/SSP_SSP2_v2.1/baseline_DEFAULT_step_13'</com:AnnotationText>
157157
</com:Annotation>
158158
</com:Annotations>
159159
<com:Name xml:lang="en">EDITS scenario with ITF PASTA 'HA' activity</com:Name>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:1721a7f774603e85f2afdc84a5d2564d77b7907840aaea9919c965d39080df71
3+
size 23418171

message_ix_models/data/transport/R12/pdt-cap.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Projected passenger-distance travelled (PDT) per capita
22
#
3-
# Units: km / passenger
3+
# Units: km / year
44
#
55
scenario, node, technology, year, value
66
LED, R12_AFR, 2W, 2020, 360

message_ix_models/data/transport/set.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ commodity:
168168
"transport vehicle {technology.id}":
169169
_generate: {technology: LDV}
170170
name: Activity for {technology.id} LDVs
171-
units: Gv km
171+
# FIXME This is necessary to avoid imputed dimensionless in <output::LDV+ixmp>
172+
units: (Gv km)**2
172173

173174
"transport pax {consumer_group.id}":
174175
_generate: {consumer_group: null}

0 commit comments

Comments
 (0)