Skip to content
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

Hack to accommodate Alaska glacially dammed lakes (GDLs) #553

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

awlostowski-noaa
Copy link
Contributor

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

         LkArea     LkMxE  WeirC  WeirL  OrificeC  OrificeA  OrificeE        lat         lon       time     WeirE  ascendingIndex  ifd  Dam_Length crs
lake_id                                                                                                                                               
1           0.0  140.0000    0.0    0.0       0.0       0.0  140.0000  60.291977 -149.340302 2000-01-01  140.0000             168  1.0        10.0    
2           0.0   56.0000    0.0    0.0       0.0       0.0   56.0000  60.461060 -150.561066 2000-01-01   56.0000              31  1.0        10.0    
3           0.0    4.1238    0.0    0.0       0.0       0.0    4.1238  61.442162 -142.945206 2000-01-01    4.1238              32  1.0        10.0    
4           0.0    0.3910    0.0    0.0       0.0       0.0    0.3910  60.671307 -144.755157 2000-01-01    0.3910              33  1.0        10.0    
5           0.0    0.6549    0.0    0.0       0.0       0.0    0.6549  61.149956 -146.168121 2000-01-01    0.6549             158  1.0        10.0    
6           0.0    3.4860    0.0    0.0       0.0       0.0    3.4860  62.058807 -145.452637 2000-01-01    3.4860              45  1.0        10.0   

Because there are matching lake_id and key values between the waterbodies_df and param_df for GDLs, the q0 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 in compute.py, which inserts lake_ids into the list of segments (this line is repeated for all parallel options):

            param_df_sub = param_df_sub.reindex(
                param_df_sub.index.tolist() + lake_segs
            ).sort_index()

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 the q0 dataframe, in cases where initial conditions are read from a WRF restart file.

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.

1 participant