Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
9f01132
Initial bilateralize tool and config
junukitashepard Jun 17, 2025
4eb34de
Build and test bare sheets for oil_shipped
junukitashepard Jun 17, 2025
288612f
Update .gitignore
junukitashepard Jun 25, 2025
31dbcbe
Simplify gas pipeline framework
junukitashepard Jun 26, 2025
c215e97
Add diagnostics and calibration
junukitashepard Jun 30, 2025
0c7242b
Remove scenario run requirement
junukitashepard Jun 30, 2025
370ef7a
Add historical calibration
junukitashepard Jun 30, 2025
7d3a912
Add historical calibration
junukitashepard Jul 2, 2025
ce02461
Add tracked metrics to config
junukitashepard Jul 10, 2025
cda5f2d
Add sankey for diagnostics of bilateral trade
junukitashepard Jul 11, 2025
8464c7c
Link to GEM for historical infrastructure data
junukitashepard Jul 11, 2025
a0e77d4
Add historical calibration and option to output gdx (no solve)
junukitashepard Jul 11, 2025
6a8b2ca
Add flow technologies to full function (bilateral only)
junukitashepard Jul 11, 2025
3e753a3
Run with steel data inputs
junukitashepard Jul 14, 2025
fff4133
Add flow tec to diagnostics
junukitashepard Jul 14, 2025
da4a2a9
Update sankey.py
junukitashepard Jul 14, 2025
0163bf2
Add flows and proxy for 2025 with 2023 activity
junukitashepard Jul 14, 2025
5984474
Specify gas pipes in historical calibration
junukitashepard Jul 14, 2025
eeeb77f
Make sure base technology gets deleted
junukitashepard Jul 14, 2025
cc15d63
Final global flow constraint commit
junukitashepard Jul 17, 2025
6d26ec7
Add MariTEAM and calibrate LNG
junukitashepard Jul 23, 2025
3c0d489
Restructure code between /tools and /project
junukitashepard Jul 24, 2025
96d4946
Clean up pipeline calibration and GEM connection
junukitashepard Jul 24, 2025
f957a50
LFS update to LNG Tankers
junukitashepard Jul 24, 2025
34cb964
Technical lifetime for LNG to 20 years
junukitashepard Aug 4, 2025
77ef80a
Run diagnostics for LNG and pipeline
junukitashepard Aug 4, 2025
986bef3
Create newpathways-trade.rst
junukitashepard Aug 4, 2025
ced3217
Set up generate_bare_sheets so default values populated in bare_files
junukitashepard Aug 4, 2025
52ac864
Refactor and run bilateralize.py
junukitashepard Aug 4, 2025
240ccec
Update flow formulation in bilateralization
junukitashepard Aug 6, 2025
ba5306d
Add historical_new_capacity for pipelines
junukitashepard Aug 6, 2025
b57add8
Add year_vtg and begin at 2000 for historical_new_capacity of pipelines
junukitashepard Aug 6, 2025
148528a
Rerun edit files with LNG flow tech as input to trade tech
junukitashepard Aug 7, 2025
f89ca74
Remove gas_piped from .gitignore
junukitashepard Aug 8, 2025
31a0083
Update config_default.yaml
junukitashepard Aug 8, 2025
73ae7a4
Add p-drive flexibility to GEM and MariTeam call
junukitashepard Aug 8, 2025
4c48baf
Add project name/config to bare_to_scenario
junukitashepard Aug 8, 2025
42cbf04
Rebuild BACI for historical_calibration
junukitashepard Aug 8, 2025
6346847
Set up load_and_solve
junukitashepard Aug 8, 2025
99a2865
Update load_and_solve
junukitashepard Aug 8, 2025
87695ab
Set up LNG with updated flow framework
junukitashepard Aug 11, 2025
cdb8be0
Set config to solve MESSAGE
junukitashepard Aug 11, 2025
eed74f6
Correct foil commodity to fueloil
junukitashepard Aug 11, 2025
d29c0bb
Add cost to LNG trade
junukitashepard Aug 11, 2025
aafdd10
Update variable cost for LNG trade
junukitashepard Aug 11, 2025
2811d43
Remove pydeflate
junukitashepard Aug 11, 2025
e727517
Add variable cost for LNG shipping
junukitashepard Aug 12, 2025
6af1ba0
Move variable cost to investment cost for LNG shipping
junukitashepard Aug 12, 2025
b237d9d
Add fix cost to LNG shipping
junukitashepard Aug 12, 2025
6a3c18d
Add activity constraints to LNG shipping trade technology
junukitashepard Aug 12, 2025
cf2ab0d
Remove constraint extend tec lifetime for LNG trade tec
junukitashepard Aug 12, 2025
5712438
Add growth and initial activity constraints to LNG trade tec
junukitashepard Aug 12, 2025
a8a55ac
Add Sankey and Chord functionalities
junukitashepard Aug 13, 2025
acc2183
Differentiate distances for maritime shipping
junukitashepard Aug 13, 2025
a8d22f2
Add LNG tanker historical new capacity, lower LNG trade growth constr…
junukitashepard Aug 19, 2025
2d8a314
Change year_vtg to integer in historical new capacity
junukitashepard Aug 19, 2025
aaab886
Update config.yaml
junukitashepard Aug 19, 2025
2513a9b
Add trade historical new capacities (not just flow)
junukitashepard Aug 19, 2025
593e093
Make year_vtg integer in hist_new_capacity for trade
junukitashepard Aug 19, 2025
8d834f1
Add gas pipeline to RCPA
junukitashepard Aug 19, 2025
a89bfe5
Add soft activity bounds to LNG trade tec
junukitashepard Aug 19, 2025
15d76fe
Update var_costs and tec_lt for LNG tankers
junukitashepard Aug 20, 2025
229b65b
Add cost scenarios
junukitashepard Aug 20, 2025
abf1e9b
Add level_cost_activity_soft and abs_cost_activity_soft constraints f…
junukitashepard Aug 21, 2025
0ada9e0
Set var_cost to 5 year for tankers, add scenario for NAM shale discount
junukitashepard Aug 21, 2025
cda3d91
Update inv_cost based on higher lifetime Mt-km
junukitashepard Aug 22, 2025
321724b
Rerun all scenarios
junukitashepard Aug 22, 2025
f2e2bc7
Remove technical lifetimes from config.yaml
junukitashepard Aug 22, 2025
59c191c
Reset broadcasting function in bilateralization
junukitashepard Aug 22, 2025
5e1e5d7
Add var cost to LNG trade
junukitashepard Aug 25, 2025
a6948a5
Re-add all test scenarios
junukitashepard Aug 25, 2025
814e279
Adjust variable costs on LNG
junukitashepard Aug 25, 2025
b8d8f88
Update load_and_solve.py
junukitashepard Aug 25, 2025
169a955
Add options for flow capacity constraints; debug trade_parameter dict…
junukitashepard Aug 27, 2025
6c4edc2
Add distance script to generalize further regionalization
junukitashepard Aug 28, 2025
9a38c4e
Update test scenarios
junukitashepard Aug 28, 2025
f1c855d
Add var_cost to bare by default, add more test scenarios
junukitashepard Aug 29, 2025
99dec18
Fix pathname in pull_gem
junukitashepard Aug 29, 2025
4849129
Fix pathname in mariteam
junukitashepard Aug 29, 2025
acf8336
Remove max/min on var costs
junukitashepard Aug 29, 2025
ee8ca0f
Adjust test scenario on var cost
junukitashepard Aug 29, 2025
8f627c8
Set default variable cost to mean instead of min
junukitashepard Aug 29, 2025
bd4b1d2
Round var cost values
junukitashepard Aug 29, 2025
5d35105
Comment out test scenarios that were already run
junukitashepard Aug 29, 2025
cef88b0
Add up-to-date test scenarios in diagnostics
junukitashepard Aug 29, 2025
f96c59f
Add steel back; add regionality to bilateral commodities
junukitashepard Sep 1, 2025
cf1589f
Set up liquefaction spreadsheet; only run baseline test scenario (pip…
junukitashepard Sep 1, 2025
5157540
Add liquefaction test scenario
junukitashepard Sep 1, 2025
f19c4d8
Debug: trade_parameters add
junukitashepard Sep 1, 2025
3f19a91
Add base diagnostics and clean up newpathways project repo
junukitashepard Sep 2, 2025
9399ee4
Update Russian LNG terminal from Novorossiysk to Arctic LNG 2
junukitashepard Sep 2, 2025
9189101
Transfer Russina LNG terminal update to bare file
junukitashepard Sep 2, 2025
40b4300
Update scenario pickle
junukitashepard Sep 2, 2025
92a30e2
Remove steel as input to activity
junukitashepard Sep 3, 2025
6e467ff
Add HHI test scenarios
junukitashepard Sep 10, 2025
92ce4a3
Remove reporting tables
junukitashepard Sep 10, 2025
e65008f
Use path join for hhi_config name
junukitashepard Sep 10, 2025
ecf4848
Set HHI test to WEU only (assume CHN will break)
junukitashepard Sep 10, 2025
7722d00
Small debug
junukitashepard Sep 24, 2025
745dfd4
Add coal representation
junukitashepard Sep 24, 2025
22d4c20
Finish adding coal, option to remove domestic_coal/gas relation activity
junukitashepard Sep 26, 2025
2cae78d
Set up constraints on coal
junukitashepard Sep 26, 2025
917e394
Add shipped crude
junukitashepard Oct 1, 2025
2a324af
Add crude oil pipelines
junukitashepard Oct 2, 2025
fecb481
Update GEM calibration for oil (and gas) pipelines
junukitashepard Oct 2, 2025
c9e7801
Set load_and_solve to solve ixmp
junukitashepard Oct 2, 2025
4d3933f
Ensure years are integers in historical_activity
junukitashepard Oct 2, 2025
2023a0f
Remove var cost on crude oil shipping
junukitashepard Oct 2, 2025
28f976e
Add ethanol shipping
junukitashepard Oct 2, 2025
7be66f6
Add 2025 values
junukitashepard Oct 2, 2025
b831a9e
Update costs to shipped and piped crude
junukitashepard Oct 3, 2025
1cd607b
Add fuel oil trade
junukitashepard Oct 6, 2025
ca0e280
Add costs to fuel oil shipping
junukitashepard Oct 7, 2025
4c84a68
Add fuel oil piped trade
junukitashepard Oct 9, 2025
8abf700
Add light oil piped and shipped
junukitashepard Oct 9, 2025
1aafc23
Ensure that years in GEM based files are integers
junukitashepard Oct 9, 2025
e0da130
Light oil should be used for shipping by default
junukitashepard Oct 9, 2025
ccc3a30
LNG shipping updated to fueled by light oil
junukitashepard Oct 9, 2025
90d0e44
Remove piped light oil for debugging
junukitashepard Oct 9, 2025
352b6ae
Set load_and_solve to solve (not to_gdx)
junukitashepard Oct 9, 2025
c9e8e5a
Remove NaN from output for flow_tech loil
junukitashepard Oct 9, 2025
43b9238
Add 1 to outputs for shipped coal flow
junukitashepard Oct 10, 2025
54a783c
Add loil_piped
junukitashepard Oct 10, 2025
40a3b1a
Add biomass shipping
junukitashepard Oct 10, 2025
35130c6
Add lh2 trade
junukitashepard Oct 10, 2025
b473f6f
Rename H2 scenario and updated diagnostics
junukitashepard Oct 13, 2025
d3cd7cd
Set base trade tecnames so that base technologies are removed
junukitashepard Oct 13, 2025
c637977
Add fuel oil bunker technology to foil_ship
junukitashepard Oct 13, 2025
6c60842
Add cost and growth constraints for sensitivities
junukitashepard Oct 13, 2025
5e5cb75
Remove constraints for fuel oil, lh2, loil
junukitashepard Oct 13, 2025
f323e5e
Add pickle back to load_and_solve.py
junukitashepard Oct 13, 2025
c4b6700
Debug LH2 configuration
junukitashepard Oct 14, 2025
bbe8e23
Test scenario after LH2 debug
junukitashepard Oct 14, 2025
53c46db
Set constraint parameter removal to be flexible
junukitashepard Oct 15, 2025
012f346
Update .gitignore to ignore diagnostic data
junukitashepard Oct 16, 2025
889b1a0
Remove caches for untracked files
junukitashepard Oct 16, 2025
f246c40
Move configs to technology-specific yamls
junukitashepard Oct 24, 2025
4d054ab
Delete build_sankey.py
junukitashepard Oct 24, 2025
cda9b38
Update configs
junukitashepard Oct 27, 2025
b072462
Remove inter_pipe (artifact)
junukitashepard Oct 27, 2025
0d7157d
Add workflow and test
junukitashepard Oct 27, 2025
f37c185
Allow user specification on scenario updates (rather than config)
junukitashepard Oct 27, 2025
d927664
Allow diagnostics for NEWPATHWAYS for all commodities
junukitashepard Oct 27, 2025
f505cb9
Don't allow pipelines from FSU to PAO
junukitashepard Oct 27, 2025
ed845b4
Add information on gas compression along pipelines
junukitashepard Oct 27, 2025
719dc80
Add scenario flexibility to load_and_solve
junukitashepard Oct 27, 2025
3c61ec4
Ensure historical activity loads only if pipeline is specified
junukitashepard Oct 27, 2025
0111e4b
Refactor bilateralize.py
junukitashepard Oct 28, 2025
d3b353e
Remove project/newpathways from branch
junukitashepard Oct 28, 2025
a64856b
Remove implied optionals
junukitashepard Oct 28, 2025
6a403f8
Split bilateralize into step code
junukitashepard Oct 28, 2025
13a4c59
Reformat to meet mypy, ruff, and testing
junukitashepard Oct 29, 2025
41ff845
Create documentation tools-bilateralize
junukitashepard Oct 29, 2025
2466b69
Remove pytest fixtures from test_bilateralize.py
junukitashepard Oct 30, 2025
0d47769
Update test_bilateralize and associated files
junukitashepard Nov 3, 2025
bf7ff85
Add more tests to test_bilateralize
junukitashepard Nov 3, 2025
0c57c4a
Reformat prepare_edit for mypy and ruff
junukitashepard Nov 3, 2025
c1e8541
Update test_bilateralize.py to meet mypy
junukitashepard Nov 3, 2025
d0da3ee
Satisfy ruff in test_bilateralize
junukitashepard Nov 3, 2025
9569a4d
Update output directory in pull_gem.py
junukitashepard Nov 4, 2025
beafe10
Point project and config names in subfunctions
junukitashepard Nov 4, 2025
b96c03d
Add tests of .bilat.{historical_calibration,pull_gem}
khaeru Nov 4, 2025
9f1b233
Remove data/bilateralize/node_lists and references
junukitashepard Nov 4, 2025
41571bd
Add opiton to load and solve scenario directly
junukitashepard Nov 6, 2025
b92b9cd
Create __init__.py
junukitashepard Nov 6, 2025
1f2f62a
Add bilateralize documentation to doc indices
junukitashepard Nov 6, 2025
7f0de0d
Update file locations in pull_gem.py
junukitashepard Nov 7, 2025
be61b61
Only remove base oil trade if crude oil is called
junukitashepard Nov 11, 2025
afc5137
Change GEM to csv in P-drive
junukitashepard Nov 13, 2025
857a1cf
Add relation activity for regional exports
junukitashepard Nov 13, 2025
3968846
Ensure project/config name specified in build_historical_price
junukitashepard Nov 14, 2025
9e754df
Update testing and formatting to meet ruff/mypy
junukitashepard Nov 18, 2025
e894133
Formatting for ruff
junukitashepard Nov 18, 2025
3b2b8a3
Change var_cost to fix_cost for trade parameters
junukitashepard Nov 18, 2025
ae35c92
Allow for user to set base trade technologies
junukitashepard Nov 25, 2025
d65bdba
Update utf encoding when reading yaml
junukitashepard Nov 25, 2025
4b0c491
Add technical lifetime as a user configuration
junukitashepard Nov 25, 2025
3346595
Use existing util.broadcast in bare_to_scenario
junukitashepard Nov 25, 2025
4402329
Update tools-bilateralize.rst
junukitashepard Nov 25, 2025
e5e4bd6
Update tools-bilateralize.rst
junukitashepard Nov 25, 2025
016994d
Debug bilateralize test
junukitashepard Dec 2, 2025
b757904
Add flexibility to bare_to_scenario
junukitashepard Dec 2, 2025
d6c5dca
Ensure shipped costs transfer from edit to bare
junukitashepard Jan 13, 2026
baa920d
Add test back
junukitashepard Jan 23, 2026
6527b07
Updates based on alps workflow
junukitashepard Jan 27, 2026
7f52f7e
Ruff formatting
junukitashepard Jan 27, 2026
83327a5
Add test for bare_scenario
junukitashepard Jan 28, 2026
49c2202
Add test coverage
junukitashepard Jan 29, 2026
8e5b711
Update test_bare_to_scenario.py
junukitashepard Jan 29, 2026
6438fcd
Set test_calibrate_historical_shipping as xfail
junukitashepard Jan 29, 2026
a5d9ba5
Reformat for ruff
junukitashepard Jan 29, 2026
19ff2d6
Add scgraph to pyproject.toml
junukitashepard Jan 29, 2026
2166490
Add test coverage for mariteam_calibration
junukitashepard Jan 29, 2026
0062d55
Improve doc/tools-bilateralize.rst
khaeru Feb 12, 2026
973ea5f
Add to #438 to doc/whatsnew.rst
junukitashepard Nov 3, 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
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,13 @@ cache/

# Scratch files
*scratch*

# GDX and input files
scenario_parameters.pkl
*/data/bilateralize/gdx/*
*/data/bilateralize/diagnostics/*
*/projects/*/diagnostics/*
*/data/bilateralize/*/edit_files/*
*/data/bilateralize/*/bare_files/*
*/data/bilateralize/*/GEM/*
/message_ix_models/project/newpathways/diagnostics/data
177 changes: 177 additions & 0 deletions doc/api/tools-bilateralize.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
.. currentmodule:: message_ix_models.tools.bilateralize

Bilateralize (:mod:`.tools.bilateralize`)
*****************************************

.. contents::
:local:

Overview
========

This documentation will outline how to bilateralize trade flows in MESSAGEix.

By default, trade flows are based on a “global pool” approach, wherein all
exporters export energy/commodities to a pool from which importers import based
on regionally resolved demands.

By “bilateralizing” trade, we specify exporter and importer flows and can therefore
represent trade flows as networks.

The bilateralization tool, **bilateralize**, is generalized for any traded commodity,
whether that is a fuel (e.g., LNG), or a material (e.g., steel).
It also explicitly represents bilateral trade “flows”, or how a fuel/commodity is
transported from exporter to importer.
These flow technologies are user defined and flexible; the most common are pipelines
(e.g., gas pipelines), maritime shipping (e.g., LNG tanker), and transmission lines.

The ``bilateralize`` tool is a Python script that can be used to bilateralize trade flows
in MESSAGEix. It is located in the ``message-ix-models/tools/bilateralize`` directory.

The tool follows the following steps, which are also available in ``tool/bilateralize/workflow.py``:

Step 1 | Edit (``tools/bilateralize/prepare_edit.py``)
======================================================

The first step is to generate empty (or default valued) parameters that are required for
bilateralization, specified by commodity. This step requires updates to a configuration file
(``config.yaml``) that should be housed in a project directory
(e.g., ``message-ix-models/projects/newpathways-trade/config.yaml``). A template configuration
file is provided at ``message-ix-models/data/bilateralize/configs/base_config.yaml``.

Once the configuration is updated, the user can run
``message_ix_models.tools.bilateralize.prepare_edit.generate_edit_files(log, project_name, config_name, message_regions)``
to produce empty (or default valued) parameters as CSV files.
These CSV files will populate in ``message-ix-models/data/[your_trade_commodity]/edit_files``.

The tools may stop if the user specifies in their config that they want to specify a trade network
(i.e., specify which regions can trade with regions). In this case, a file called ``specify_trade_network.csv``
will appear in ``message-ix-models/data/bilateralize/[your_trade_commodity]/speciy_network_[your_trade_commodity].csv``.

Additional functions used here include:

- ``message_ix_models.tools.bilateralize.calculate_distance()``:
Calculates the great-circle distance between regions (TODO: update this to use explicit maritime routes)
- ``message_ix_models.tools.bilateralize.historical_calibration.build_historical_price()``:
Builds historical price dataframes
- ``message_ix_models.tools.bilateralize.mariteam_calibration.calibrate_mariteam()``:
Calibrates maritime shipping (flow technologies) using MariTEAM output.
- ``message_ix_models.tools.bilateralize.pull_gem.import_gem()``:
Imports pre-downloaded raw data from the Global Energy Monitor which is used to calibrate
the flow technology piped oil and gas

**This step is not necessary for the following commodities
(they are already defined in ``scenario_parameters.pkl`` in
``message-ix-models/data/bilateralize/configs/``):**

- Biomass (``biomass_shipped``)

- Coal (``coal_shipped``)

- Crude Oil (``crude_shipped`` and ``crude_piped``): Note that the global pool version of
MESSAGEix names this ``oil_exp`` and ``oil_imp``
and combines shipped and piped trade.

- Ethanol (``eth_shipped``)

- Fuel Oil (``foil_shipped`` and ``foil_piped``): Note that this uses the same oil pipeline
infrastructure as crude oil and light oil.

- Light Oil (``loil_shipped`` and ``loil_piped``): See note above on pipelines

- Liquid H2 (``lh2_shipped``)
- LNG (``LNG_shipped``)
- Methanol (``meth_shipped``)
- Piped gas (``gas_piped``)

Step 2 | Bare (``tools/bilateralize/bare_to_scenario``)
=======================================================

The second step is to review, edit, and transfer the files
in ``message-ix-models/data/bilateralize/[your_trade_commodity]/edit_files/``.

The user should then review all files in ``message-ix-models/data/bilateralize/[your_trade_commodity]/edit_files/``
and transfer these files to ``message-ix-models/data/bilateralize/[your_trade_commodity]/bare_files/``.

By default, the following parameters are transfered automatically with default values from
``message-ix-models/data/bilateralize/[your_trade_commodity]/edit_files/`` to
``message-ix-models/data/bilateralize/[your_trade_commodity]/bare_files/``, to ensure that a scenario
can be built (even if that scenario doesn't make a ton of sense).

- For **trade technologies** (i.e., whether or not/how much a commodity is traded):

- ``capacity_factor``
- ``input``
- ``output``
- ``technical_lifetime``

- For **flow technologies** (i.e., how a commodity is transported when traded,
such as via pipelines or maritime shipping)

- ``capacity_factor``
- ``input``
- ``output``
- ``relation_activity_flow`` (this links the flow technology to the trade technology)
- ``technical_lifetime``

The user can call ``message_ix_models.tools.bilateralize.bilateralize.build_parameter_sheets(log)`` to
pull parameters from ``message-ix-models/data/bilateralize/[your_trade_commodity]/bare_files/``
into a dictionary of parameter dataframes that will be used to build a scenario.
Note that this function pulls from ``bare_files`` and not ``edit_files``, so the user should ensure that
the right files are transferred in the previous step.

Additional functions here include:

``message_ix_models.tools.bilateralize.historical_calibration.build_hist_new_capacity_flow(message_regions)``:
Builds new capacity dataframes for historical activity of flow technologies (e.g., pipelines)

``message_ix_models.tools.bilateralize.historical_calibration.build_hist_new_capacity_trade(message_regions)``:
Builds new capacity dataframes for historical activity of trade technologies (e.g., piped gas)

``message_ix_models.tools.bilateralize.historical_calibration.build_historical_activity(message_regions)``:
Builds historical activity dataframes

Step 3 | Build (``tools/bilateralize/load_and_solve.py``)
=========================================================

This step builds a scenario.

The user should use the function
``message_ix_models.tools.bilateralize.load_and_solve.load_and_solve()``.
This will pull the base model/scenario, clone it, remove specified trade technologies,
add them back as bilateralized versions, and export to a GDX file (if specifed- the default is to not export)
and/or solve the scenario (default is to solve). Note that exporting to GDX means that it is not stored in the ixmp database.
This will also optionally solve the scenario.

Reporting
=========
This code is in progress.

To add a new commodity
======================
To add a new commodity:

- Create a new configuration file for the commodity in ``data/bilateralize/configs/``
(see examples from existing configurations or use ``template.yaml``)

- Add the commodity to the ``base_config.yaml`` under ``covered_trade_technologies``

- Run the workflow from ``prepare_edit``, then ``bare_to_scenario``, then ``load_and_solve``

Data
====
All raw data required for a MESSAGEix-GLOBIOM update are currently stored in ``P:/ene_model/MESSAGE_trade``.

Code reference
==============

The entire module and its contents are documented recursively:

.. currentmodule:: message_ix_models.tools

.. autosummary::
:toctree: _autosummary
:template: autosummary-module.rst
:recursive:

bilateralize
1 change: 1 addition & 0 deletions doc/api/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ General purpose modeling tools (:mod:`.tools`)

On other pages:

- :doc:`tools-bilateralize`
- :doc:`tools-costs`

On this page:
Expand Down
1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ Other submodules are documented on their respective pages:
api/disutility
api/report/index
api/tools
api/tools-bilateralize
api/tools-costs
api/tools-messagev
api/data-sources
Expand Down
3 changes: 2 additions & 1 deletion doc/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Next release

- :mod:`message_ix_models` supports and is tested against `Pandas 3.0.0 <https://pandas.pydata.org/pandas-docs/stable/whatsnew/v3.0.0.html>`_,
released 2026-01-21 (:pull:`470`).

- New module :mod:`tools.bilateralize <message_ix_models.tools.bilateralize>`
to change scenarios to a bilateral representation of trade (:pull:`438`).
- Fix water module parameter bugs and refactor cooling (:pull:`405`):
infrastructure M1/Mf mode fixes, regional average shares for cooling allocation,
water supply level hierarchy corrections, and test suite improvements.
Expand Down
3 changes: 3 additions & 0 deletions message_ix_models/data/bilateralize/Gas Pipelines.xlsx
Git LFS file not shown
3 changes: 3 additions & 0 deletions message_ix_models/data/bilateralize/LNG Liquefaction.xlsx
Git LFS file not shown
3 changes: 3 additions & 0 deletions message_ix_models/data/bilateralize/LNG Tankers.xlsx
Git LFS file not shown
144 changes: 144 additions & 0 deletions message_ix_models/data/bilateralize/commodity_codes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# UN Comtrade HS6 code to IEA conversion factors

Biomass:
HS:
- '2703'
MESSAGE Commodity: biomass
IEA-WEB:
- PRIMSBIO
- PEAT_PRODUCTS
- PRIMARY_SOLID_BIOFUEL
- WASTE_MUNICIPAL_REN

Coal:
HS:
- '270111'
- '270112'
- '270119'
- '2702'
- '2704'
- '2706'
MESSAGE Commodity: coal
IEA-WEB:
- ANTCOAL
- ANTHRACITE
- BITCOAL
- BKB
- BLFURGS
- BROWN
- BROWNCOAL_ND
- COALTAR
- COKCOAL
- COKEOVGS
- GASCOKE
- GASWKSGS
- HARDCOAL
- INDWASTE
- LIGNITE
- MANGAS
- MUNWASTEN
- OVENCOKE
- PATFUEL
- PEAT
- SUBCOAL
- CHARCOAL
- COAL_TAR
- COKE_OVEN_COKE_OTH
- COKING_COAL
- HARDCOAL_ND
- BLAST_FURNACE_GAS
- COKE_OVEN_GAS
- GASWORKS_GAS
- GAS_COKE
- OTH_BITCOAL
- OTH_RECOVGASES
- SUB_BITCOAL

Crude Oil:
HS:
- '2709'
MESSAGE Commodity: crudeoil
IEA-WEB:
- CRUDE_OIL
- OIL_SHALE

Ethanol:
HS:
- '2207'
- '3826'
MESSAGE Commodity: eth
IEA-WEB:
- BIODIESEL
- BIOGASOL
- BIOJETKERO
- OBIOLIQ
- BIOFUEL_NONSPEC
- BIOGASES
- BIOGASOLINE
- KEROSENE_JET_BIO
- LIQBIOFUEL_OTHER

Fuel Oil:
HS:
- '2712'
- '2713'
MESSAGE Commodity: foil
IEA-WEB:
- BITUMEN
- PARWAX
- PETCOKE
- RESFUEL
- FUEL_OIL_RESIDUAL
- PARAFFIN_WAXES
- PATENT_FUEL
- PETROLEUM_COKE

Liquid Hydrogen:
HS:
- '280410' # hydrogen
MESSAGE Commodity: lh2
IEA-WEB:
-

Light Oil:
HS:
- '270120'
- '2710'
- '271111'
- '271112'
- '271129'
- '290110'
- '381121'
MESSAGE Commodity: loil
IEA-WEB:
- AVGAS
- AVIATION_GASOLINE
- ETHANE
- JETGAS
- LPG
- LUBRIC
- NAPHTHA
- NONBIODIES
- NONBIOGASO
- NONBIOJETK
- ONONSPEC
- OTHKERO
- REFINGAS
- WHITESP
- GASOLINE_JET
- KEROSENE_JET_NONBIO
- KEROSENE_OTHER
- LUBRICANTS
- MOTOR_GASOLINE_NONBIO
- REFINERY_FEEDSTOCKS
- REFINERY_GAS
- WHITE_SPIRIT
- GAS_DIESEL_OIL_NONBIO
- OTH_SEC_OIL_PRODS_ND

LNG:
HS:
- '271111' # LNG
MESSAGE Commodity: lng
IEA-WEB:
-
Loading