diff --git a/Interface.py b/Interface.py index 2e8639133dab68d340f61448c2243b55f117e32b..ebda3639c299db3840918b3d4b344ba9d2172a77 100644 --- a/Interface.py +++ b/Interface.py @@ -269,6 +269,9 @@ class HydroGraph : self.num_largest = routing_interface.finalrivclass(part.landcorelist, self.route_togrid, self.route_tobasin, self.routing_fetch, \ hydrosuper.largest_rivarea) # + nbpt = hydrosuper.basin_count.shape[0] + self.nbpt_proc = np.arange(1,nbpt+1) + self.proc = np.full(nbpt, part.rank) return # def dumpnetcdf(self, filename, globalgrid, procgrid, part) : @@ -349,6 +352,32 @@ class HydroGraph : else : area = np.zeros((1,1)) area[:,:] = part.gather(areas[:,:]) + # + # Environment + # nbpt_proc + subpt = procgrid.landscatter(self.nbpt_proc[:], order='F') + subpt = subpt.astype(vtyp, copy=False) + subpt[np.isnan(subpt)] = NCFillValue + if part.rank == 0 : + subptgrid = outnf.createVariable("nbpt_proc", vtyp, ('y','x'), fill_value=NCFillValue) + subptgrid.title = "gridpoint reference inside each proc" + subptgrid.units = "-" + else : + subptgrid = np.zeros((1,1,1)) + subptgrid[:,:] = part.gather(subpt) + # + # rank + procnum = procgrid.landscatter(self.proc[:], order='F') + procnum = procnum.astype(vtyp, copy=False) + procnum[np.isnan(procnum)] = NCFillValue + if part.rank == 0 : + procn = outnf.createVariable("proc_num", vtyp, ('y','x'), fill_value=NCFillValue) + procn.title = "rank" + procn.units = "-" + else : + procn = np.zeros((1,1,1)) + procn[:,:] = part.gather(procnum) + # # Variables # Once gathered on root_proc we transform them into float64. Careful, Integer variables do not have NaN ! diff --git a/RoutingPreProc.py b/RoutingPreProc.py index bdf36b56aa5d84a11e407f26af8bcb6396128977..eb56fe1dc0752664a84c366d63f69dd86015c1dd 100644 --- a/RoutingPreProc.py +++ b/RoutingPreProc.py @@ -128,12 +128,14 @@ print("nbasmax : ", nbasmax) # # Extract hydo data from file # +INFO("hydrodata") hydrodata = HG.HydroData(hydrogrid.ncfile, hydrogrid.box, sub_index) +INFO("nitiatmgrid") IF.initatmgrid(rank, nbcore, nbpt, modelgrid) - +INFO("hoverlap") hoverlap = IF.HydroOverlap(nbpt, nbvmax, sub_pts, sub_index, sub_area, sub_lon, sub_lat, modelgrid, hydrodata) # @@ -146,7 +148,7 @@ del sub_lon del sub_lat gc.collect() -if nbcore == 1 : +if rank ==0 : if lonint[0] != lonint[1] and latint[0] != latint[1] : DP.MAPPLOT("MapHydroGrid", lonint, latint, hoverlap, hoverlap.hierarchy_bx, modelgrid.polyll, title="Distance to ocean") @@ -154,13 +156,13 @@ hsuper = IF.HydroSuper(nbvmax, hydrodata, hoverlap) # # Plot the hydrological supermesh # -if nbcore == 1 : +if rank == 0 : if lonint[0] != lonint[1] and latint[0] != latint[1] : DP.SUPERMESHPLOT("MapSuperGrid_Beforelinkup", lonint, latint, hoverlap, hsuper, modelgrid.polyll) print("=================== LINKUP ====================") hsuper.linkup(hydrodata) -if nbcore == 1 : +if rank ==0 : if lonint[0] != lonint[1] and latint[0] != latint[1] : DP.SUPERMESHPLOT("MapSuperGrid_Afterlinkup", lonint, latint, hoverlap, hsuper, modelgrid.polyll) diff --git a/TestConfigs/run.def.05_CS b/TestConfigs/run.def.05_CS index da6ccc48b6a3f0c2fea9342797f37a39f9186373..d5b885c669a6d95ed2ce877030cb1f9d017d571f 100644 --- a/TestConfigs/run.def.05_CS +++ b/TestConfigs/run.def.05_CS @@ -4,8 +4,8 @@ EarthRadius = 6370000. # ModelGridFile = /bdd/MEDI/workspaces/polcher/NewRouting/EM_WFDEI_CRU_2000.nc -##WEST_EAST = -9.75, 5.25 -##SOUTH_NORTH = 36.1, 44.2 +WEST_EAST = -9.75, 5.25 +SOUTH_NORTH = 36.25, 44.25 HydroFile = /bdd/MEDI/workspaces/polcher/NewRouting/routing_MED.nc # # FORTRAN interface parameters @@ -23,5 +23,5 @@ GraphFile = EM_WFDEI_test_graph.nc # Diagnostics # You need to provide an interval in longitude and Latitude. # -DiagLon = 39.9, 39.9 -DiagLat = 40.0, 40.0 +DiagLon = -9.75, 5.25 +DiagLat = 36.25, 44.25