Skip to content

Conversation

@Wegatriespython
Copy link
Contributor

@Wegatriespython Wegatriespython commented Jul 16, 2025

Motivation

  • Water module has been dysfunctional. Model size has exploded to over 200 X 200 million with the new ssp scenarios.
  • Cplex is unable to report infeasibilities even with all slacks enabled.

Changes :

  • Units for electr input were previously left "-",
  • Units for infrastructure electr inp believed to be Kwh/m^3. source
  • Convert units to MCM basis and GWa/MCM for electr input.
  • Assuming Desalination electr inp units to be GWa/Km^3 and similar for water supply. *Other assumptions unit assumptions result in major mismatches.
  • Model size was excessive due to :
    • Share calib constraint for cooling ( commenting this out took size from 200X200 to 50X50)
    • map_yv_ya_lt : was making vintage activity combinations including historical vintage years leading to excess combinations.
    • duplicates in data generation. Overall size reduced to 16X16
  • Replace xslx files with csvs.

How to review

  • Go through unit changes and assumptions. Verify.
  • Evaluate reporting output.
  • Ask questions on new util for year vintage activity

PR checklist

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

@Wegatriespython Wegatriespython marked this pull request as draft July 16, 2025 15:58
@Wegatriespython Wegatriespython added water MESSAGEix-Nexus (water) variant p:GEIDCO GEIDCO project labels Jul 16, 2025
Copy link
Contributor

@adrivinca adrivinca left a comment

Choose a reason for hiding this comment

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

Thanks for the cleaning work!
I still have to go through tests.
here just some comments for keeping consistency and avoid forgetting about commented parts over time


land_out["value"] = 1e-3 * land_out["value"]
land_out["value"] = land_out["value"]
# FIX-ME : check if input is already in MCM as we are assumptions
Copy link
Contributor

Choose a reason for hiding this comment

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

if you have checked it by looking at the GDX, please update this comment and maybe leave a comment with the correct unit, but warning that this might change in different globiom matrix submissions

Copy link
Contributor

Choose a reason for hiding this comment

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

the gdx has MCM values, could you maybe note it here. so that we keep track at least. thanks

log.debug(f"cool_tech() for year '{year}'")
# Identify missing combinations in the current aggregate
input_cool_2015_set = set(
# FIXME : This should have been a one off script for debugging.
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure I understand/remember this. can you please explain? here on Github

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking of using a static yaml for the missing techs so we would be able to validate the combinations generated and ensure they make sense. Otherwise, for each run there is a risk of errors propagating

@adrivinca adrivinca added the safe to test PRs from forks that do not pose security risks label Jul 22, 2025
@codecov
Copy link

codecov bot commented Jul 22, 2025

Codecov Report

❌ Patch coverage is 99.27007% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 76.1%. Comparing base (a76db4e) to head (d93345c).
⚠️ Report is 408 commits behind head on main.

Files with missing lines Patch % Lines
message_ix_models/model/water/report.py 0.0% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #371     +/-   ##
=======================================
- Coverage   77.0%   76.1%   -0.9%     
=======================================
  Files        246     246             
  Lines      19819   19866     +47     
=======================================
- Hits       15270   15131    -139     
- Misses      4549    4735    +186     
Files with missing lines Coverage Δ
message_ix_models/model/water/build.py 74.3% <ø> (-20.7%) ⬇️
message_ix_models/model/water/data/demands.py 78.8% <100.0%> (+0.1%) ⬆️
...ssage_ix_models/model/water/data/infrastructure.py 100.0% <100.0%> (ø)
message_ix_models/model/water/data/irrigation.py 100.0% <ø> (ø)
...essage_ix_models/model/water/data/water_for_ppl.py 94.5% <100.0%> (-0.3%) ⬇️
message_ix_models/model/water/data/water_supply.py 76.5% <100.0%> (+0.2%) ⬆️
message_ix_models/model/water/utils.py 63.3% <100.0%> (+6.9%) ⬆️
...e_ix_models/tests/model/water/data/test_demands.py 100.0% <100.0%> (ø)
...dels/tests/model/water/data/test_infrastructure.py 100.0% <100.0%> (ø)
...odels/tests/model/water/data/test_water_for_ppl.py 100.0% <100.0%> (ø)
... and 3 more

... 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.

@adrivinca
Copy link
Contributor

@glatterf42 I did a first round of review and I am good with the current changes.
tests pass apart from for Python 3.9, as we already discussed.
Could you please also have a look and share your feedback?
once ready @Wegatriespython can update the Whatsnew file

We have more PRs coming after this, focusing on

  • the reporting script
  • new test suite
  • general updates to the non-technical documentation
    so, comments related to these will be addressed soon.
    thanks

@adrivinca adrivinca self-assigned this Jul 23, 2025
@adrivinca adrivinca removed the request for review from awais307 July 23, 2025 11:41
@Wegatriespython Wegatriespython marked this pull request as ready for review July 23, 2025 12:50
@Wegatriespython Wegatriespython removed the safe to test PRs from forks that do not pose security risks label Jul 23, 2025
@Wegatriespython Wegatriespython requested review from adrivinca and removed request for OFR-IIASA, khaeru, macflo8, r-aneeque and ywpratama July 23, 2025 13:13
@Wegatriespython Wegatriespython force-pushed the water_module_latest branch 2 times, most recently from 3bf0b7c to e00fddd Compare July 23, 2025 13:37
Wegatriespython added a commit to Wegatriespython/message-ix-models that referenced this pull request Jul 24, 2025
Wegatriespython added a commit to Wegatriespython/message-ix-models that referenced this pull request Jul 24, 2025
@Wegatriespython
Copy link
Contributor Author

@glatterf42 I've reworded the commits, and added to whatsnew

Copy link
Member

@glatterf42 glatterf42 left a comment

Choose a reason for hiding this comment

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

Thanks, this looks great. I'd just add an empty line here to enable the rendering as a headline (which I think is the intention).

@glatterf42
Copy link
Member

glatterf42 commented Jul 25, 2025

Thanks, there's just one more commit remaining: "Moving pol_scen out of if cond" should just be "Move pol_scen out of if cond". I'll approve the PR already, but please also fix this before merging :)

Ah, don't worry about the test case that's currently failing: this has nothing to do with your PR. It's fine to merge by bypassing the rules in this case 😃

@adrivinca
Copy link
Contributor

adrivinca commented Jul 25, 2025

why is the macos test stuck?
or can you merge anyway? I can't

@glatterf42
Copy link
Member

See #381 (comment), I've done a bit of digging, but no clear answer yet.

Yes, I could merge it if we all agree it's ready :)

adrivinca and others added 4 commits July 29, 2025 09:49
Fixing for ruff in demands.py
- for ScenarioInfo and Scenario inputs.
Update doc/whatsnew.rst

Co-authored-by: Fridolin Glatter <[email protected]>
@Wegatriespython
Copy link
Contributor Author

@glatterf42 I think its ready to merge. I did the changes for "Moving Pol scen..." and the update suggestion to whatsnew

@glatterf42
Copy link
Member

I've rerun the failing test, it should pass in about 30 minutes. If you don't want to wait that long, you can already merge this PR (or afterwards). According to our contributing guidelines, this should be done with a merge commit. GitHub's automatic commit message for that is fine, but please change the body of the commit message to say something like "Update & fix units and size of the water module".

@Wegatriespython Wegatriespython merged commit 945afcb into iiasa:main Jul 29, 2025
44 of 46 checks passed
@Wegatriespython Wegatriespython deleted the water_module_latest branch July 29, 2025 17:32
@macflo8 macflo8 mentioned this pull request Jul 31, 2025
4 tasks
Next release
============

Water/Nexus
Copy link
Member

Choose a reason for hiding this comment

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

@Wegatriespython @glatterf42 while reviewing #388 I noticed that this heading and the bullet list below have a leading indent of two spaces. In the built HTML docs, the heading does not appear and the list items don't match the rest of the list.

I'll correct the change in a commit on that branch, to align with the style used for previous releases.

In the future, please closely eyeball docs additions to make sure they render as you intend. The rest of the same file can be an example for formatting.

khaeru added a commit that referenced this pull request Aug 4, 2025
- Subsections for specific modules follow general list.
- Remove leading indent.
- Omit .model prefix from :mod:`…` links.
- Use nested lists for 2+ changes to the same submodule.
- Explain the acronym 'MCM', since this does not appear elsewhere in the
  documentation.
macflo8 pushed a commit that referenced this pull request Aug 6, 2025
- Subsections for specific modules follow general list.
- Remove leading indent.
- Omit .model prefix from :mod:`…` links.
- Use nested lists for 2+ changes to the same submodule.
- Explain the acronym 'MCM', since this does not appear elsewhere in the
  documentation.
yiyi1991 pushed a commit that referenced this pull request Aug 25, 2025
Update doc/whatsnew.rst

Co-authored-by: Fridolin Glatter <[email protected]>
yiyi1991 pushed a commit that referenced this pull request Aug 25, 2025
- Subsections for specific modules follow general list.
- Remove leading indent.
- Omit .model prefix from :mod:`…` links.
- Use nested lists for 2+ changes to the same submodule.
- Explain the acronym 'MCM', since this does not appear elsewhere in the
  documentation.
junukitashepard pushed a commit to junukitashepard/message-ix-models that referenced this pull request Oct 27, 2025
Update doc/whatsnew.rst

Co-authored-by: Fridolin Glatter <[email protected]>
junukitashepard pushed a commit to junukitashepard/message-ix-models that referenced this pull request Oct 27, 2025
- Subsections for specific modules follow general list.
- Remove leading indent.
- Omit .model prefix from :mod:`…` links.
- Use nested lists for 2+ changes to the same submodule.
- Explain the acronym 'MCM', since this does not appear elsewhere in the
  documentation.
junukitashepard pushed a commit that referenced this pull request Oct 30, 2025
Update doc/whatsnew.rst

Co-authored-by: Fridolin Glatter <[email protected]>
junukitashepard pushed a commit that referenced this pull request Oct 30, 2025
- Subsections for specific modules follow general list.
- Remove leading indent.
- Omit .model prefix from :mod:`…` links.
- Use nested lists for 2+ changes to the same submodule.
- Explain the acronym 'MCM', since this does not appear elsewhere in the
  documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p:GEIDCO GEIDCO project safe to test PRs from forks that do not pose security risks water MESSAGEix-Nexus (water) variant

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants