Skip to content

Migrate .engage.workflow and related tools #350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 473 commits into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
473 commits
Select commit Hold shift + click to select a range
2110aec
Remove h2mix_direct from required relations in buildings/set.yaml
khaeru Dec 16, 2022
8ac68ae
Differentiate transport scenarios in navigate workflow
khaeru Dec 17, 2022
c39b3bc
Re-solve sturm after ctax run to pick up price changes
khaeru Dec 17, 2022
8e5cf18
Solve errors happening in reporting
GamzeUnlu95 Dec 19, 2022
8c4f8c8
Handle "other_uses" end-use in buildings…pre_solve()
khaeru Jan 11, 2023
c87d325
Comment buildings code, annotate set.yaml per 2022-01-10 discussion
khaeru Jan 11, 2023
73d31bc
Modify report label for other_uses per iiasa/navigate-workflow#20
khaeru Jan 11, 2023
d70a611
Do not store buildings…report0() outputs as time series data
khaeru Jan 11, 2023
9a139c3
Add documentation for buildings integration and reporting
khaeru Jan 11, 2023
e674dd7
Deduplicate --dsd= in .navigate.cli
khaeru Jan 11, 2023
eb6de3c
Force "ej/yr" unit string for buildings reporting
khaeru Jan 11, 2023
c23432a
Update navigate scenario code annotation ids
khaeru Jan 11, 2023
ad29a32
Report buildings "cook" end-use as "heating|cooking"
khaeru Jan 12, 2023
ff87398
Handle fmy=2025 in .builds.build.materials()
khaeru Jan 13, 2023
b21c8c8
Scale access data to historical only when access is run
khaeru Jan 13, 2023
142e05e
Rename "final energy|afofi" to "…|agriculture"
khaeru Jan 13, 2023
65aacbc
Report "final energy|afofi" separately
khaeru Jan 13, 2023
dca6148
Move sturm debug data dump to sturm.py
khaeru Jan 17, 2023
dd0c430
Use a distinct scenario name for buildings re-solve
khaeru Jan 17, 2023
78db3f2
Adjust base model material demands only once
khaeru Jan 17, 2023
c119215
Comment repeat behaviour of buildings.build.main()
khaeru Jan 17, 2023
0fd84eb
Remove rc(spec|therm)_ techs before buildings setup
khaeru Jan 18, 2023
b8eda7a
Set full_access and reporting false when running access
khaeru Jan 20, 2023
73eb1ac
Add buildings.build.get_tech_groups() and tests
khaeru Jan 20, 2023
6197928
Collect buildings structure info in set.yaml
khaeru Jan 20, 2023
1ebe40a
Use add_replacements() in .buildings.report
khaeru Jan 20, 2023
d994e32
Use get_tech_groups() for both genno and legacy buildings reporting
khaeru Jan 20, 2023
401ef06
Preserve annotations in buildings…load_config() / get_spec()
khaeru Jan 23, 2023
3b4b75c
Disable .buildings.report.report0() (again)
khaeru Jan 23, 2023
3912fcf
Change default buildings.config.clone to false
khaeru Jan 24, 2023
7599a9b
Clone at buildings steps in navigate workflow
khaeru Jan 24, 2023
f04f3a4
Use "iamc: … sums:" in buildings report config
khaeru Jan 24, 2023
abaaac4
Consolidate legacy reporting config for navigate
khaeru Jan 24, 2023
d208b8e
Store legacy reporting commodity aliases with code
khaeru Jan 24, 2023
581e2d0
Implement transport…configure_legacy_reporting()
khaeru Jan 24, 2023
41dbbc4
Handle "ctax-ref+b" in message → sturm scenario name mapping
khaeru Jan 25, 2023
d92f270
Handle full scenario names from workflow in .navigate.report
khaeru Jan 25, 2023
1bbd2d9
Specify navigate-rc.yaml in .navigate.workflow
khaeru Jan 25, 2023
8a0473a
Fix ref to ".model.material" in .navigate.report
khaeru Jan 25, 2023
2f9e5c2
Delegate attribute lookup in .navigate.report to .material.report.tables
khaeru Jan 26, 2023
f6d5bcd
Test navigate/materials/legacy report integration
khaeru Jan 26, 2023
6fa0285
Configure bmt legacy reporting through .material.tables.return_func_d…
khaeru Jan 26, 2023
b09bc1d
Allow non-navigate scenario names in submission prep for internal use
khaeru Jan 26, 2023
75ec04c
Use full-string matching in "mix-models navigate run --from=…"
khaeru Jan 30, 2023
b1c9e2a
Allow regex for "mix-models navigate run target"
khaeru Jan 30, 2023
3f5b2e6
Address mypy errors for iiasa/message_data#422
khaeru Feb 4, 2023
96b7739
Map from internal navigate scenario names to _u codes
khaeru Feb 6, 2023
9a8d019
Update test_navigate.test_generate_workflow*()
khaeru Feb 8, 2023
15784d1
Update buildings structure tests
khaeru Feb 9, 2023
aa62e94
Add "navigate copy ts" in reporting workflow
khaeru Feb 10, 2023
1765857
Rename "remove ts data" to "navigate remove ts"
khaeru Feb 10, 2023
a7b4ff8
Remove region name mapping from r12_x to x in navigate submission prep
khaeru Feb 14, 2023
c341b0c
Make the region argument name consistent with other util functions
Jihoon Feb 24, 2023
8d97584
Revise the ctax run to reflect the lower co2 bound
Jihoon Feb 24, 2023
7cd54dc
Isort and blacken .navigate.workflow
khaeru Mar 3, 2023
3029639
Correct hp_gas_i relation entries
khaeru Mar 7, 2023
4d84b5c
Use test_context fixture in test_generate_workflow_cli()
khaeru Mar 7, 2023
2e2feaa
Adjust budgets and ctax level to fine-tune mitigation scenarios
Jihoon Mar 15, 2023
c5c0050
Bypass "navigate copy ts" for manual reporting
Jihoon Mar 27, 2023
032f167
Improve matching in 'navigate run' cli
khaeru Mar 31, 2023
cfadfb4
Adjust test_generate_workflow_cli
khaeru Apr 1, 2023
35f9c61
Adjust imports from sdmx to silence deprecationwarning
khaeru Apr 1, 2023
8dce8ff
Temporarily xfail two navigate tests for iiasa/message_data#442; re-e…
khaeru May 15, 2023
8aab00e
Iterate over wp6 scenarios in .navigate.workflow
khaeru Apr 3, 2023
d9c7b76
Move iter_scenarios out of navigate.generate_workflow
khaeru Apr 18, 2023
d93eb4c
Improve navigate.generate_workflow() for wp6
khaeru Apr 18, 2023
da75fd8
More more filtering logic to .navigate.workflow.iter_scenarios()
khaeru Apr 18, 2023
8c2e64b
Implement "20c t6.2" climate policy
khaeru Apr 18, 2023
10dc643
Use .navigate.config throughout workflow
khaeru Apr 18, 2023
b30b444
Add cli option "navigate run --no-transport"
khaeru Apr 18, 2023
976dc63
Handle .navigate.config.transport is false
khaeru Apr 18, 2023
bb28253
Extend sturm.scenario_name() for wp6 scenarios
khaeru Apr 18, 2023
351c111
Use "20c" label in scenario names for navigate t6.2
khaeru Apr 19, 2023
2df6f26
Choose materials base per navigate wp6 settings
khaeru Apr 19, 2023
c8e7149
Use distinct materials step names
khaeru Apr 24, 2023
4363151
Add strip_policy_data to .navigate.workflow
khaeru Apr 27, 2023
cf695c2
Strip policies from "m built" scenario in navigate wp6
khaeru Apr 27, 2023
3f5f2f3
Distinguish bmt, bm, etc. in navigate step names
khaeru Apr 27, 2023
93c2a25
Also strip bound_emission data from navigate m scenario
khaeru Apr 28, 2023
8abfa4c
Port 4 utility functions from branch `gamzeunlu95:navigate_industry_b…
khaeru May 3, 2023
6d714b9
Use .navigate.wp2.util in workflow for wp6
khaeru May 3, 2023
9c2a3bc
Use log.info() instead of print()
khaeru May 3, 2023
8dfa4a6
Fix linter error e741 ambiguous variable name 'l' → "level"
khaeru May 3, 2023
8416283
Fix linter error f501 line too long in comments
khaeru May 3, 2023
f44c1e8
Fix linter error f722 do not use bare 'except'
khaeru May 3, 2023
0d66650
Fix linter error e265 block comment should start with '# '
khaeru May 3, 2023
c68ad8d
Fix 3 instances of f841 (assigned to but never used)
khaeru May 3, 2023
ecc96da
Prefer f-strings to .format()
khaeru May 3, 2023
a6bc688
Store alps data files in /data/alps
khaeru May 3, 2023
f4b20fb
Use itertools.product() instead of nested loops
khaeru May 3, 2023
16b9ba7
Use make_df and a `common` dict in limit_h2()
khaeru May 3, 2023
4116fa8
Extend a list instead of duplicating code in limit_h2()
khaeru May 3, 2023
154764c
Use message_ix_models.util.broadcast in limit_h2()
khaeru May 3, 2023
a05c814
Use scenario.transact() in limit_h2()
khaeru May 3, 2023
ffc69f7
Nest make_df() in add_par() in limit_h2()
khaeru May 3, 2023
8962de9
Use scenarioinfo in limit_h2()
khaeru May 3, 2023
6c167b6
Add a docstring and type hints to limit_h2()
khaeru May 3, 2023
b9eaf49
Tidy add_ccs_constraint()
khaeru May 3, 2023
9fd35d4
Adjust references to config.dsd in .navigate.report
khaeru May 5, 2023
002f184
Handle navigate wp6 scenario names in .report._scenario_name
khaeru May 5, 2023
edf1368
Add tests for functions in .navigate.wp2.util
khaeru May 5, 2023
b7894d2
Simplify .navigate.wp2.util via better pandas usage
khaeru May 5, 2023
c4c414c
Ensure int years in add_ccs_constraint()
khaeru May 5, 2023
1c63c88
Set default version in .navigate.workflow.adjust_materials()
khaeru May 7, 2023
2e13940
Ensure type_tec="all_ind" exists for add_electrification_share()
khaeru May 8, 2023
cb08fb6
Correct "kwa" → "kwa" in add_led_setup()
khaeru May 8, 2023
27f2b17
Improve and test inv_cost data handling in add_led_setup()
khaeru May 8, 2023
01bbec0
Adjust tax_emission_scenario name for navigate t6.2
khaeru May 10, 2023
5c41bee
Simplify handling of "20c t6.2" policy configuration
khaeru May 12, 2023
7ed0359
Use engage.workflow.step_0 to simplify .navigate.workflow.tax_emission
khaeru May 13, 2023
727eda3
Add "navigate check-budget" cli subcommand
khaeru May 16, 2023
b64503c
Interpolate and set t6.2 budget constraint
khaeru May 17, 2023
801db7a
Also show versions in "navigate check-budget"
khaeru May 17, 2023
8116a3f
Satisfy mypy for iiasa/message_data#440
khaeru May 17, 2023
e608be3
Support version in navigate check-budget
khaeru May 31, 2023
71a5ab2
Visualize graph in .navigate.workflow.report
khaeru Jun 7, 2023
ea0f1b9
Add .navigate.workflow.add_macro and test
khaeru Jun 7, 2023
a9c47d0
Calibrate and solve (message-)macro for navigate
khaeru Jun 7, 2023
55d2d9a
Correct case in materials base scenario name
khaeru Jun 7, 2023
49f9e2b
Ensure "value" column name in .navigate.add_macro
khaeru Jun 7, 2023
1083da0
Work around incorrect units in the macro input data
khaeru Jun 7, 2023
c21c130
Avoid locking scenario in .navigate.workflow.add_macro
khaeru Jun 7, 2023
3dff161
Add debug outputs for macro in navigate workflow
khaeru Jun 7, 2023
5b6a4c6
Use .macro.generate() in .navigate.workflow.add_macro()
khaeru Jun 7, 2023
6b8f04c
Split avoid_locking() logic to a stand-alone function
khaeru Jun 7, 2023
8a2af4e
Use identify_nodes in .navigate.workflow.add_macro
khaeru Jun 7, 2023
6d93c28
Map b commodities to macro sectors in .navigate.add_macro
khaeru Jun 13, 2023
7d2deba
Use .macro.generate() from upstream
khaeru Jun 13, 2023
0c9bed1
Call set_as_default() in .navigate.workflow.add_macro()
khaeru Jun 13, 2023
073cd77
Update .navigate.workflow.generate() per iiasa/message-ix-models#104
khaeru Jun 13, 2023
81faca6
Tidy log_scenario_info()
khaeru Jun 13, 2023
b846d4c
Use r12 in test_add_macro()
khaeru Jun 13, 2023
c228ef6
Solve -bm- without macro on first pass
khaeru Jun 14, 2023
7f83947
Solve -bm- after adding macro
khaeru Jun 14, 2023
441e703
Handle more/all parameters in .buildings.build.prepare_data()
khaeru Jun 26, 2023
063ae77
Add relaxation in scale_and_replace()
khaeru Jun 26, 2023
f2d818c
Create parent directory for visualize() in .navigate.cli
khaeru Jun 26, 2023
22831e5
Clone at add_macro step in navigate workflow
khaeru Jul 4, 2023
ebbc86b
Reduce relaxation in .buildings.build.prepare_data()
khaeru Jul 4, 2023
e67f6eb
Add cost parameters to scale_and_replace()
khaeru Jul 5, 2023
9af8053
Use "buildings_sector" in buildings/set.yaml
khaeru Jul 5, 2023
4264211
Also scale_and_replace "technical_lifetime"
khaeru Jul 5, 2023
031ea69
Copy rc_afofi.py from iiasa/message_buildings@7fb0e6fd
khaeru Jul 11, 2023
23365c9
Integrate .buildings.rc_afofi
khaeru Jul 11, 2023
3ce3275
Scale macro demand_ref input for rc→afofi
khaeru Jul 11, 2023
74d38b0
Reduce var_cost of bio_backstop 1e5 → 1e1
khaeru Jul 24, 2023
20b1ede
Improve typing in .buildings
khaeru Jul 24, 2023
df30cdc
Add .navigate.workflow.add_globiom_step
khaeru Jul 25, 2023
36f0cd8
Replace bio_backstop with add_globiom_step
khaeru Jul 25, 2023
3385093
Remove work-around for iiasa/ixmp#465
khaeru Jul 26, 2023
261fd5d
Disable slow globiom clean step in navigate workflow
khaeru Jul 26, 2023
0ae30fb
Fix message-macro selection in .navigate.workflow
khaeru Jul 27, 2023
8d67d9b
Tidy .navigate.workflow.add_globiom etc.
khaeru Jul 27, 2023
39b62c6
Skip manipulating rc_{spec,therm} if already removed
khaeru Aug 2, 2023
baba412
Update budget constraint values for navigate 15c
khaeru Aug 3, 2023
38e0f1c
Address pandas settingwithcopywarning in add_*_accounting
khaeru Aug 8, 2023
d113586
Update base scenario for navigate workflow
khaeru Aug 8, 2023
032a8c8
Provide engage.policyconfig.low_dem_scen for navigate 15c
khaeru Aug 9, 2023
b036cc4
Expand .navigate.workflow.generate comments
khaeru Aug 9, 2023
596690d
Consolidate .navigate.workflow.adjust_materials
khaeru Aug 11, 2023
e0def3b
Limit tce_co2 decrease from 2020 to 2025
khaeru Aug 11, 2023
b14bcf3
Use `name` consistently in .engage.workflow.generate()
khaeru Aug 11, 2023
aa3d5a4
Work around module structure of .tools.utilities
khaeru Aug 11, 2023
c585ca1
Remove solution before adding engage emissions accounting
khaeru Aug 13, 2023
2d14756
Reorder navigate workflow steps
khaeru Aug 13, 2023
f8b8868
Use rel in .navigate.workflow.limit_drop()
khaeru Aug 13, 2023
f4938e7
Also populate historical_emission in limit_drop()
khaeru Aug 14, 2023
ef023d1
Update .navigate.report._scenario_name() for macro usage
khaeru Aug 14, 2023
5373ca3
Split calculation, addition of 2025 minimum emissions
khaeru Aug 17, 2023
7b8cff3
Tolerate emiss/rel difference when computing minimum emissions
khaeru Aug 17, 2023
0508e37
Handle "ctax-ref+b" in .navigate.report._scenario_name
khaeru Aug 17, 2023
7e1a9f1
Set default version after solving ctax-ref
khaeru Aug 17, 2023
d8acd68
Ensure co2_emission_global_total ≥ 0 in ctax-ref
khaeru Aug 21, 2023
77d6960
Consolidate engage and navigate solve step and config
khaeru Aug 21, 2023
19cc681
Simplify and comment buildings.build_and_solve()
khaeru Aug 21, 2023
550f308
Simplify and comment navigate.workflow.generate()
khaeru Aug 21, 2023
595ab4d
Improve navigate.report._scenario_name for wp6
khaeru Aug 21, 2023
10da0d5
Add navigate setting for first period in policy scenarios
khaeru Aug 21, 2023
a94d530
Use identify_nodes() in add_minimum_emissions()
khaeru Aug 21, 2023
d1f1e52
Simplify logic for creating & reusing policy config objects
khaeru Aug 21, 2023
23a508e
Provide .demand_scenario at the start of policy sequence
khaeru Aug 21, 2023
f3b5ed7
Update "navigate check-budget" to fill missing data
khaeru Aug 22, 2023
c101406
Align workflow step & scenario names "npi-ref 2025 limit added"
khaeru Aug 22, 2023
3a3d073
Add set_as_default() in add_minimum_emissions()
khaeru Aug 22, 2023
ef653b6
Adjust price data caching in .buildings.pre_solve
khaeru Aug 23, 2023
76c4681
Log values used in add_budget() for confirmation
khaeru Aug 24, 2023
2afb9e9
Pass options to .model.workflow.solve using config()
khaeru Aug 24, 2023
ae1e830
Make navigate ctax configurable, including via cli
khaeru Aug 24, 2023
9506025
Log added data in add_tax_emission()
khaeru Aug 24, 2023
4a58efe
Don't add reserve_margin in navigate baseline solve
khaeru Aug 24, 2023
e197d68
Also transfer_demands() in buildings re-solve after engage steps
khaeru Aug 25, 2023
3bbaa27
Always solve with message alone before macro added
khaeru Aug 25, 2023
6adcb1b
Adjust .sturm.scenario_name() for current scenario names
khaeru Aug 25, 2023
b31ca02
Copy data from 2020…y_{-1} inclusive in navigate reporting
khaeru Aug 29, 2023
aa4d50d
Force predual=1 in buildings re-solve
khaeru Aug 29, 2023
bf3a2a2
Reduce complexity of .navigate.workflow.generate()
khaeru Sep 1, 2023
84dd212
Satisfy mypy with genno 1.18
khaeru Sep 1, 2023
d8f81d9
Allow using an upper bound in add_electrification_share()
khaeru Sep 3, 2023
c149a77
Use add_electrification_share(…, kind="up") in navigate
khaeru Sep 3, 2023
f9c380c
Update imports of message_ix_models.report
khaeru Sep 4, 2023
1de375d
Protect "message buildings dir" registration against re-import
khaeru Sep 4, 2023
81ba6ce
Update key usage, typing in .buildings.report
khaeru Sep 4, 2023
3850ebb
Adapt emission relation entries for message-buildings
khaeru Sep 8, 2023
de1f3ed
Add manual changes from hpg914
khaeru Sep 13, 2023
e36d4e5
Satsify mypy in buildings.build.prepare_data()
khaeru Sep 13, 2023
e835347
Test per-project enums
khaeru Sep 5, 2023
66b7867
Adjust references to message_data.reporting
khaeru Sep 13, 2023
7857e54
Rename .transport.computations to .operator
khaeru Oct 17, 2023
37dfc35
Replace .navigate.cli.run with make_workflow_command()
khaeru Oct 30, 2023
7f1da5f
Remove "navigate {gen_workflow,prep_submission}" cli
khaeru Oct 31, 2023
4f614e8
Include buildings conditionally in .navigate.report
khaeru Aug 9, 2023
29d83b2
Identify workflow callbacks by name in .transport, .navigate
khaeru Nov 2, 2023
f12a20a
Update deprecated ixmp, message_ix imports
khaeru Nov 23, 2023
33871fa
Replace all eval_anno usage with code.eval_annotation()
khaeru Nov 28, 2023
51ded1f
Update imports from genno.computations
khaeru Nov 28, 2023
58d20df
Use write_report(pd.dataframe, …) from genno 1.21.0
khaeru Nov 28, 2023
7198aed
Make .navigate…report(…, other_scenario_info=…) optional
khaeru Nov 29, 2023
016fe8e
Add navigate.config.material setting; use in reporting
khaeru Nov 30, 2023
35bce37
Adjust output_path → output_dir in .navigate.report
khaeru Nov 30, 2023
5a4e0dd
Use message_ix_models.report.config.legacy for navigate
khaeru Nov 30, 2023
f669ece
Only use legacy reporting tables for materials if configured
khaeru Dec 4, 2023
51e13a1
Skip legacy reporting in .transport.workflow
khaeru Dec 4, 2023
f7bb921
Temporarily skip test_add_macro on gha
khaeru Dec 12, 2023
bc5c704
Apply `ruff format` v0.3.2 to 33 files (whitespace only)
khaeru Mar 12, 2024
cc5a79d
Apply `ruff format` v0.3.2 to .buildings.report
khaeru Mar 12, 2024
3781e0d
Move ixmp config key declaration to top level
khaeru Mar 18, 2024
cfae484
Adjust typing for genno 1.25.0
khaeru Mar 26, 2024
96ccce5
Satisfy mypy with pandas-stubs installed
khaeru Apr 23, 2024
a1dbcdd
Empty projects/navigate/__init__.py
khaeru Aug 1, 2024
e81c9e0
Remove .model.transport
khaeru Aug 2, 2024
391d050
Bump docs dependencies (iiasa/message_data#578)
glatterf42 Sep 11, 2024
fbecec6
Adjust for removal of .tools.post_processing
khaeru Nov 26, 2024
323f3fd
Bump mypy, ruff versions
khaeru Jan 28, 2025
9957f20
Update import of nodes_world_agg
khaeru Apr 23, 2025
630d110
Update type hints in .buildings.{build,report}
khaeru Apr 29, 2025
e5c095a
Clean up 9 .tools.{add,remove,update}_ modules
khaeru May 14, 2025
4d0a932
Address mypy, ruff errors in 9 files from #350
khaeru May 14, 2025
a7bbcd1
Adjust migrated tests for #350
khaeru May 14, 2025
c4de7be
Pass on reg= arg in add_AFOLU_CO2_accounting()
khaeru May 14, 2025
6ac4420
Test 8 .tools.{add,remove,update}_ modules
khaeru May 14, 2025
5dc0d60
Add "jaydebeapi" to "buildings" optional deps
khaeru May 15, 2025
e70582b
Update type hints in .model.buildings, .project.navigate
khaeru May 15, 2025
8224521
Install message-ix-buildings in "pytest" workflow
khaeru May 15, 2025
09760a1
Adjust default for .buildings.Config.code_dir
khaeru May 15, 2025
e6baf4d
Add data/navigate/scenarios.yaml
khaeru May 16, 2025
3c072b3
Adjust data paths for #350
khaeru May 16, 2025
ce4967e
Import from ixmp/message_ix v3.7.0 in .buildings.build
khaeru May 16, 2025
7a0d414
Add documentation for code migrated in #350
khaeru May 15, 2025
0b6dae5
Add .buildings, .navigate to modules with CLI
khaeru May 16, 2025
f6e54c6
Update tests of .navigate.workflow.generate()
khaeru May 16, 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
1 change: 1 addition & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ jobs:
"dask < 2025.4.0" \
"ixmp @ git+https://github.com/iiasa/ixmp.git@${{ matrix.version.upstream }}" \
"message-ix @ git+https://github.com/iiasa/message_ix.git@${{ matrix.version.upstream }}" \
"message-ix-buildings @ git+https://github.com/iiasa/message-ix-buildings@main" \
.[docs,tests]

- name: Configure local data path
Expand Down
21 changes: 21 additions & 0 deletions doc/api/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,24 @@ World Bank structures (:mod:`.tools.wb`)

.. automodule:: message_ix_models.tools.wb
:members:


Tools for scenario manipulation
===============================

.. currentmodule:: message_ix_models.tools

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

add_AFOLU_CO2_accounting
add_CO2_emission_constraint
add_FFI_CO2_accounting
add_alternative_TCE_accounting
add_budget
add_emission_trajectory
add_tax_emission
remove_emission_bounds
update_h2_blending
199 changes: 199 additions & 0 deletions doc/buildings/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
MESSAGEix-Buildings
*******************

.. caution:: |gh-350|

MESSAGEix-Buildings refers to a set of models including a specific configuration of MESSAGEix-GLOBIOM.

Code is maintained in the `iiasa/MESSAGE_Buildings <https://github.com/iiasa/MESSAGE_Buildings>`_ repository.

Function
========

This section briefly describes how the contents of the MESSAGE_Buildings repo and :mod:`message_data` interact, as a guide to reading the code.

ACCESS and STURM
----------------

The MESSAGE_Buildings contains two models (collectively the **“buildings models”**):

- **ACCESS**: includes cooking end-use in the residential sector.
- **STURM**: includes some residential and other end-uses, as well as the construction and demolition of buildings.

“MESSAGEix-Buildings” is thus the combination of ACCESS, STURM, and MESSAGEix-GLOBIOM (i.e. an instance of MESSAGE).

Both of the buildings models require as input prices for energy commodities.
In MESSAGEix-Buildings, this is obtained from an existing MESSAGEix-GLOBIOM scenario.
They produce various outputs; the ones relevant to MESSAGEix-Buildings are described below.

Build and solve
---------------

There are two phases to ‘running’ MESSAGEix-Buildings.
These are handled by :func:`.buildings.build_and_solve`.

1. **Build.**
This refers to building a MESSAGE scenario with structure capturing buildings technologies, commodities, etc., from a base scenario that lacks these features.
During this process, data is also needed to parametrize these new technologies; this data is obtained as output from ACCESS and STURM.

Thus, the order of operations is:

1. Prices are retrieved from the base scenario.
2. ACCESS is run, and its output stored temporarily in variables and/or files.
3. STURM is run, and its output stored temporarily in variables and/or files.
4. The base MESSAGE scenario is modified to add buildings structure and parameter data derived from (2) and (3).

These steps are handled by :func:`.buildings.pre_solve`.

2. **Solve.**
Because prices are endogenous in MESSAGE, solving the MESSAGE scenario produced by (1.4) can result in prices that are *different* from the ones provided to ACCESS and STURM in steps (1.2) and (1.3).

For this reason, MESSAGEix-Buildings is set up to use the iterative solve feature of :meth:`ixmp.Scenario.solve`.
:func:`.buildings.pre_solve` precedes the solution of the MESSAGE LP; afterwards :func:`.buildings.post_solve` computes a convergence criterion.

If the activity levels (demand) have not converged, the iteration loop repeats, up until :attr:`.max_iterations`.

.. note:: As of 2023-01-10, this is not in active use; the models are run in a once-through fashion with :attr:`.max_iterations` set to 1.
See also the :ref:`NAVIGATE workflow <navigate-workflow>`, wherein a second iteration is run manually after a policy scenario is solved.


Report
------

Reporting for MESSAGEix-Buildings involves the following pieces:

1. In the “Build” phase above, STURM is run produces its own reporting output files.
These are *different* from temporary files used in step (1.4) above to set up the buildings details.

ACCESS does not produce reporting output files.

2. :mod:`.buildings.report` contains (:mod:`genno`-based) reporting code (:func:`.buildings.report.callback`), i.e. extending the built-in :doc:`/reference/reporting` features of :mod:`message_data`, :mod:`message_ix`, and :mod:`ixmp`.

As with the other reporting, this is decomposed into multiple functions arranged in a graph of tasks.
*Inter alia*, computing the key ``buildings all`` will:

- Read the STURM output files and subset some contents, e.g. service levels.
- Compute custom aggregates based on standard :mod:`message_data` reporting, e.g. for final energy.
- Transform these into the IAMC structure, i.e. by collapsing multiple dimensions into “Variable” strings.
- Store these as time series data on the scenario being reported.
- Write the final and some intermediate data to files.

These reporting features handle quantities including final energy, but not emissions.

3. For certain quantities, notably emissions, the legacy reporting code must be used.
(This is because, as of 2023-01-10, there is no :mod:`genno`-based reporting that provides adjustments necessary for certain representations in main MESSAGEix-GLOBIOM scenarios, e.g. blending in gas supply.)

:func:`.buildings.report.configure_legacy_reporting` sets certain entries in :data:`.default_tables.TECHS`; for instance, the entry `"rc coal"` contains a list of technology IDs for residential and commercial (hence **rc** or **RC**) buildings technologies which consume the commodity `coal`.
By default (in the base global model), this is a list with a single entry, `"coal_rc"`.
:func:`.buildings.report.configure_legacy_reporting` replaces this with multiple entries for various technologies.

The legacy reporting also performs aggregation over quantities, including final energy, emissions, and others, computed by itself or found as time series data on the scenario, e.g. that stored by (2).
This functionality is not documented here in its entirety.

.. _buildings-usage:

Usage
=====

1. Clone the main MESSAGE_Buildings repo, linked above.

Either use a directory named :file:`buildings` in the same directory containing :mod:`message_data`; or, note the path and set this in the :ref:`ixmp configuration file <ixmp:configuration>`::

ixmp config set "message buildings dir" /path/to/cloned/message-buildings/repo

2. Invoke the model using, for example:

.. code-block::

mix-models \
--url="ixmp://ixmp-dev/model name/base scenario" \
buildings build-solve \
--dest="ixmp://ixmp-dev/new model name/target scenario"

3. Run the reporting:

.. code-block::

mix-models \
--url="ixmp://ixmp-dev/new model name/target scenario" \
report -m model.buildings "buildings all"


Base and destination scenarios
------------------------------

The following correspond to :file:`MESSAGE-BUILDINGS.py`, given with the comment “BM NPi (after "run_cdlinks_setup" for NPi). This has MACRO but here run MESSAGE only.”

.. code-block::

mix-models \
--url="ixmp://ixmp-dev/MESSAGEix-GLOBIOM 1.1-BM-R12-NGFS/NPi2020-con-prim-dir-ncr" \
buildings build-solve \
--dest="ixmp://ixmp-dev/MESSAGEix-GLOBIOM 1.1-BM-R12-NGFS/NPi2020-con-prim-dir-ncr-building"

If using ``clim_scen="2C"``, the following scenario is used as the reference scenario for prices:

.. code-block::

mix-models \
--url="ixmp://ixmp-dev/MESSAGEix-GLOBIOM 1.1-BM-R12-NGFS/NPi2020-con-prim-dir-ncr" \
buildings build-solve \
--climate-scen="ENGAGE_SSP2_v4.1.8/EN_NPi2020_1000f" \
--dest="ixmp://ixmp-dev/MESSAGEix-GLOBIOM 1.1-BM-R12-NGFS/NPi2020-con-prim-dir-ncr-building"

The following is commented in :file:`MESSAGE-BUILDINGS.py` with the comment “NOTE: this scenario has the updated GLOBIOM matrix.”

.. code-block::

mix-models \
--url="ixmp://ixmp-dev/MESSAGEix-GLOBIOM 1.1-M-R12-NGFS/baseline" \
buildings build-solve \
--dest="ixmp://ixmp-dev/MESSAGEix-GLOBIOM 1.1-BM-R12-NGFS/baseline"

The following correspond to :file:`MESSAGE-BUILDINGS-STURM.py`:

.. code-block::

mix-models \
--url="ixmp://ixmp-dev/MESSAGEix-GLOBIOM 1.1-M-R12-NGFS/baseline" \
buildings build-solve \
--dest="ixmp://ixmp-dev/MESSAGEix-GLOBIOM 1.1-BM-R12-EFC/baseline"

and:

.. code-block::

mix-models \
--url="ixmp://ixmp-dev/MESSAGEix-GLOBIOM 1.1-M-R12-NGFS/baseline" \
buildings build-solve \
--climate-scen="MESSAGEix-GLOBIOM 1.1-M-R12-NGFS/EN_NPi2020_1000" \
--dest="ixmp://ixmp-dev/MESSAGEix-GLOBIOM 1.1-BM-R12-EFC/baseline"

The following corresponds to :file:`reporting_EFC.py`:

.. code-block::

mix-models \
--url="ixmp://ixmp-dev/MESSAGEix-GLOBIOM 1.1-BM-R12-EFC/baseline#24" \
report -m model.buildings "buildings all"

Configuration
=============

The class :class:`.buildings.Config` defines all the options to which the code responds, as well as default values.
Values given in code or on the command line will override these.

.. autoclass:: message_ix_models.model.buildings.Config
:members:

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

.. currentmodule:: message_ix_models.model

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

buildings
6 changes: 6 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@
.. |y0| replace:: :math:`y_0`

.. |MESSAGEix| replace:: MESSAGE\ :emphasis:`ix`

.. |gh-350| replace::
This documentation and the related code was migrated from :mod:`message_data` ``dev``
branch as of commit 8213e6c (2025-05-08) in :pull:`350`.
It does not reflect further changes made on the :mod:`message_data` ``main`` branch,
other related branches, or in forks or other repositories.
"""


Expand Down
2 changes: 2 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Commonly used classes may be imported directly from :mod:`message_ix_models`.
:caption: Model variants

global/index
buildings/index
material/index
transport/index
water/index
Expand All @@ -101,6 +102,7 @@ Commonly used classes may be imported directly from :mod:`message_ix_models`.
project/ecemf
project/edits
project/elevate
project/engage
project/gea
project/geidco
project/genie
Expand Down
18 changes: 18 additions & 0 deletions doc/project/engage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ENGAGE
******

- Project website: https://engage-climate.org

.. caution:: |gh-350|

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

.. currentmodule:: message_ix_models.project

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

engage
20 changes: 20 additions & 0 deletions doc/project/navigate.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
NAVIGATE
********

“Next generation of AdVanced InteGrated Assessment modelling to support climaTE policy making”

- Project website: https://www.navigate-h2020.eu/about-the-project/structure/

.. caution:: |gh-350|

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

.. currentmodule:: message_ix_models.project

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

navigate
10 changes: 10 additions & 0 deletions doc/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ Next release
:func:`.shape_test_data`,
:func:`.ssp_test_data`,
:func:`.ssp_user_data`.
- Migrate code, data, and documentation for :doc:`buildings/index`, :doc:`ENGAGE project <project/engage>`, :doc:`NAVIGATE project <project/navigate>`, and 9 :mod:`.tools` submodules (:pull:`350`, :pull:`351`):
:mod:`.add_AFOLU_CO2_accounting`,
:mod:`.add_CO2_emission_constraint`,
:mod:`.add_FFI_CO2_accounting`,
:mod:`.add_alternative_TCE_accounting`,
:mod:`.add_budget`,
:mod:`.add_emission_trajectory`,
:mod:`.add_tax_emission`,
:mod:`.remove_emission_bounds`, and
:mod:`.update_h2_blending`.
- Bug fix: :program:`mix-models --verbose` command-line option was not stored on :class:`.Context`/:class:`~.util.Config` (:pull:`300`).
- 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`).
Expand Down
2 changes: 2 additions & 0 deletions message_ix_models/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,14 @@ def _log_threads(k: int, n: int):
#: Each of these should contain a function named ``cli`` decorated with @click.command
#: or @click.group.
submodules = [
"message_ix_models.model.buildings.cli",
"message_ix_models.model.cli",
"message_ix_models.model.structure",
"message_ix_models.model.transport.cli",
"message_ix_models.model.water.cli",
"message_ix_models.project.circeular.cli",
"message_ix_models.project.edits.cli",
"message_ix_models.project.navigate.cli",
"message_ix_models.project.ssp.cli",
"message_ix_models.report.cli",
"message_ix_models.model.material.cli",
Expand Down
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Loading
Loading