Skip to content

Commit

Permalink
Fixes NaN HAND hydrotable bug
Browse files Browse the repository at this point in the history
Refs #950
  • Loading branch information
shawncrawley committed Nov 14, 2024
1 parent 59e831d commit dd49502
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,8 @@ def interpolate_stage(df_row, df_hydro):
# Filter the hydrotable to this hydroid and pull out discharge and stages into arrays
subset_hydro = df_hydro.loc[hydro_mask, ['discharge_cms', 'stage_m']]
if subset_hydro.empty:
return np.nan
return np.nan, np.nan, np.nan, np.nan, np.nan

subset_hydro = subset_hydro.sort_value('discahrge_cms')
discharges = subset_hydro['discharge_cms'].values
stages = subset_hydro['stage_m'].values
Expand All @@ -613,7 +613,7 @@ def interpolate_stage(df_row, df_hydro):

if np.isnan(interpolated_stage):
print(f"WARNING: Interpolated stage is NaN where hydro_id == {hydro_id}")
return np.nan
return np.nan, np.nan, np.nan, np.nan, np.nan

# Get the upper and lower values of the 1-ft hydrotable array that the current forecast / interpolated stage is at
hydrotable_index = np.searchsorted(discharges, forecast, side='right')
Expand Down

0 comments on commit dd49502

Please sign in to comment.