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

Commit 5b9dff5f authored by POLCHER Jan's avatar POLCHER Jan 🚴🏾
Browse files

Merge branch 'newdivbas' of gitlab.in2p3.fr:ipsl/lmd/intro/routingpp into newdivbas

parents c51869d2 f061f003
......@@ -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]
......
......@@ -72,9 +72,13 @@ class trunc:
with open("check.out","a+") as foo:
foo.write("Step 1 iter. {0}, maxops: {1}->max_bas : {2}\n".format(i, self.max_ops_num, max_bas))
INFO("Step 1 iter. {0}, maxops: {1}->max_bas : {2}".format(i, self.max_ops_num, max_bas))
if max_bas < self.nbasmax:
break
i+=1
hydrosuper.fetch(part)
comm.Barrier()
if max_bas <= self.nbasmax:
break
# Step 2 : HTUs going to the same neighbour
i = 1
......@@ -107,7 +111,9 @@ class trunc:
comm.Barrier()
hydrosuper.fetch(part)
#comm.Barrier()
i += 1
i += 1
if max_bas <= self.nbasmax:
break
# Step 3 : HTUs with the same ID
......@@ -138,7 +144,9 @@ class trunc:
INFO("Step 3 iter. {0} (halo) maxops: {1}->max_bas : {2}".format(i, self.max_ops_num_halo, max_bas))
hydrosuper.fetch(part)
comm.Barrier()
i += 1
i += 1
if max_bas <= self.nbasmax:
break
# Step 4 : HTUs going to the same point
......@@ -155,6 +163,8 @@ class trunc:
hydrosuper.fetch(part)
comm.Barrier()
i += 1
if max_bas <= self.nbasmax:
break
# Step 5 : Brutal method
......
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