Skip to content

Commit

Permalink
chore: improve sim/obs df error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraney authored and hellkite500 committed Sep 20, 2024
1 parent 2978727 commit 729438c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions python/ngen_cal/src/ngen/cal/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@

def _objective_func(simulated_hydrograph, observed_hydrograph, objective, eval_range: tuple[datetime, datetime] | None = None):
df = pd.merge(simulated_hydrograph, observed_hydrograph, left_index=True, right_index=True)
if df.empty:
print("WARNING: Cannot compute objective function, do time indicies align?")
if eval_range:
df = df.loc[eval_range[0]:eval_range[1]]
#print( df )
if df.empty:
print("WARNING: Cannot compute objective function, do time indicies align?")
if eval_range:
print(f"\teval range: [{eval_range[0]!s} : {eval_range[1]!s}]")
print(f"\tsim interval: [{simulated_hydrograph.index.min()!s} : {simulated_hydrograph.index.max()!s}]")
print(f"\tobs interval: [{observed_hydrograph.index.min()!s} : {observed_hydrograph.index.max()!s}]")
#Evaluate custom objective function providing simulated, observed series
return objective(df['obs_flow'], df['sim_flow'])

Expand Down

0 comments on commit 729438c

Please sign in to comment.