Skip to content

Commit ae96255

Browse files
authored
Merge pull request #300 from iiasa/transport/2025-w09
Transport improvements from 2025-W09
2 parents 5ca9f9f + 79b5417 commit ae96255

Some content is hidden

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

76 files changed

+40707
-39300
lines changed

doc/api/testing.rst

+8
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,11 @@ Others:
3030

3131
.. automodule:: message_ix_models.testing
3232
:members:
33+
34+
.. currentmodule:: message_ix_models.testing.check
35+
36+
Checks
37+
======
38+
39+
.. automodule:: message_ix_models.testing.check
40+
:members:

doc/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"sphinx.ext.viewcode",
3333
# Others
3434
"genno.compat.sphinx.rewrite_refs",
35-
# "ixmp.util.sphinx_linkcode_github",
35+
# "ixmp.util.sphinx_linkcode_github", # TODO Address build errors, then enable
3636
"sphinxcontrib.bibtex",
3737
]
3838

doc/transport/input.rst

+159-149
Large diffs are not rendered by default.

doc/transport/output.rst

+15
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ Plots
1515
:class:`.VarCost`
1616
Variable costs.
1717

18+
Data flows
19+
==========
20+
21+
Quick links to each of the data flows:
22+
:data:`~.data.activity_passenger`
23+
:data:`~.data.activity_vehicle`
24+
:data:`~.data.fe_transport`
25+
:data:`~.data.gdp_in`
26+
:data:`~.data.population_in`
27+
28+
.. autodata:: message_ix_models.model.transport.data.activity_passenger
29+
.. autodata:: message_ix_models.model.transport.data.activity_vehicle
30+
.. autodata:: message_ix_models.model.transport.data.fe_transport
31+
.. autodata:: message_ix_models.model.transport.data.gdp_in
32+
.. autodata:: message_ix_models.model.transport.data.population_in
1833

1934
Quantities
2035
==========

doc/whatsnew.rst

+37-8
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,27 @@ Next release
1010
- Support for :mod:`ixmp` and :mod:`message_ix` versions 3.4, 3.5, and 3.6 is dropped (:pull:`288`, :pull:`289`).
1111
The minimum supported version of both packages is 3.7.0.
1212

13-
- Update :class:`.IEA_EWEB` to support :py:`transform="B"` / :func:`.transform_B` (:issue:`230`, :pull:`259`).
14-
15-
- New utility :class:`.sdmx.AnnotationsMixIn` (:pull:`259`).
13+
- Update :class:`.IEA_EWEB` to support:
14+
15+
- :py:`transform="B"` / :func:`.transform_B` (:issue:`230`, :pull:`259`).
16+
- :py:`transform="C"` / :func:`.transform_C` (:issue:`229`, :pull:`300`).
17+
- The :class:`~.web.TRANSFORM` enumeration for specifying and validating multiple transformations.
18+
19+
- New class :class:`.Dataflow` for describing input and/or output data flows (:pull:`300`) that are read from file and attached to a :class:`.Computer`.
20+
Generalized from former :py:`.transport.files.ExogenousDataFile`.
21+
- New method :meth:`.Config.regions_from_scenario` (:pull:`300`),
22+
extracted/generalized from :meth:`.transport.Config.from_context`.
23+
- New general-purpose :mod:`genno` operators in :mod:`.report.operator`: :func:`.broadcast_wildcard` and :func:`.merge_data` (:pull:`300`),
24+
extracted/generalized from :mod:`.transport.operator`.
25+
- New utilities:
26+
27+
- :class:`.genno.Collector` (:pull:`300`).
28+
- :class:`.sdmx.AnnotationsMixIn` (:pull:`259`).
29+
- :func:`.check.verbose_check` (:pull:`300`).
30+
31+
- Display entire result quantity in :func:`.report.report` / :program:`mix-models report` with :py:`verbose=True` (:pull:`300`).
32+
- Bug fix: :program:`mix-models --verbose` command-line option was not stored on :class:`.Context`/:class:`~.util.Config` (:pull:`300`).
33+
- 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`).
1634
- Drop obsolete :py:`series_of_pint_quantity()` (:pull:`289`).
1735

1836
By topic:
@@ -33,20 +51,34 @@ Improve :mod:`.ssp.transport`:
3351
Transport
3452
---------
3553

36-
Update :doc:`/transport/index` (:pull:`259`, :pull:`289`).
54+
Update :doc:`/transport/index` (:pull:`259`, :pull:`289`, :pull:`300`).
3755

3856
- Adjust constraints on :py:`t="conm_ar"`.
39-
- Recompute :attr:`.minimum_activity` for transport technologies.
57+
- Drop some :attr:`.minimum_activity` entries; recompute values and add to :data:`.act_non_ldv`.
4058
- Improve freight representation:
4159

4260
- Adjust freight activity, freight and passenger mode shares for some regions.
4361
- Add dynamic constraints on activity of freight technologies.
4462
- Fix alignment of freight technology outputs with demand |l|.
63+
- Add :data:`.elasticity_f`, analogous to :data:`.elasticity_p`.
64+
See :func:`.freight.demand`.
4565

4666
- Implement LED override using exogenous passenger activity data from :ref:`transport-pdt-cap-proj`.
67+
- Update input data for :data:`.elasticity_p`, :data:`ikarus_inv_cost`, :data:`.inv_cost_ldv`, :data:`.mode_share_freight`, :data:`.pdt_cap_ref`, :data:`.speed`, .
68+
- Add LED-specific parametrization for :data:`.activity_ldv`, :data:`lifetime_ldv`, :data:`.load_factor_ldv`, :data:`pdt_cap_proj`, .
4769
- Drop :file:`base-scenario-url.json`; store base scenario URLs in :ref:`CL_TRANSPORT_SCENARIO`.
4870
- Generate SDMX-ML structural metadata, including data flow definitions, and SDMX-{CSV,ML} data outputs for certain reported quantities.
71+
72+
- New input data flow :data:`.input_share`.
73+
- Add :py:`scenario` dimension to :data:`.activity_ldv`, :data:`.lifetime_ldv`, input data flow and files.
4974
- Expand use of fixed/shared keys from :mod:`.transport.key`.
75+
- Improve documentation:
76+
77+
- Expand documentation of :doc:`input data flows <transport/input>` to include *all* input data flows.
78+
- Document some :doc:`output data flows <transport/output>`.
79+
- New operator :func:`.indexer_scenario`.
80+
- New plot :class:`.Scale1Diff`.
81+
- Simplify signature of :func:`.transport.build.main`, :func:`.transport.build.get_computer`.
5082
- Simplify and consolidate tests.
5183
- Improve :func:`.simulated_solution` to load ‘simulated’ solution data from file to reduce test durations.
5284

@@ -72,9 +104,6 @@ Documentation
72104
:doc:`project/sparccle`, and
73105
:doc:`project/uptake` (:pull:`282`).
74106

75-
- New utility :class:`.sdmx.AnnotationsMixIn` (:pull:`259`).
76-
- 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`).
77-
78107
v2025.1.10
79108
==========
80109

message_ix_models/cli.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def main(click_ctx, **kwargs):
6464

6565
# Log to console: either DEBUG or INFO.
6666
# Don't start file logging for a non-trivial execution.
67-
setup_logging(level="DEBUG" if kwargs.pop("verbose") else "INFO", file=non_trivial)
67+
setup_logging(level="DEBUG" if kwargs["verbose"] else "INFO", file=non_trivial)
6868

6969
if "pytest" not in sys.argv[0]:
7070
log.debug("CLI invoked with:\n" + "\n ".join(sys.argv))
@@ -77,10 +77,10 @@ def main(click_ctx, **kwargs):
7777
click_ctx.obj = Context.get_instance(-1)
7878

7979
# Handle command-line parameters
80-
click_ctx.obj.handle_cli_args(**kwargs)
80+
click_ctx.obj.core.handle_cli_args(**kwargs)
8181

8282
# Close any database connections when the CLI exits
83-
click_ctx.call_on_close(click_ctx.obj.close_db)
83+
click_ctx.call_on_close(click_ctx.obj.core.close_db)
8484

8585
# Ensure all log messages are handled
8686
click_ctx.call_on_close(flush)

message_ix_models/data/transport/R11/ldv-activity.csv

+27-14
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,51 @@
1010
#
1111
# Unit: kilometre / year
1212
#
13-
node, value
13+
scenario, node, year, value
1414
# driver_type="M" (moderate)
15-
# R11_NAM, 13930
15+
# *, R11_NAM, 2020, 13930
16+
# *, R11_NAM, 2110, 13930
1617
# driver_type="A" (average)
17-
R11_NAM, 25860
18+
*, R11_NAM, 2020, 25860
19+
*, R11_NAM, 2110, 25860
1820
# driver_type="F" (frequent)
19-
# R11_NAM, 45550
21+
# *, R11_NAM, 2020, 45550
22+
# *, R11_NAM, 2110, 45550
2023
# DLM: “See the "vkt_veh_yr_GCAM.xlsx" spreadsheet that Page Kyle sent
2124
# me in late-March 2014. The value in this cell is an average of GCAM's
2225
# Brazil and Latin America regions.”
23-
R11_LAM, 14600
26+
*, R11_LAM, 2020, 14600
27+
*, R11_LAM, 2110, 14600
2428
# “…GCAM's Western Europe region.”
25-
R11_WEU, 11646
29+
*, R11_WEU, 2020, 11646
30+
*, R11_WEU, 2110, 11646
2631
# “…GCAM's Eastern Europe region.”
27-
R11_EEU, 8962
32+
*, R11_EEU, 2020, 8962
33+
*, R11_EEU, 2110, 8962
2834
# “…GCAM's Former Soviet Union region.”
29-
R11_FSU, 11482
35+
*, R11_FSU, 2020, 11482
36+
*, R11_FSU, 2110, 11482
3037
# “…GCAM's Middle East region.”
31-
R11_MEA, 14000
38+
*, R11_MEA, 2020, 14000
39+
*, R11_MEA, 2110, 14000
3240
# “…GCAM's Africa region.”
33-
R11_AFR, 10391
41+
*, R11_AFR, 2020, 10391
42+
*, R11_AFR, 2110, 10391
3443
# “…GCAM's China region. Actually, GCAM assumes an average value of
3544
# ~20500 km/yr for China, which seems too high in my opinion, so I
3645
# revised this value downwards. I made an assumption that the value
3746
# should be 20% lower, an estimate I arrived at based on the
3847
# consideration that GCAM assumes that average annual driving distances
3948
# in the US are 20% lower than what MA3T shows for the average driver
4049
# (19200 in GCAM vs. 25860 in MA3T).
41-
R11_CPA, 16000
50+
*, R11_CPA, 2020, 16000
51+
*, R11_CPA, 2110, 16000
4252
# “…GCAM's Japan and Australia-NZ regions.”
43-
R11_PAO, 10000
53+
*, R11_PAO, 2020, 10000
54+
*, R11_PAO, 2110, 10000
4455
# “…GCAM's Korea and Southeast Asia regions.”
45-
R11_PAS, 12000
56+
*, R11_PAS, 2020, 12000
57+
*, R11_PAS, 2110, 12000
4658
# “…GCAM's India region.”
47-
R11_SAS, 10400
59+
*, R11_SAS, 2020, 10400
60+
*, R11_SAS, 2110, 10400

message_ix_models/data/transport/R12/act-non_ldv.csv

+73-18
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,77 @@
22
#
33
# Units: dimensionless
44
#
5-
node, technology, year, value
6-
R12_AFR, FCg_bus, 2020, 0.01
7-
R12_AFR, ICG_bus, 2020, 0.01
8-
R12_AFR, FR_ICG, 2020, 0.0001
9-
R12_AFR, FR_FCg, 2020, 0.00001
10-
R12_NAM, FR_FCg, 2020, 0.001
5+
node, technology, year, value
6+
R12_AFR, f road electr, 2020, 0.01
7+
R12_AFR, FCg_bus, 2020, 0.036
8+
R12_AFR, FR_FCg, 2020, 0.000036
9+
R12_AFR, FR_ICG, 2020, 0.00036
10+
R12_AFR, ICG_bus, 2020, 0.0036
11+
R12_CHN, f road electr, 2020, 0.036
12+
R12_CHN, FCg_bus, 2020, 4.56
13+
R12_CHN, FR_FCg, 2020, 4.56
14+
R12_CHN, FR_ICG, 2020, 4.56
15+
R12_CHN, ICG_bus, 2020, 4.56
16+
R12_EEU, f road electr, 2020, 0.01
17+
R12_EEU, FCg_bus, 2020, 0.470
18+
R12_EEU, FR_FCg, 2020, 0.470
19+
R12_EEU, FR_ICG, 2020, 0.470
20+
R12_EEU, ICG_bus, 2020, 0.470
21+
R12_FSU, f road electr, 2020, 0.01
22+
R12_FSU, FCg_bus, 2020, 3.93
23+
R12_FSU, FR_FCg, 2020, 3.93
24+
R12_FSU, FR_ICG, 2020, 3.93
25+
R12_FSU, ICG_bus, 2020, 3.93
26+
R12_LAM, f road electr, 2020, 0.01
27+
R12_LAM, FCg_bus, 2020, 5.28
28+
R12_LAM, FR_FCg, 2020, 5.28
29+
R12_LAM, FR_ICG, 2020, 5.28
30+
R12_LAM, ICG_bus, 2020, 5.28
31+
R12_MEA, f road electr, 2020, 0.01
32+
R12_MEA, FCg_bus, 2020, 0.186
33+
R12_MEA, FR_FCg, 2020, 0.186
34+
R12_MEA, FR_ICG, 2020, 0.186
35+
R12_MEA, ICG_bus, 2020, 0.186
36+
R12_NAM, f road electr, 2020, 0.01
37+
R12_NAM, FCg_bus, 2020, 0.012
38+
R12_NAM, FR_FCg, 2020, 0.001
39+
R12_NAM, FR_ICG, 2020, 0.012
40+
R12_NAM, ICG_bus, 2020, 0.012
41+
R12_PAO, f road electr, 2020, 0.01
42+
R12_PAO, FCg_bus, 2020, 0.0019
43+
R12_PAO, FR_FCg, 2020, 0.0019
44+
R12_PAO, FR_ICG, 2020, 0.0019
45+
R12_PAO, ICG_bus, 2020, 0.0019
46+
R12_PAS, f road electr, 2020, 0.01
47+
R12_PAS, FCg_bus, 2020, 0.178
48+
R12_PAS, FR_FCg, 2020, 0.178
49+
R12_PAS, FR_ICG, 2020, 0.178
50+
R12_PAS, ICG_bus, 2020, 0.178
51+
R12_RCPA, f road electr, 2020, 0.01
52+
R12_RCPA, FCg_bus, 2020, 0.0088
53+
R12_RCPA, FR_FCg, 2020, 0.0088
54+
R12_RCPA, FR_ICG, 2020, 0.0088
55+
R12_RCPA, ICG_bus, 2020, 0.0088
56+
R12_SAS, f road electr, 2020, 0.01
57+
R12_SAS, FCg_bus, 2020, 4.41
58+
R12_SAS, FR_FCg, 2020, 4.41
59+
R12_SAS, FR_ICG, 2020, 4.41
60+
R12_SAS, ICG_bus, 2020, 4.41
61+
R12_WEU, f road electr, 2020, 0.01
62+
R12_WEU, FCg_bus, 2020, 0.159
63+
R12_WEU, FR_FCg, 2020, 0.159
64+
R12_WEU, FR_ICG, 2020, 0.159
65+
R12_WEU, ICG_bus, 2020, 0.159
1166
# PNK: Added 2024-12-04 to address high methanol use in 2020
12-
R12_AFR, conm_ar, 2020, 0.01
13-
R12_CHN, conm_ar, 2020, 0.01
14-
R12_EEU, conm_ar, 2020, 0.01
15-
R12_FSU, conm_ar, 2020, 0.01
16-
R12_LAM, conm_ar, 2020, 0.01
17-
R12_MEA, conm_ar, 2020, 0.01
18-
R12_NAM, conm_ar, 2020, 0.01
19-
R12_PAO, conm_ar, 2020, 0.01
20-
R12_PAS, conm_ar, 2020, 0.01
21-
R12_RCPA, conm_ar, 2020, 0.01
22-
R12_SAS, conm_ar, 2020, 0.01
23-
R12_WEU, conm_ar, 2020, 0.01
67+
R12_AFR, conm_ar, 2020, 0.01
68+
R12_CHN, conm_ar, 2020, 0.01
69+
R12_EEU, conm_ar, 2020, 0.01
70+
R12_FSU, conm_ar, 2020, 0.01
71+
R12_LAM, conm_ar, 2020, 0.01
72+
R12_MEA, conm_ar, 2020, 0.01
73+
R12_NAM, conm_ar, 2020, 0.01
74+
R12_PAO, conm_ar, 2020, 0.01
75+
R12_PAS, conm_ar, 2020, 0.01
76+
R12_RCPA, conm_ar, 2020, 0.01
77+
R12_SAS, conm_ar, 2020, 0.01
78+
R12_WEU, conm_ar, 2020, 0.01

message_ix_models/data/transport/R12/config.yaml

+1-9
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,22 @@ minimum activity:
3939
# TODO reduce or remove these once technology activities are calibrated directly
4040
- [R12_AFR, RAIL, lightoil, 0.028]
4141
- [R12_CHN, RAIL, electr, 2.329]
42-
- [R12_CHN, ROAD, electr, 0.036]
4342
- [R12_CHN, ROAD, ethanol, 0.073]
44-
- [R12_CHN, ROAD, gas, 0.292]
4543
- [R12_EEU, RAIL, electr, 0.210]
46-
- [R12_EEU, ROAD, gas, 0.020]
4744
- [R12_FSU, RAIL, electr, 1.553]
4845
- [R12_FSU, RAIL, lightoil, 0.046]
49-
- [R12_FSU, ROAD, gas, 0.406]
5046
- [R12_LAM, RAIL, electr, 0.100]
5147
- [R12_LAM, RAIL, lightoil, 0.135]
5248
- [R12_MEA, RAIL, electr, 0.055]
53-
- [R12_MEA, ROAD, gas, 0.240]
5449
- [R12_NAM, RAIL, electr, 0.175]
5550
- [R12_NAM, RAIL, lightoil, 0.500]
5651
- [R12_PAO, RAIL, electr, 0.492]
5752
- [R12_PAO, ROAD, ethanol, 0.059]
5853
- [R12_PAS, RAIL, electr, 0.197]
59-
- [R12_PAS, ROAD, gas, 0.178]
6054
- [R12_RCPA, ROAD, ethanol, 0.130]
6155
- [R12_SAS, RAIL, electr, 0.457]
6256
- [R12_SAS, ROAD, ethanol, 0.070]
63-
- [R12_SAS, ROAD, gas, 0.057]
6457
- [R12_WEU, RAIL, electr, 1.168]
65-
- [R12_WEU, ROAD, gas, 0.049]
6658

6759
share weight convergence:
6860
# Settings from MESSAGE (V)-Transport
@@ -73,7 +65,7 @@ share weight convergence:
7365
R12_FSU: [R12_NAM, R12_WEU]
7466
R12_LAM: [R12_NAM, R12_WEU]
7567
R12_MEA: [R12_NAM, R12_WEU]
76-
R12_NAM: [R12_NAM]
68+
R12_NAM: [R12_NAM, R12_WEU]
7769
R12_PAO: [R12_PAO, R12_WEU]
7870
R12_PAS: [R12_PAO, R12_WEU]
7971
R12_SAS: [R12_PAO, R12_NAM]

0 commit comments

Comments
 (0)