Skip to content

Commit ab5b649

Browse files
hcwinsemiusvisr
authored andcommitted
caught exception in estimate_iterations_kin_wave when all map values are zero.
1 parent 33f321c commit ab5b649

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

wflow/wflow_funcs.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,12 @@ def set_dd(ldd, _ldd_us=_ldd_us, pit_value=_pits):
9999
###############################################################################
100100

101101
def estimate_iterations_kin_wave(Q, Beta, alpha, timestepsecs, dx, mv):
102-
103-
celerity = pcr.ifthen(Q > 0.0, 1.0 / (alpha * Beta * Q**(Beta-1)))
104-
courant = (timestepsecs / dx) * celerity
105-
np_courant = pcr.pcr2numpy(courant, mv)
102+
if (pcr.pcr2numpy(Q, mv)).max() > 0:
103+
celerity = pcr.ifthen(Q > 0.0, 1.0 / (alpha * Beta * Q**(Beta-1)))
104+
courant = (timestepsecs / dx) * celerity
105+
np_courant = pcr.pcr2numpy(courant, mv)
106+
else:
107+
np_courant = np.zeros(pcr.pcr2numpy(Q, mv).shape) + mv
106108
np_courant[np_courant==mv] = np.nan
107109
try:
108110
it_kin = int(np.ceil(1.25*(np.nanpercentile(np_courant,95))))

0 commit comments

Comments
 (0)