Skip to content

Add CoC (Cost of Capital) feature parameterized by international climate finance level#455

Draft
yiyi1991 wants to merge 23 commits intomainfrom
coc
Draft

Add CoC (Cost of Capital) feature parameterized by international climate finance level#455
yiyi1991 wants to merge 23 commits intomainfrom
coc

Conversation

@yiyi1991
Copy link
Copy Markdown
Contributor

This PR adds the CoC (Cost of Capital) feature for issue #428 .

  • introduce international climate finance level as a key external parameter
  • currently only covers power generation technologies (to be extended to energy demand technologies)
  • examines how the weighted average cost of capital (WACC) of power generation technologies dynamically reacts to the (cumulative) international climate finance (ICF)
  • projects future WACC
  • separates the cost of capital part from the overall investment cost
  • applies to any R12 starting scenarios
  • can be run by CLI commands

TODO
(key functions there, scenario runs finished, slowly clearing up...)

  • add documentation
  • fix hard-coded indicator generation in WACC projection
  • add starting scenario and output scenario in the CLI options
  • add tests
  • one more regression package linearmodels needs to be installed in user's environment

How to review

  • Read the diff and note that the CI checks all pass.
  • Run mix-models coc run --from="base" "coc reported" --dry-run and check if the workflow successfully generated.
  • xxx
  • If the documentation makes sense.
  • Ensure that changes/additions are self-documenting, i.e. that another developer (someone like the reviewer) will be able to understand what the code does in the future.

PR checklist

  • Continuous integration checks all ✅
  • Add or expand tests; coverage checks both ✅
  • Add, expand, or update documentation.
  • Update doc/whatsnew.

@yiyi1991 yiyi1991 self-assigned this Nov 12, 2025
@yiyi1991 yiyi1991 requested review from adrivinca and khaeru November 12, 2025 16:00
@yiyi1991 yiyi1991 added the paper Work related to specific papers label Nov 12, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 12, 2025

Codecov Report

❌ Patch coverage is 2.40770% with 608 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.0%. Comparing base (cb47229) to head (362521b).
⚠️ Report is 73 commits behind head on main.

Files with missing lines Patch % Lines
message_ix_models/project/investment/workflow.py 0.0% 196 Missing ⚠️
...sage_ix_models/project/investment/2_Generate_CF.py 0.0% 107 Missing ⚠️
..._ix_models/project/investment/3_WACC_Projection.py 0.0% 106 Missing ⚠️
...x_models/project/investment/4_Generate_inv_cost.py 0.0% 88 Missing ⚠️
...ge_ix_models/project/investment/1_FE_Regression.py 0.0% 64 Missing ⚠️
...ssage_ix_models/project/investment/Region_utils.py 0.0% 24 Missing ⚠️
message_ix_models/project/investment/cli.py 39.4% 23 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #455     +/-   ##
=======================================
- Coverage   75.6%   73.0%   -2.6%     
=======================================
  Files        278     285      +7     
  Lines      22740   23363    +623     
=======================================
- Hits       17201   17067    -134     
- Misses      5539    6296    +757     
Files with missing lines Coverage Δ
message_ix_models/cli.py 93.4% <ø> (ø)
message_ix_models/project/investment/cli.py 39.4% <39.4%> (ø)
...ssage_ix_models/project/investment/Region_utils.py 0.0% <0.0%> (ø)
...ge_ix_models/project/investment/1_FE_Regression.py 0.0% <0.0%> (ø)
...x_models/project/investment/4_Generate_inv_cost.py 0.0% <0.0%> (ø)
..._ix_models/project/investment/3_WACC_Projection.py 0.0% <0.0%> (ø)
...sage_ix_models/project/investment/2_Generate_CF.py 0.0% <0.0%> (ø)
message_ix_models/project/investment/workflow.py 0.0% <0.0%> (ø)

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@@ -0,0 +1,299 @@
# ==============================
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire file can be dropped by using existing code:

  • .util.pycountry
    • This project should extend the COUNTRY_NAME mapping in that module (instead of defining manual_map, below), then call the function iso_3166_alpha_3().
  • .model.structure.
    • This project can call get_codelist("node/R12") and then derive the structural info necessary from the code list.

Please ask if there is any lack of clarity or examples in existing code, or if it's not evident how to make the substitution.

@@ -0,0 +1 @@
"""Runs with cost of capital in MESSAGE."""
Copy link
Copy Markdown
Member

@khaeru khaeru Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel the top-level module name message_ix_models.project.investment might lead to confusion in the future if there are multiple projects that deal with investment (seems likely). Some ways to disambiguate would be to add a two-digit year to the module name:

  • message_ix_models.project.coc_25
  • message_ix_models.project.investment_25

The choice of a CLI entry point mix-models coc points to the former.

"message_ix_models.project.edits.cli",
"message_ix_models.project.navigate.cli",
"message_ix_models.project.ssp.cli",
"message_ix_models.project.investment.cli", # cli run name by coc
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the list sorted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

paper Work related to specific papers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants