From 318c7152c6185f0d0addcd8e61df0590359ddf4f Mon Sep 17 00:00:00 2001 From: Anthony <anthony.schrapffer@polytechnique.fr> Date: Thu, 16 Apr 2020 17:48:28 +0200 Subject: [PATCH] Small change to avoir error when sorted_outareas is smaller than largest_pos (it occurs in Pantanal_n48) --- Interface.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Interface.py b/Interface.py index 66a9767..71c0e66 100644 --- a/Interface.py +++ b/Interface.py @@ -355,15 +355,16 @@ class HydroSuper : if part.size == 1 : maxdiff_sorted = 0.0 else : - maxdiff_sorted = np.max(np.abs(sorted_outareas[0:largest_pos]-old_sorted)) - old_sorted[:] = sorted_outareas[0:largest_pos] + l = min(sorted_outareas.shape[0],largest_pos) + maxdiff_sorted = np.max(np.abs(sorted_outareas[0:largest_pos]-old_sorted[0:l])) + old_sorted[:l] = sorted_outareas[0:largest_pos] iter_count += 1 self.fetch_basin = np.copy(fetch_basin) # # Upstream area of the smalest river we call largest rivers. # - self.largest_rivarea = sorted_outareas[largest_pos-1] + self.largest_rivarea = sorted_outareas[l-1] # # # -- GitLab