Commit fe9dce1f authored by Anthony's avatar Anthony
Browse files

Update Truncate for more equilibrated HTUs

parent 141aa360
......@@ -322,7 +322,6 @@ class trunc:
def get_changes_step1(self, npt):
changes = []
# outflow_grid = -2
A = np.where(self.outflow_grid[npt] == -2)[0]
if len(A)>1:
......@@ -360,6 +359,8 @@ class trunc:
else:
core.append(g)
area = np.sum(self.basin_area[npt])
# Establishing the list of changes
changes = []
......@@ -368,14 +369,16 @@ class trunc:
A = np.where(self.outflow_grid[npt] == k)[0]
if len(A)>1:
B = self.fetch[npt][A]
changes.append([A[k]+1 for k in np.argsort(B)])
C = self.basin_area[npt][A]
changes.append([A[k]+1 for k in np.argsort(B) if C[k]/area < 0.1])
elif neigh_domain == "halo":
for k in halo:
A = np.where(self.outflow_grid[npt] == k)[0]
if len(A)>1:
B = self.fetch[npt][A]
changes.append([A[k]+1 for k in np.argsort(B)])
C = self.basin_area[npt][A]
changes.append([A[k]+1 for k in np.argsort(B) if C[k]/area < 0.1])
return changes
......@@ -408,16 +411,19 @@ class trunc:
# Establishing the list of changes
changes = []
area = np.sum(self.basin_area[npt])
if neigh_domain == "core":
for c in core:
B = self.fetch[npt][c]
changes.append([c[k]+1 for k in np.argsort(B)])
C = self.basin_area[npt][A]
changes.append([c[k]+1 for k in np.argsort(B) if C[k]/area < 0.1])
elif neigh_domain == "halo":
for h in halo:
B = self.fetch[npt][h]
changes.append([h[k]+1 for k in np.argsort(B)])
C = self.basin_area[npt][h]
changes.append([h[k]+1 for k in np.argsort(B) if C[k]/area < 0.1])
return changes
......@@ -432,7 +438,8 @@ class trunc:
# Establishing the lists of changes
if len(htus)>0:
B = self.fetch[npt][htus]
tok = [htus[k]+1 for k in np.argsort(B)]
# np.flip -> to reduce the HTUs nummber over the main river
tok = [htus[k]+1 for k in np.flip(np.argsort(B))]
totak = [self.outflow_basin[npt][htus[k]] for k in np.argsort(B)]
return tok, totak
......
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