Commit 141aa360 authored by Anthony's avatar Anthony
Browse files

IMPORTANT Update + small changes floodplains height

parent 500f4c1a
......@@ -158,7 +158,7 @@ class HydroOverlap :
#
#
class HydroSuper :
def __init__(self, nbvmax, hydrodata, hydrooverlap, nbasmax, part) :
def __init__(self, nbvmax, hydrodata, hydrooverlap, nbasmax, part, comm) :
#
# Keep largest possible number of HTUs
#
......@@ -214,6 +214,17 @@ class HydroSuper :
# Memory management
del basin_bbout; del basin_lshead; del coast_pts; del basin_bxout; del self.basin_pts;
del basin_outtp; del basin_outlet; del basin_inbxid; del nb_basin
#
# Correct all variables over the halo before the Linkup
# except : outflow_grid (corrected after linkup), basin_cg and basin_outcoor (not needed and not valid with part.landsendtohalo)
for variable in [self.basin_count, self.basin_notrun, self.basin_area, self.basin_hierarchy,\
self.basin_orog_mean,self.basin_orog_min,self.basin_orog_max,self.basin_floodp,\
self.basin_fac, self.basin_topoind, self.basin_id,self.basin_type,self.basin_flowdir,\
self.basin_lshead, self.outflow_basin,self.nbcoastal,self.coastal_basin]:
part.landsendtohalo(variable, order='F')
comm.Barrier()
#
#
return
#
def linkup(self, hydrodata) :
......@@ -315,8 +326,8 @@ class HydroSuper :
hg1 = np.copy(hg)
for a in outflows_out:
hg1[hg == a] = 0
for loc, glo in zip(nbpt_loc,nbpt_glo):
hg1[hg == glo[0]] = loc[0]
for ind in range(self.nbpt):
hg1[hg == nbpt_glo[ind,0]] = nbpt_loc[ind,0]
hg = hg1
del hg1
# Send Outflow basin to the halo and adapt it
......@@ -352,7 +363,15 @@ class HydroSuper :
basin_id = self.basin_id, basin_coor = self.basin_outcoor, basin_type = self.basin_type,\
basin_flowdir = self.basin_flowdir, outflow_grid = self.outflow_grid, outflow_basin = self.outflow_basin, \
inflow_number = self.inflow_number, inflow_grid = self.inflow_grid, inflow_basin = self.inflow_basin)
#
def get_floodcri(self):
nbxmax_tmp = self.inflow_grid.shape[2]
self.floodcri = routing_interface.get_floodcri(nbpt = self.nbpt,\
nwbas=self.nwbas, inflowmax = nbxmax_tmp, inflow_number = self.inflow_number,\
inflow_basin = self.inflow_basin, inflow_grid = self.inflow_grid, basin_count = self.basin_count,\
basin_floodp = self.basin_floodp, basin_orog_min = self.basin_orog_min)
#
def add_variable(self,outnf, procgrid, NCFillValue, part, coord, name, title, units, data, vtyp):
var = procgrid.landscatter(data.astype(vtyp), order='F')
......
......@@ -95,7 +95,7 @@ del w
gc.collect()
comm.Barrier()
hsuper = IF.HydroSuper(nbvmax, hydrodata, hoverlap, nbasmax, part)
hsuper = IF.HydroSuper(nbvmax, hydrodata, hoverlap, nbasmax, part, comm)
#
INFO("=================== LINKUP ====================")
hsuper.linkup(hydrodata)
......@@ -124,8 +124,9 @@ if DumpHydroSuper :
INFO("=================== Truncate ====================")
print("Rank : {0} - Basin_count Before Truncate : ".format(part.rank), hsuper.basin_count)
hs = TR(hsuper, part, comm, modelgrid, numop = numop)
TR(hsuper, part, comm, modelgrid, numop = numop)
print("Rank : {0} - Basin_count After Truncate : ".format(part.rank), hsuper.basin_count)
hsuper.get_floodcri()
INFO("=================== HydroGraph ====================")
hgraph = GR.HydroGraph(nbasmax, hsuper, part, modelgrid)
......
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