8000 Fix LISFLOOD Errors when no lakes or reservoirs in the domain. by nicola-martin · Pull Request #3 · SEED-FD/lisflood-code · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix LISFLOOD Errors when no lakes or reservoirs in the domain. #3

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

Open
wants to merge 3 commits into
base: seedfd_develop
Choose a base branch
from

Conversation

nicola-martin
Copy link

When running LISFLOOD over the SEED-FD domains there are errors for the domains that do not contain lakes/reservoirs due to missing expected input files. This is only a problem for warm starts.

This change adds a check to checkers.py so that if there are no lakes or reservoirs present then the input file check will not run for lakes/reservoirs.

The lisflood code already handles domains without lakes or reservoirs within the hydrological_modules/lakes.py and hydrological_modules/reservoir.py scripts so this deals with switching off the options in the model settings. This extra check just deals with the errors that happen before this stage when running checks on input files for model restarts.

The same logic that is used in hydrological_modules/lakes.py and hydrological_modules/reservoir.py, for determining where a lake/reservoir is present, is used in this new change to checkers.py.

Tests carried out:

  • lisflood-code/tests run with pytest. All 73 tests passed (fast and slow tests).
  • tested in longflow suite. Ran lisflood for the Juba-Shebelle basin and it successfully ran the model including warmstart/restart.

@nicola-martin nicola-martin requested a review from doc78 as a code owner March 5, 2025 15:32
@nicola-martin nicola-martin marked this pull request as draft March 5, 2025 15:40
@nicola-martin
Copy link
Author

Adding @corentincarton as a reviewer since this change relates to: ec-jrc#163

@nicola-martin nicola-martin marked this pull request as ready for review March 5, 2025 16:31
MaskMap = loadsetclone('MaskMap') # need to define mask map to use loadmap
LakeSitesC = loadmap(sites_dict[lake_type])
LakeSitesC[LakeSitesC < 1] = 0
LakeSitesCC = np.compress(LakeSitesC > 0, LakeSitesC)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually there is a missing step to really evaluate if the lake/reservoir should be simulated:

LakeSitesC[IsChannel == 0] = 0

The "IsChannel" array can be retrieved as follows:

IsChannelPcr = boolean(loadmap('Channels', pcr=True))
IsChannel = np.bool8(compressArray(IsChannelPcr))

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the code for the missing step @doc78!
I have added this to the lakes_present() function.
I tested to make sure the check still behaves as expected for domains without lakes/reservoirs. I also did a test using a Channels map file set to all zeros to make sure that lakes/reservoir simulation is switched off in this case. This worked as expected (though the model failed, which I think is because the file I modified did not match with the rest of the input map files).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0