Skip to content

Commit

Permalink
update logic becuase the waterbody_types_df_sub may be empty for sims…
Browse files Browse the repository at this point in the history
… without waterbodies" (#538)

Co-authored-by: awlostowski-noaa <[email protected]>
  • Loading branch information
awlostowski-noaa and awlostowski-noaa authored Mar 16, 2022
1 parent 29897f2 commit 8f6048d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/troute-routing/troute/routing/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ def _prep_reservoir_da_dataframes(reservoir_usgs_df, reservoir_usace_df, waterbo
else:
reservoir_usgs_df_sub = pd.DataFrame()
reservoir_usgs_df_time = pd.DataFrame().to_numpy().reshape(0,)
waterbody_types_df_sub.loc[waterbody_types_df_sub['reservoir_type'] == 2] = 1
if not waterbody_types_df_sub.empty:
waterbody_types_df_sub.loc[waterbody_types_df_sub['reservoir_type'] == 2] = 1

# select USACE reservoir DA data waterbodies in sub-domain
if not reservoir_usace_df.empty:
Expand All @@ -178,7 +179,8 @@ def _prep_reservoir_da_dataframes(reservoir_usgs_df, reservoir_usace_df, waterbo
else:
reservoir_usace_df_sub = pd.DataFrame()
reservoir_usace_df_time = pd.DataFrame().to_numpy().reshape(0,)
waterbody_types_df_sub.loc[waterbody_types_df_sub['reservoir_type'] == 3] = 1
if not waterbody_types_df_sub.empty:
waterbody_types_df_sub.loc[waterbody_types_df_sub['reservoir_type'] == 3] = 1

return reservoir_usgs_df_sub, reservoir_usgs_df_time, reservoir_usace_df_sub, reservoir_usace_df_time, waterbody_types_df_sub

Expand Down

0 comments on commit 8f6048d

Please sign in to comment.