Skip to content

Commit

Permalink
caught exception in estimate_iterations_kin_wave when all map values …
Browse files Browse the repository at this point in the history
…are zero.
  • Loading branch information
hcwinsemius authored and visr committed Oct 28, 2020
1 parent 33f321c commit ab5b649
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions wflow/wflow_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,12 @@ def set_dd(ldd, _ldd_us=_ldd_us, pit_value=_pits):
###############################################################################

def estimate_iterations_kin_wave(Q, Beta, alpha, timestepsecs, dx, mv):

celerity = pcr.ifthen(Q > 0.0, 1.0 / (alpha * Beta * Q**(Beta-1)))
courant = (timestepsecs / dx) * celerity
np_courant = pcr.pcr2numpy(courant, mv)
if (pcr.pcr2numpy(Q, mv)).max() > 0:
celerity = pcr.ifthen(Q > 0.0, 1.0 / (alpha * Beta * Q**(Beta-1)))
courant = (timestepsecs / dx) * celerity
np_courant = pcr.pcr2numpy(courant, mv)
else:
np_courant = np.zeros(pcr.pcr2numpy(Q, mv).shape) + mv
np_courant[np_courant==mv] = np.nan
try:
it_kin = int(np.ceil(1.25*(np.nanpercentile(np_courant,95))))
Expand Down

0 comments on commit ab5b649

Please sign in to comment.