Hack to accommodate Alaska glacially dammed lakes (GDLs) #553
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Issue
The Alaska domain contains six glacially dammed lakes. These waterbodies are unique in that they have zero area, their
lake_id
values are single digit integers, and the "synthetic" stream segments underlying the waterbodies have link ids that are the same as thelake_id
.Because there are matching
lake_id
andkey
values between thewaterbodies_df
andparam_df
for GDLs, theq0
data frame returned by__main__.new_nwm_q0
contains duplicate indices for each GDL. Which causes downstream issues. The root of this problem is a line incompute.py
, which insertslake_ids
into the list of segments (this line is repeated for all parallel options):Here, the
lake_segs
of GDLs are numbered the same as the synthetic stream segments underlying the GDL, which causes duplicate indices.As it turns out, t-route assumes that
lake_ids
are globally unique integers across all other waterbodies AND stream segment link ids. However, this is NOT assumed by the designers of the model hydrofabric.Hacky solution
The solution proposed in this pull request is to re-number the synthetic stream segment IDs underlying GDLs such that they are globally unique. This re-numbering needs to occur in two places: directly after reading-in the RouteLink file during the creation of
param_df
and again after reading-in the RouteLink file when creating theq0
dataframe, in cases where initial conditions are read from a WRF restart file.