Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit b2b92c5a authored by Anthony's avatar Anthony
Browse files

Correction when looking for the outflow position when the HTU is artificial...

Correction when looking for the outflow position when the HTU is artificial (no Hydro data available for the grid point)
parent ed6ac3c0
......@@ -303,16 +303,23 @@ class HydroSuper :
lat = hydrogrid.ncfile.variables["nav_lat"][jstr:jend,0]
trip = hydrogrid.ncfile.variables["trip"][jstr:jend,istr:iend].astype(np.int32)
#
bounds = [np.ma.min(lon), np.ma.max(lon), np.ma.min(lat), np.ma.max(lat)]
grid = np.zeros(trip.shape, dtype = np.int32)
htu = np.zeros(trip.shape, dtype = np.int32)
for pt in range(self.nbpt):
for bs in range(self.basin_count[pt]):
latp, lonp = self.basin_outcoor[pt,bs,:]
# MERIT and HydoSHEDS are regular - quicker that way
i = np.where(lon==lonp)[0][0]
j = np.where(lat==latp)[0][0]
grid[j,i] = pt+1
htu[j,i] = bs+1
# If your hydrogrid is not regular, this have to change
#
# I suppose this just occurs for points outside the limits
# If another error still occurs here -> should use "try / except"
if (latp>=bounds[2])*(latp <= bounds[3]):
if (lonp>=bounds[0])*(lonp <= bounds[1]):
i = np.where(lon==lonp)[0][0]
j = np.where(lat==latp)[0][0]
grid[j,i] = pt+1
htu[j,i] = bs+1
# Possible to divide the function here -> but need to load again the lon/lat
halolist = [i for i in range(self.nbpt) if i not in part.landcorelist]
......@@ -468,17 +475,23 @@ class HydroSuper :
lat = hydrogrid.ncfile.variables["nav_lat"][jstr:jend,0]
trip = hydrogrid.ncfile.variables["trip"][jstr:jend,istr:iend].astype(np.int32)
#
bounds = [np.ma.min(lon), np.ma.max(lon), np.ma.min(lat), np.ma.max(lat)]
grid = np.zeros(trip.shape, dtype = np.int32)
htu = np.zeros(trip.shape, dtype = np.int32)
for pt in range(self.nbpt):
for bs in range(self.basin_count[pt]):
latp, lonp = self.basin_outcoor[pt,bs,:]
# MERIT and HydoSHEDS are regular - quicker that way
i = np.where(lon==lonp)[0][0]
j = np.where(lat==latp)[0][0]
grid[j,i] = pt+1
htu[j,i] = bs+1
# If your hydrogrid is not regular, this have to change
#
# I suppose this just occurs for points outside the limits
# If another error still occurs here -> should use "try / except"
if (latp>=bounds[2])*(latp <= bounds[3]):
if (lonp>=bounds[0])*(lonp <= bounds[1]):
i = np.where(lon==lonp)[0][0]
j = np.where(lat==latp)[0][0]
grid[j,i] = pt+1
htu[j,i] = bs+1
orog = hydrogrid.ncfile.variables["orog"][jstr:jend,istr:iend]
disto = hydrogrid.ncfile.variables["disto"][jstr:jend,istr:iend]
......
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