From 1908158c649fcef24da8b23b663cd6af06e28569 Mon Sep 17 00:00:00 2001 From: Jan Polcher <jan.polcher@lmd.jussieu.fr> Date: Thu, 13 Jun 2019 08:08:53 +0200 Subject: [PATCH] Added a script to test the code on a laptop. Also some small corrections on the parallel processing. --- .gitignore | 3 ++- RoutingPreProc.py | 14 ++++++++------ SampleScripts/BuildHTUs_Mallorca.sh | 9 +++++++++ TestConfigs/run.def.WRF_local | 4 ++-- run.def | 13 +++++++------ 5 files changed, 28 insertions(+), 15 deletions(-) create mode 100755 SampleScripts/BuildHTUs_Mallorca.sh diff --git a/.gitignore b/.gitignore index f6e8423..1559e98 100644 --- a/.gitignore +++ b/.gitignore @@ -37,8 +37,9 @@ xcuserdata/ *.nc Weights/ __pycache__/ +run.def # # Test configurations and directories # DomainDecompTests/Output/ -DomainDecompTests/run.def \ No newline at end of file +DomainDecompTests/run.def diff --git a/RoutingPreProc.py b/RoutingPreProc.py index 5b79489..7128b04 100644 --- a/RoutingPreProc.py +++ b/RoutingPreProc.py @@ -37,12 +37,6 @@ log_master, log_world = getargs.getLogger() INFO, DEBUG, ERROR = log_master.info, log_master.debug, log_world.error INFO_ALL, DEBUG_ALL = log_world.info, log_world.debug # -# Verify directories -# -wdir="Weights" -if not os.path.exists(wdir) : - os.mkdir(wdir) -# # Read full grid and partition the domain. # gg = MG.GlobalGrid() @@ -52,6 +46,14 @@ szhalo=1 nbc=comm.Get_size() rank=comm.Get_rank() # +# Verify directories +# +wdir="Weights" +if rank == 0 : + if not os.path.exists(wdir) : + os.mkdir(wdir) +comm.Barrier() +# # Region of grid to be treated # part = PA.partition(gg.ni, gg.nj, gg.land, comm, nbc, szhalo, rank) diff --git a/SampleScripts/BuildHTUs_Mallorca.sh b/SampleScripts/BuildHTUs_Mallorca.sh new file mode 100755 index 0000000..a4a4d19 --- /dev/null +++ b/SampleScripts/BuildHTUs_Mallorca.sh @@ -0,0 +1,9 @@ +#/bin/bash +# +# A small test case which can run on a laptop. +# The MEDCORDEX grid is used over the Mallorca island. +# +cd ./.. +cp TestConfigs/run.def.WRF_local ./run.def +# +mpirun -n 4 python RoutingPreProc.py diff --git a/TestConfigs/run.def.WRF_local b/TestConfigs/run.def.WRF_local index eec206e..f65aa6e 100644 --- a/TestConfigs/run.def.WRF_local +++ b/TestConfigs/run.def.WRF_local @@ -24,5 +24,5 @@ GraphFile = test_graph.nc # Diagnostics # You need to provide an interval in longitude and Latitude. # -DiagLon = 2.9, 3.9 -DiagLat = 38.8, 40.0 +DiagLon = 3.9, 3.9 +DiagLat = 40.0, 40.0 diff --git a/run.def b/run.def index da6ccc4..f65aa6e 100644 --- a/run.def +++ b/run.def @@ -3,10 +3,11 @@ # 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 -HydroFile = /bdd/MEDI/workspaces/polcher/NewRouting/routing_MED.nc +ModelGridFile = /home/polcher/WORK/Data/NewRouting/geo_em.d01.nc +# Mallorca +WEST_EAST = 2.3, 3.5 +SOUTH_NORTH = 39.00, 40.1 +HydroFile = /home/polcher/WORK/Data/NewRouting/routing_MED.nc # # FORTRAN interface parameters # @@ -18,10 +19,10 @@ nbasmax = 35 # # Output # -GraphFile = EM_WFDEI_test_graph.nc +GraphFile = test_graph.nc # # Diagnostics # You need to provide an interval in longitude and Latitude. # -DiagLon = 39.9, 39.9 +DiagLon = 3.9, 3.9 DiagLat = 40.0, 40.0 -- GitLab