Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
b0ad637
Remove temporary test marks made for #328
khaeru May 13, 2025
105ef4e
Adjust .transport.workflow.tax_emission() for #350
khaeru May 19, 2025
8c86566
Replace make_enum with an EnumType subclass
khaeru May 19, 2025
8d2a5ed
Satisfy mypy in .project.ssp.__init__
khaeru May 19, 2025
712531e
Add item URNs to IIASA_ECE:AGENCIES
khaeru May 19, 2025
2758064
Add data/transport/R12/price-emission/*.csv
khaeru Jun 3, 2025
44d0f09
Adjust genno imports in .transport.data
khaeru Jun 4, 2025
01d60f9
Add "TCE" to "emission" code list
khaeru Jun 4, 2025
e63b325
Tolerate missing technology "sector" annotation
khaeru Jun 8, 2025
745c7e9
Add 9 items to "technology" codelist
khaeru Jun 4, 2025
419d2a9
Add .model.emission.PRICE_EMISSION
khaeru Jun 4, 2025
bcc7e72
Drop .report.operator.exogenous_data, tests
khaeru Jun 6, 2025
51fa4d0
Add .tools.exo_data.BaseOptions
khaeru Jun 5, 2025
49196da
Add .model.emissions.Options
khaeru Jun 5, 2025
710e6b6
Adjust options reference in IEA_EEI
khaeru Jun 5, 2025
0c7f2d8
Simplify ExoDataSource concrete classes
khaeru Jun 6, 2025
30268d0
Update tests of ExoDataSource classes
khaeru Jun 6, 2025
7e8c18a
Adjust type hints in .transport.operator
khaeru Jun 8, 2025
1be63e7
Add advance_test_data fixture
khaeru Jun 8, 2025
79ee72b
Use advance_test_data for transport build tests
khaeru Jun 8, 2025
d255f63
Adjust ADVANCE data source
khaeru Jun 8, 2025
ee31e29
Add URNLookupMixin.urn property
khaeru Jun 8, 2025
aa95361
Use ExoDataSource.add_tasks in transport build
khaeru Jun 8, 2025
d353642
Use SSP URN fragment to index transport data
khaeru Jun 8, 2025
7181f68
Update transport/R12/act-non_ldv.csv for #349
r-aneeque Jun 7, 2025
0029702
Swap prepare_computer() → ExoDataSource.add_tasks
khaeru Jun 8, 2025
a6059c3
Handle tar files in iamc_like_data_for_query
khaeru Jun 8, 2025
02f842b
Remove .tools.advance, tests, and docs
khaeru Jun 9, 2025
cad9ad0
Add gamsapi to tests requirements, for RTD
khaeru Jun 9, 2025
90ff092
Ensure proper contents in .testing.build_transport()
khaeru Jun 9, 2025
2a7abbd
Adjust 2 uses of testing.bare_res()
khaeru Jun 9, 2025
8513f19
Ensure URN is populated in register_agency()
khaeru Jun 9, 2025
0719042
Force scale-1=1.0 for (F ROAD, gas)
khaeru Jun 9, 2025
5a33fc3
Handle "3.2.beta" release of SSP data
khaeru Jun 10, 2025
a8b7fb9
Use SSP "3.2.beta" data in .transport.build
khaeru Jun 10, 2025
5f569c2
Update transport/R12/ldv-t-share.csv for #349
r-aneeque Jun 10, 2025
74bdfb9
Update transport/R12/mode-share/default.csv for #349
r-aneeque Jun 11, 2025
77a2f22
Update transport/R12/pdt-cap-ref.csv for #349
r-aneeque Jun 12, 2025
8aec692
Update transport/R12/freight-activity.csv for #349
r-aneeque Jun 12, 2025
38baf2e
Update transport/R12/load-factor-ldv.csv for #349
r-aneeque Jun 12, 2025
499b98b
Update transport/R12/elasticity-f.csv values for LED
r-aneeque Jun 12, 2025
7b6159f
Update transport/R12/pdt-cap.csv values for LED
r-aneeque Jun 12, 2025
3083b69
Add .tools.policy
khaeru Jun 24, 2025
45f58ae
Add .model.transport.policy
khaeru Jun 24, 2025
76d79b0
Add AnnotationsMixIn.from_obj(…, globals=…) arg
khaeru Jun 24, 2025
db44590
Improve .transport.config.refresh_cl_scenario()
khaeru Jun 24, 2025
3bb66d5
Update .transport.workflow.generate()
khaeru Jun 24, 2025
0e16f40
Use base model=SSP_SSP*_v6.1 in transport workflow
khaeru Jun 24, 2025
9327406
Use pytestconfig.stash for user's local data path
khaeru Jul 1, 2025
c909dbb
TEMPORARY: check for DIGSY
r-aneeque Jul 16, 2025
1d2f422
Temporary: DIGSY/MCE preperation
r-aneeque Jul 16, 2025
a2872c0
Revert to ScenarioMIP values
r-aneeque Jul 17, 2025
3803df0
Add files via upload
r-aneeque Jul 18, 2025
26e62d3
replace elasticity-f values for DIGSY scenarios
r-aneeque Jul 18, 2025
063170e
TEMPORARY Run 'transport' workflow on PR branch"
r-aneeque Jul 21, 2025
454d74e
TEMPORARY DIGSY values
r-aneeque Jul 21, 2025
0abd2ee
Remove extra spaces
r-aneeque Jul 22, 2025
9f00494
TEMPORARY setup for DIGSY runs
r-aneeque Jul 22, 2025
73df6a2
TEMPORARY setup for DIGSY runs (veh activity)
r-aneeque Jul 22, 2025
26bf721
change LED values to DIGSY scenario
r-aneeque Jul 22, 2025
9ad3089
DIGSY base scenario
r-aneeque Jul 22, 2025
e3bddd7
fix the SSP2 pdt-cap file being used for digsy base
r-aneeque Jul 22, 2025
cba4aa0
Run DIGSY best scenario
r-aneeque Jul 22, 2025
64da326
Run DiGSY best case scenario
r-aneeque Jul 22, 2025
1cd9f1c
Update elasticity-f values for DIGSY worst case
r-aneeque Jul 22, 2025
57a3b66
Update pdt-cap values for DIGSY worst case scenario
r-aneeque Jul 22, 2025
98f9563
TEMPORARY run lpmethod = 6
r-aneeque Jul 22, 2025
1fb45d6
Update elasticity-f to SSP2 for MCE
r-aneeque Jul 22, 2025
405ff90
Experimental: Update pdt-cap for MCE EDITS
r-aneeque Jul 22, 2025
2e5d60f
Run base scenario (SSP2) for DIGSY
r-aneeque Aug 27, 2025
3f64a5d
elasticity-f values for DIGSY base (SSP2)
r-aneeque Aug 27, 2025
a9174e3
Run digsy base (SSP2)
r-aneeque Aug 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions .github/workflows/transport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,7 @@ env:
# - Ensure there is NO trailing comma on the last line.
labels: >-
[
"SSP1",
"SSP1 policy",
"SSP2",
"SSP2 policy",
"SSP3",
"SSP3 policy",
"SSP4",
"SSP4 policy",
"SSP5",
"SSP5 policy",
"EDITS-CA",
"EDITS-HA",
"LED-SSP1",
"LED-SSP2"
"LED-SSP2"
]

# Currently disabled:
Expand All @@ -49,8 +36,8 @@ env:

on:
# Uncomment these lines for debugging, but leave them commented on 'main'
# pull_request:
# branches: [ main ]
pull_request:
branches: [ main ]
# push:
# branches: [ main ]
schedule:
Expand Down
102 changes: 58 additions & 44 deletions doc/api/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,70 +30,76 @@ Exogenous data (:mod:`.tools.exo_data`)
:members:
:exclude-members: ExoDataSource, prepare_computer

The tools in this module support use of data from arbitrary sources and formats in model-building code.
For each source/format, a subclass of :class:`.ExoDataSource` adds tasks to a :class:`genno.Computer`
that retrieve/load and transform the source data into :class:`genno.Quantity`.

An example using one such class, :class:`message_ix_models.project.advance.data.ADVANCE`.

.. code-block:: python

from genno import Computer

from message_ix_models.project.advance.data import ADVANCE

# Keyword arguments corresponding to ADVANCE.Options
kw = dict(
measure="Transport|Service demand|Road|Passenger|LDV",
model="MESSAGE",
scenario="ADV3TRAr2_Base",
)

# Add tasks to retrieve and transform data
c = Computer()
keys = c.apply(ADVANCE, context=context, **kw)

# Retrieve some of the data
q_result = c.get(keys[0])

# Pass the data into further calculations
c.add("derived", "mul", keys[1], k_other)

.. autosummary::

MEASURES
SOURCES
BaseOptions
DemoSource
ExoDataSource
add_structure
iamc_like_data_for_query
prepare_computer
register_source

.. autofunction:: prepare_computer

The first returned key, like ``{measure}:n-y``, triggers the following computations:

1. Load data by invoking a :class:`ExoDataSource`.
2. Aggregate on the |n| (node) dimension according to :attr:`.Config.regions`.
3. Interpolate on the |y| (year) dimension according to :attr:`.Config.years`.

Additional key(s) include:

- ``{measure}:n-y:y0 indexed``: same as ``{measure}:n-y``, indexed to values as of |y0| (the first model year).

See particular data source classes, like :class:`.SSPOriginal`, for particular examples of usage.

.. todo:: Extend to also prepare to compute values indexed to a particular |n|.

.. autoclass:: ExoDataSource
:members:
:private-members: _where
:special-members: __init__, __call__

.. currentmodule:: message_ix_models.tools.advance
:special-members: __init__

ADVANCE data (:mod:`.tools.advance`)
====================================

.. deprecated:: 2023.11
Use :mod:`.project.advance` instead.

.. autosummary::
get_advance_data
advance_data
As an abstract class ExoDataSource **must** be subclassed to be used.
Concrete subclasses **must** implement at least the :meth:`~ExoDataSource.get` method
that performs the loading of the raw data when executed,
and **may** override others, as described below.

.. autodata:: LOCATION
The class method :meth:`.ExoDataSource.add_tasks` adds tasks to a :class:`genno.Computer`.
It returns a :class:`genno.Key` that refers to the loaded and transformed data.
This method usually **should not** be modified for subclasses.

This is a location relative to a parent directory.
The specific parent directory depends on whether :mod:`message_data` is available:
The behaviour of a subclass can be customized in these ways:

Without :mod:`message_data`:
The code finds the data within :ref:`local-data` (see discussion there for how to configure this location).
Users should:
1. Create a subclass of :class:`.BaseOptions`
and set it as the :attr:`~.ExoDataSource.Options` class attribute.
2. Override :meth:`~.ExoDataSource.__init__`,
which receives keyword arguments via :meth:`.add_tasks`.
3. Override :meth:`~.ExoDataSource.transform`,
which is called to add further tasks which will transform the data.

1. Visit https://tntcat.iiasa.ac.at/ADVANCEWP2DB/dsd?Action=htmlpage&page=about and register for access to the data.
2. Log in.
3. Download the snapshot with the file name given in :data:`LOCATION` to a subdirectory :file:`advance/` within their local data directory.
See the documentation for these methods and attributes for further details.

With :mod:`message_data`:
The code finds the data within :ref:`private-data`.
The snapshot is stored directly in the repository using Git LFS.
.. autofunction:: prepare_computer

.. automodule:: message_ix_models.tools.advance
:members:
:exclude-members: LOCATION
:private-members:
.. deprecated:: 2025-06-06
Use :py:`c.apply(SOURCE.add_tasks, …)` as shown above.

.. currentmodule:: message_ix_models.tools.iamc

Expand All @@ -103,6 +109,14 @@ IAMC data structures (:mod:`.tools.iamc`)
.. automodule:: message_ix_models.tools.iamc
:members:

.. currentmodule:: message_ix_models.tools.policy

Policies (:mod:`.tools.policy`)
===============================

.. automodule:: message_ix_models.tools.policy
:members:

.. _tools-wb:

World Bank structures (:mod:`.tools.wb`)
Expand Down
5 changes: 4 additions & 1 deletion message_ix_models/data/emission.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ SO2:
name: Sulfur dioxide
report: Sulfur

TCE:
name: (missing)
type: TCE

VOC:
name: Volatile organic compounds

Expand Down Expand Up @@ -79,7 +83,6 @@ VOC:
# SF6
# SO2_LandUseChangeEM
# SO2_SavanBurnEM
# TCE
# TCE_CO2
# TCE_non-CO2
# VOC_LandUseChangeEM
Expand Down
15 changes: 9 additions & 6 deletions message_ix_models/data/sdmx/IIASA_ECE_AGENCIES(0.1).xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<mes:Structure xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:com="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/common" xmlns:data="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/data/structurespecific" xmlns:str="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/structure" xmlns:mes="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message" xmlns:gen="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/data/generic" xmlns:footer="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message/footer">
<?xml version='1.0' encoding='utf-8'?>
<mes:Structure xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:com="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/common" xmlns:md="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/metadata/generic" xmlns:md_ss="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/metadata/structurespecific" xmlns:data="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/data/structurespecific" xmlns:str="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/structure" xmlns:mes="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message" xmlns:gen="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/data/generic" xmlns:footer="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message/footer">
<mes:Header>
<mes:ID>none</mes:ID>
<mes:Test>false</mes:Test>
<mes:Prepared>2023-09-04T16:31:44.700655</mes:Prepared>
<mes:Source xml:lang="en">Generated by message_ix_models 2023.5.32.dev20+g8d51636</mes:Source>
<mes:Prepared>2025-05-19T22:09:29.424849</mes:Prepared>
<mes:Sender id="none"/>
<mes:Source xml:lang="en">Generated by message_ix_models 2025.1.11.dev398+gdaf97af4a.d20250504</mes:Source>
</mes:Header>
<mes:Structures>
<str:OrganisationSchemes>
<str:AgencyScheme version="0.1" isExternalReference="false" isFinal="false" agencyID="IIASA_ECE" id="AGENCIES" urn="urn:sdmx:org.sdmx.infomodel.base.AgencyScheme=IIASA_ECE:AGENCIES(0.1)">
<str:AgencyScheme isExternalReference="false" isFinal="false" agencyID="IIASA_ECE" version="0.1" id="AGENCIES" urn="urn:sdmx:org.sdmx.infomodel.base.AgencyScheme=IIASA_ECE:AGENCIES(0.1)">
<com:Description xml:lang="en">Agencies referenced by data structures in message_ix_models</com:Description>
<str:Agency id="IIASA_ECE">
<str:Agency id="IIASA_ECE" urn="urn:sdmx:org.sdmx.infomodel.base.Agency=IIASA_ECE:AGENCIES(0.1).IIASA_ECE">
<com:Name xml:lang="en">IIASA Energy, Climate, and Environment Program</com:Name>
</str:Agency>
<str:Agency id="ICONICS">
Expand All @@ -17,7 +20,7 @@
<str:URI>https://depts.washington.edu/iconics/</str:URI>
</str:Contact>
</str:Agency>
<str:Agency id="IEA">
<str:Agency id="IEA" urn="urn:sdmx:org.sdmx.infomodel.base.Agency=IIASA_ECE:AGENCIES(0.1).IEA">
<com:Name xml:lang="en">International Energy Agency</com:Name>
<str:Contact>
<str:URI>https://iea.org</str:URI>
Expand Down
Loading
Loading