Commit 3eaecfa0 authored by POLCHER Jan's avatar POLCHER Jan 🚴🏾
Browse files

Some clean-up of the code

parent 20b3f417
...@@ -1987,7 +1987,7 @@ SUBROUTINE routing_reg_linkup(nbpt, neighbours, nwbas, basin_count, basin_area, ...@@ -1987,7 +1987,7 @@ SUBROUTINE routing_reg_linkup(nbpt, neighbours, nwbas, basin_count, basin_area,
! !
! !
!! PARAMETERS !! PARAMETERS
LOGICAL, PARAMETER :: debug = .TRUE. !! (true/false) LOGICAL, PARAMETER :: debug = .FALSE. !! (true/false)
! !
!_ ================================================================================================================================ !_ ================================================================================================================================
! !
...@@ -3258,8 +3258,6 @@ SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, num_la ...@@ -3258,8 +3258,6 @@ SUBROUTINE routing_reg_truncate(nbpt, nbasmax, gridarea, contfrac, nwbas, num_la
! !
DO ib = 1,nbpt DO ib = 1,nbpt
DO WHILE ( basin_count(ib) .GT. nbasmax ) DO WHILE ( basin_count(ib) .GT. nbasmax )
!
WRITE(numout,*) 'HAMMER, ib, basin_count :', ib, basin_count(ib)
! !
! Here we simply put the smallest basins into the largest ones. It is really a brute force ! Here we simply put the smallest basins into the largest ones. It is really a brute force
! method but it will only be applied if everything has failed. ! method but it will only be applied if everything has failed.
......
...@@ -204,7 +204,7 @@ class HydroSuper : ...@@ -204,7 +204,7 @@ class HydroSuper :
self.nbcoastal, self.coastal_basin, float(hydrodata.basinsmax)) self.nbcoastal, self.coastal_basin, float(hydrodata.basinsmax))
return return
# #
def fetch(self, part, modelgrid) : def fetch(self, part) :
# #
fetch_basin = np.zeros(self.basin_area.shape, dtype=np.float32, order='F') fetch_basin = np.zeros(self.basin_area.shape, dtype=np.float32, order='F')
# #
...@@ -245,8 +245,6 @@ class HydroSuper : ...@@ -245,8 +245,6 @@ class HydroSuper :
# #
# #
# #
yy=modelgrid.landscatter(np.sum(self.fetch_basin, axis=1)/np.sum(self.basin_area, axis=1))
print("Rank :"+str(part.rank)+" OUT of fetch =+=+=+=+=+=+=+=+=+= \n"+str(yy)+"\n =+=+=+=+=+=+=+=+=+=")
self.num_largest = routing_interface.rivclassification(part.landcorelist, self.basin_count, self.outflow_grid, self.outflow_basin, \ self.num_largest = routing_interface.rivclassification(part.landcorelist, self.basin_count, self.outflow_grid, self.outflow_basin, \
self.fetch_basin, self.largest_rivarea) self.fetch_basin, self.largest_rivarea)
print("Rank :"+str(part.rank)+" Area of smallest large rivers : ", self.largest_rivarea, " Nb of Large rivers on proc : ",self.num_largest) print("Rank :"+str(part.rank)+" Area of smallest large rivers : ", self.largest_rivarea, " Nb of Large rivers on proc : ",self.num_largest)
...@@ -255,7 +253,7 @@ class HydroSuper : ...@@ -255,7 +253,7 @@ class HydroSuper :
# #
# #
class HydroGraph : class HydroGraph :
def __init__(self, nbasmax, hydrosuper, part, modelgrid) : def __init__(self, nbasmax, hydrosuper, part) :
self.nbasmax = nbasmax self.nbasmax = nbasmax
self.routing_area, self.routing_cg, self.topo_resid, self.route_nbbasin, self.route_togrid, self.route_tobasin, self.route_nbintobas, \ self.routing_area, self.routing_cg, self.topo_resid, self.route_nbbasin, self.route_togrid, self.route_tobasin, self.route_nbintobas, \
self.global_basinid, self.route_outlet, self.route_type, self.origin_nbintobas, self.routing_fetch = \ self.global_basinid, self.route_outlet, self.route_type, self.origin_nbintobas, self.routing_fetch = \
...@@ -271,8 +269,6 @@ class HydroGraph : ...@@ -271,8 +269,6 @@ class HydroGraph :
self.num_largest = routing_interface.finalrivclass(part.landcorelist, self.route_togrid, self.route_tobasin, self.routing_fetch, \ self.num_largest = routing_interface.finalrivclass(part.landcorelist, self.route_togrid, self.route_tobasin, self.routing_fetch, \
hydrosuper.largest_rivarea) hydrosuper.largest_rivarea)
# #
yy=modelgrid.landscatter(np.sum(self.routing_fetch, axis=1)/np.sum(self.routing_area, axis=1))
print ("Rank :"+str(part.rank)+" OUT of truncate =+=+=+=+=+=+=+=+=+= \n"+str(yy)+"\n =+=+=+=+=+=+=+=+=+=")
return return
# #
def dumpnetcdf(self, filename, globalgrid, procgrid, part) : def dumpnetcdf(self, filename, globalgrid, procgrid, part) :
......
...@@ -172,9 +172,9 @@ del hoverlap ...@@ -172,9 +172,9 @@ del hoverlap
gc.collect() gc.collect()
print("=================== Compute fetch ====================") print("=================== Compute fetch ====================")
hsuper.fetch(part, modelgrid) hsuper.fetch(part)
hgraph = IF.HydroGraph(nbasmax, hsuper, part, modelgrid) hgraph = IF.HydroGraph(nbasmax, hsuper, part)
hgraph.dumpnetcdf(OutGraphFile, gg, modelgrid, part) hgraph.dumpnetcdf(OutGraphFile, gg, modelgrid, part)
......
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