@@ -4,10 +4,11 @@ program mk_runofftbl
44!
55! !ARGUMENTS:
66!
7- ! Usage = "mk_runofftbl.x Gridname"
7+ ! Usage = "mk_runofftbl.x -g Gridname -v LBCSV "
88!
9- ! Gridname: a string that describes the grids associated with the atmosphere and ocean model configuration
9+ ! -g: Gridname: a string that describes the grids associated with the atmosphere and ocean model configuration
1010! eg, CF0180x6C_M6TP0072x0036-Pfafstetter
11+ ! -v: LBCSV : Land bcs version (F25, GM4, ICA, NL3, NL4, NL5, v06, v07, v08, v09, v10, v11, v12, ...)
1112!
1213! This program generates the runoff table *.trn and *.TRN files that are used in the Catchment model for
1314! directing runoff to its ocean sink. The inputs are (i) bcs geometry files associated with the Gridname
@@ -45,18 +46,19 @@ program mk_runofftbl
4546
4647 integer :: nxt, command_argument_count
4748 character * (128 ) :: arg
48- character * (128 ) :: Usage = " mk_runofftbl.x CF0180x6C_M6TP0072x0036-Pfafstetter"
49- character * (128 ) :: mapl_tp_file
49+ character * (128 ) :: Usage = " mk_runofftbl.x -g CF0180x6C_M6TP0072x0036-Pfafstetter -v v12"
50+ character * 5 :: LBCSV = ' UNDEF'
51+ character * 5 :: OUTLETV = ' UNDEF'
52+ character * 1 :: opt
5053
5154 ! ------------------------------------------------------------------
5255
5356 call get_environment_variable (" MAKE_BCS_INPUT_DIR" ,MAKE_BCS_INPUT_DIR)
54- fileLL= trim (MAKE_BCS_INPUT_DIR)// ' /land/route/Outlet_latlon.'
5557
5658 ! Read inputs -----------------------------------------------------
5759
5860 I = command_argument_count()
59- if (I /= 1 ) then
61+ if (I /= 4 ) then
6062 print * , " "
6163 print * , " Wrong number of input arguments, got: " , I
6264 print * , " Example usage with defaults: "
@@ -65,12 +67,45 @@ program mk_runofftbl
6567 print * , " "
6668 call exit(1 )
6769 end if
68-
70+
6971 nxt = 1
70- call get_command_argument(nxt, Gridname)
71- print * , " "
72- print * , " Working with input BCs string: " , Gridname
73- print * , " "
72+ call get_command_argument(nxt,arg)
73+ do while (arg(1 :1 )==' -' )
74+ opt= arg(2 :2 )
75+ if (len (trim (arg))==2 ) then
76+ nxt = nxt + 1
77+ call get_command_argument(nxt,arg)
78+ else
79+ arg = arg(3 :)
80+ end if
81+ select case (opt)
82+ case (' g' )
83+ Gridname = trim (arg)
84+ case (' v' )
85+ LBCSV = trim (arg)
86+ case default
87+ print * , " Wrong flag -" , opt
88+ print * , " Example usage with defaults: "
89+ print * , trim (Usage)
90+ call exit(1 )
91+ end select
92+ nxt = nxt + 1
93+ call get_command_argument(nxt,arg)
94+ end do
95+
96+ if (trim (LBCSV)==" v11" )then
97+ OUTLETV= " v1"
98+ else if (trim (LBCSV)==" v12" )then
99+ OUTLETV= " v2"
100+ else
101+ OUTLETV= " others"
102+ endif
103+
104+ if (trim (OUTLETV)==" v1" .or. trim (OUTLETV)==" v2" )then
105+ fileLL= trim (MAKE_BCS_INPUT_DIR)// ' /land/route/' // trim (OUTLETV)// ' /Outlet_latlon.'
106+ else
107+ fileLL= trim (MAKE_BCS_INPUT_DIR)// ' /land/route/v1/Outlet_latlon.'
108+ endif
74109
75110 ! ------------------------------------------------------------------
76111
@@ -112,7 +147,10 @@ program mk_runofftbl
112147 print * , " Determining river outlets to ocean:"
113148 print * , " - Output file: " , fileB
114149 print * , " "
115- call outlets_to_ocean(Gridname,lons,lats,nx,ny)
150+
151+ if (trim (OUTLETV)==" v1" .or. trim (OUTLETV)==" v2" )then
152+ call outlets_to_ocean(Gridname,lons,lats,nx,ny)
153+ endif
116154
117155 open (10 ,file= fileT, form= " formatted" , status= " old" )
118156
0 commit comments