Commit 318c7152 authored by Anthony's avatar Anthony
Browse files

Small change to avoir error when sorted_outareas is smaller than largest_pos...

Small change to avoir error when sorted_outareas is smaller than largest_pos (it occurs in Pantanal_n48)
parent d64427ec
...@@ -355,15 +355,16 @@ class HydroSuper : ...@@ -355,15 +355,16 @@ class HydroSuper :
if part.size == 1 : if part.size == 1 :
maxdiff_sorted = 0.0 maxdiff_sorted = 0.0
else : else :
maxdiff_sorted = np.max(np.abs(sorted_outareas[0:largest_pos]-old_sorted)) l = min(sorted_outareas.shape[0],largest_pos)
old_sorted[:] = sorted_outareas[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 iter_count += 1
self.fetch_basin = np.copy(fetch_basin) self.fetch_basin = np.copy(fetch_basin)
# #
# Upstream area of the smalest river we call largest rivers. # 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]
# #
# #
# #
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment