Skip to content

Conversation

@Wegatriespython
Copy link
Contributor

Fix for issue #404

This PR fixes the issues outline in #404:

  • fix loop exit conditions
  • add missing IO for techs
  • increases test coverage to ensure the bug is properly detected and there is no inadvertent regression.

How to review

  • Double check the mode value correspondences for M1 an Mf and the raw data source file.
  • Read the diff and verify tests pass.

PR checklist

  • Continuous integration checks all ✅
  • Add or expand tests; coverage checks both ✅

@Wegatriespython Wegatriespython self-assigned this Aug 14, 2025
@Wegatriespython Wegatriespython added the water MESSAGEix-Nexus (water) variant label Aug 14, 2025
- Input level at water_avail_basin
- Input commodity surfacewater_basin

- output level water_supply
- output commodity freshwater
consolidate return logic
Now water return flows follow a single path:
cooling techs -> water_return commodity -> reg_to_basin tech ->
surfacewater_basin
Bound = histroical cap at last historical year.
- Code was very messy
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.

Just leaving some comments.
Still need to look at water_for_ppl and water_supply. probably tomorrow

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to make the text both for R11 and R12? it looks like it's mostly checking data

Copy link
Contributor

Choose a reason for hiding this comment

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

same, basically. can we make sure also previous cases, which are not necessarily discontinued, also work as expected?
could we text both global and country cases? if the data is available, it should work

"input",
technology=rows["tec"],
value=rows["value_mid"],
value=rows["value_high"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Just double check if this was a sensitivity you did or intentional

# which is the only explanation as to how the model solved.
for _, rows in df_elec.iterrows():
if rows["tec"] in techs:
# Check if this is a dummy technology (for distribution techs)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add a description to this function, clarifying that it is about electricity only?


# putting a lower bound on desalination tecs based on hist capacities
df_bound = df_hist[df_hist["year"] == firstyear]
df_bound = df_hist[df_hist["year"] == 2025] # firstyear dataabsent
Copy link
Contributor

Choose a reason for hiding this comment

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

please double check. firstmodelyear should be populated.
Preferibly we don't want hard-coded numbers.
It is also used two more times in this same script.

Add growth up for extract surface water
"technical_lifetime",
technology="extract_surfacewater",
value=50,
value=30,
Copy link
Contributor

Choose a reason for hiding this comment

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

was this just to test the 2060 bug or you want to keep this value?

Reduce growth act up for extract surface water to 0.2
Add assertions to test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

water MESSAGEix-Nexus (water) variant

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants