- Timestamp:
- 2016-04-07T15:33:32+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UKMO/nemo_v3_6_STABLE_copy/NEMOGCM/TOOLS/SIREN/src/create_bathy.f90
r5783 r6436 8 8 !> @file 9 9 !> @brief 10 !> This program create fine grid bathymetry file.10 !> This program creates fine grid bathymetry file. 11 11 !> 12 12 !> @details … … 27 27 !> you could find a template of the namelist in templates directory. 28 28 !> 29 !> create_bathy.nam co mprise7 namelists:<br/>29 !> create_bathy.nam contains 7 namelists:<br/> 30 30 !> - logger namelist (namlog) 31 31 !> - config namelist (namcfg) … … 36 36 !> - output namelist (namout) 37 37 !> 38 !> @note39 !> All namelists have to be in file create_bathy.nam, however variables of40 !> those namelists are all optional.41 !>42 38 !> * _logger namelist (namlog)_:<br/> 43 39 !> - cn_logfile : log filename … … 49 45 !> - cn_varcfg : variable configuration file 50 46 !> (see ./SIREN/cfg/variable.cfg) 47 !> - cn_dumcfg : useless (dummy) configuration file, for useless 48 !> dimension or variable (see ./SIREN/cfg/dummy.cfg). 51 49 !> 52 50 !> * _coarse grid namelist (namcrs)_:<br/> … … 61 59 !> 62 60 !> * _variable namelist (namvar)_:<br/> 63 !> - cn_varinfo : list of variable and extra information about request(s)64 !> to be used.<br/>65 !> each elements of *cn_varinfo* is a string character66 !> (separated by ',').<br/>67 !> it is composed of the variable name follow by ':',68 !> then request(s) to be used on this variable.<br/>69 !> request could be:70 !> - int = interpolation method71 !> - ext = extrapolation method72 !> - flt = filter method73 !> - min = minimum value74 !> - max = maximum value75 !> - unt = new units76 !> - unf = unit scale factor (linked to new units)77 !>78 !> requests must be separated by ';'.<br/>79 !> order of requests does not matter.<br/>80 !>81 !> informations about available method could be find in @ref interp,82 !> @ref extrap and @ref filter modules.<br/>83 !> Example: 'Bathymetry: flt=2*hamming(2,3); min=0'84 !> @note85 !> If you do not specify a method which is required,86 !> default one is apply.87 !> @warning88 !> variable name must be __Bathymetry__ here.89 61 !> - cn_varfile : list of variable, and corresponding file.<br/> 90 62 !> *cn_varfile* is the path and filename of the file where find … … 108 80 !> - 'Bathymetry:5000,5000,5000/5000,3000,5000/5000,5000,5000' 109 81 !> 82 !> - cn_varinfo : list of variable and extra information about request(s) 83 !> to be used.<br/> 84 !> each elements of *cn_varinfo* is a string character 85 !> (separated by ',').<br/> 86 !> it is composed of the variable name follow by ':', 87 !> then request(s) to be used on this variable.<br/> 88 !> request could be: 89 !> - int = interpolation method 90 !> - ext = extrapolation method 91 !> - flt = filter method 92 !> - min = minimum value 93 !> - max = maximum value 94 !> - unt = new units 95 !> - unf = unit scale factor (linked to new units) 96 !> 97 !> requests must be separated by ';'.<br/> 98 !> order of requests does not matter.<br/> 99 !> 100 !> informations about available method could be find in @ref interp, 101 !> @ref extrap and @ref filter modules.<br/> 102 !> Example: 'Bathymetry: flt=2*hamming(2,3); min=0' 103 !> @note 104 !> If you do not specify a method which is required, 105 !> default one is apply. 106 !> @warning 107 !> variable name must be __Bathymetry__ here. 108 !> 110 109 !> * _nesting namelist (namnst)_:<br/> 111 110 !> - in_rhoi : refinement factor in i-direction … … 127 126 !> - extrapolate all land points. 128 127 !> - allow to change unit. 128 !> @date September, 2015 129 !> - manage useless (dummy) variable, attributes, and dimension 130 !> @date January,2016 131 !> - add create_bathy_check_depth as in create_boundary 132 !> - add create_bathy_check_time as in create_boundary 133 !> @date February, 2016 134 !> - do not closed sea for east-west cyclic domain 129 135 ! 130 136 !> @todo 131 !> - use create_bathy_check_depth as in create_boundary132 !> - use create_bathy_check_time as in create_boundary133 137 !> - check tl_multi is not empty 134 138 !> … … 167 171 INTEGER(i4) :: il_status 168 172 INTEGER(i4) :: il_fileid 169 INTEGER(i4) :: il_varid170 173 INTEGER(i4) :: il_attid 171 174 INTEGER(i4) :: il_imin0 … … 179 182 180 183 LOGICAL :: ll_exist 184 LOGICAL :: ll_fillclosed 181 185 182 186 TYPE(TMPP) :: tl_coord0 … … 208 212 ! namelist variable 209 213 ! namlog 210 CHARACTER(LEN=lc) :: cn_logfile = 'create_bathy.log'211 CHARACTER(LEN=lc) :: cn_verbosity = 'warning'212 INTEGER(i4) :: in_maxerror = 5214 CHARACTER(LEN=lc) :: cn_logfile = 'create_bathy.log' 215 CHARACTER(LEN=lc) :: cn_verbosity = 'warning' 216 INTEGER(i4) :: in_maxerror = 5 213 217 214 218 ! namcfg 215 CHARACTER(LEN=lc) :: cn_varcfg = 'variable.cfg' 219 CHARACTER(LEN=lc) :: cn_varcfg = './cfg/variable.cfg' 220 CHARACTER(LEN=lc) :: cn_dumcfg = './cfg/dummy.cfg' 216 221 217 222 ! namcrs 218 CHARACTER(LEN=lc) :: cn_coord0 = ''219 INTEGER(i4) :: in_perio0 = -1223 CHARACTER(LEN=lc) :: cn_coord0 = '' 224 INTEGER(i4) :: in_perio0 = -1 220 225 221 226 ! namfin 222 CHARACTER(LEN=lc) :: cn_coord1 = ''223 INTEGER(i4) :: in_perio1 = -1224 LOGICAL :: ln_fillclosed = .TRUE.227 CHARACTER(LEN=lc) :: cn_coord1 = '' 228 INTEGER(i4) :: in_perio1 = -1 229 LOGICAL :: ln_fillclosed = .TRUE. 225 230 226 231 ! namvar 232 CHARACTER(LEN=lc), DIMENSION(ip_maxvar) :: cn_varfile = '' 227 233 CHARACTER(LEN=lc), DIMENSION(ip_maxvar) :: cn_varinfo = '' 228 CHARACTER(LEN=lc), DIMENSION(ip_maxvar) :: cn_varfile = ''229 234 230 235 ! namnst 231 INTEGER(i4) :: in_rhoi = 1232 INTEGER(i4) :: in_rhoj = 1236 INTEGER(i4) :: in_rhoi = 1 237 INTEGER(i4) :: in_rhoj = 1 233 238 234 239 ! namout 235 CHARACTER(LEN=lc) :: cn_fileout = 'bathy_fine.nc'240 CHARACTER(LEN=lc) :: cn_fileout = 'bathy_fine.nc' 236 241 !------------------------------------------------------------------- 237 242 … … 242 247 243 248 NAMELIST /namcfg/ & !< configuration namelist 244 & cn_varcfg !< variable configuration file 249 & cn_varcfg, & !< variable configuration file 250 & cn_dumcfg !< dummy configuration file 245 251 246 252 NAMELIST /namcrs/ & !< coarse grid namelist … … 254 260 255 261 NAMELIST /namvar/ & !< variable namelist 256 & cn_var info, & !< list of variable and interpolation method to be used. (ex: 'votemper:linear','vosaline:cubic' )257 & cn_var file !< list of variable file262 & cn_varfile, & !< list of variable file 263 & cn_varinfo !< list of variable and interpolation method to be used. (ex: 'votemper:linear','vosaline:cubic' ) 258 264 259 265 NAMELIST /namnst/ & !< nesting namelist … … 302 308 CALL var_def_extra(TRIM(cn_varcfg)) 303 309 310 ! get dummy variable 311 CALL var_get_dummy(TRIM(cn_dumcfg)) 312 ! get dummy dimension 313 CALL dim_get_dummy(TRIM(cn_dumcfg)) 314 ! get dummy attribute 315 CALL att_get_dummy(TRIM(cn_dumcfg)) 316 304 317 READ( il_fileid, NML = namcrs ) 305 318 READ( il_fileid, NML = namfin ) … … 309 322 ! match variable with file 310 323 tl_multi=multi_init(cn_varfile) 311 324 312 325 READ( il_fileid, NML = namnst ) 313 326 READ( il_fileid, NML = namout ) … … 322 335 323 336 PRINT *,"ERROR in create_bathy: can't find "//TRIM(cl_namelist) 337 STOP 324 338 325 339 ENDIF … … 343 357 & "check namelist") 344 358 ENDIF 359 360 ! do not closed sea for east-west cyclic domain 361 ll_fillclosed=ln_fillclosed 362 IF( tl_coord1%i_perio == 1 ) ll_fillclosed=.FALSE. 345 363 346 364 ! check … … 417 435 418 436 ! get or check depth value 419 IF( tl_multi%t_mpp(ji)%t_proc(1)%i_depthid /= 0 )THEN 420 il_varid=tl_multi%t_mpp(ji)%t_proc(1)%i_depthid 421 IF( ASSOCIATED(tl_depth%d_value) )THEN 422 tl_tmp=iom_mpp_read_var(tl_mpp,il_varid) 423 IF( ANY( tl_depth%d_value(:,:,:,:) /= & 424 & tl_tmp%d_value(:,:,:,:) ) )THEN 425 CALL logger_fatal("CREATE BATHY: depth value from "//& 426 & TRIM(tl_multi%t_mpp(ji)%c_name)//" not conform "//& 427 & " to those from former file(s).") 428 ENDIF 429 CALL var_clean(tl_tmp) 430 ELSE 431 tl_depth=iom_mpp_read_var(tl_mpp,il_varid) 432 ENDIF 433 ENDIF 437 CALL create_bathy_check_depth( tl_mpp, tl_depth ) 434 438 435 439 ! get or check time value 436 IF( tl_multi%t_mpp(ji)%t_proc(1)%i_timeid /= 0 )THEN 437 il_varid=tl_multi%t_mpp(ji)%t_proc(1)%i_timeid 438 IF( ASSOCIATED(tl_time%d_value) )THEN 439 tl_tmp=iom_mpp_read_var(tl_mpp,il_varid) 440 IF( ANY( tl_time%d_value(:,:,:,:) /= & 441 & tl_tmp%d_value(:,:,:,:) ) )THEN 442 CALL logger_fatal("CREATE BATHY: time value from "//& 443 & TRIM(tl_multi%t_mpp(ji)%c_name)//" not conform "//& 444 & " to those from former file(s).") 445 ENDIF 446 CALL var_clean(tl_tmp) 447 ELSE 448 tl_time=iom_mpp_read_var(tl_mpp,il_varid) 449 ENDIF 450 ENDIF 440 CALL create_bathy_check_time( tl_mpp, tl_time ) 451 441 452 442 ! close mpp file 453 443 CALL iom_mpp_close(tl_mpp) 454 444 455 IF( ANY( tl_mpp%t_dim(1:2)%i_len /=&456 & tl_coord0%t_dim(1:2)%i_len) )THEN445 IF( ANY(tl_mpp%t_dim(1:2)%i_len /= tl_coord0%t_dim(1:2)%i_len).OR.& 446 & ALL(il_rho(:)==1) )THEN 457 447 !- extract bathymetry from fine grid bathymetry 458 448 DO jj=1,tl_multi%t_mpp(ji)%t_proc(1)%i_nvar … … 505 495 506 496 ! fill closed sea 507 IF( l n_fillclosed )THEN497 IF( ll_fillclosed )THEN 508 498 ALLOCATE( il_mask(tl_var(jk)%t_dim(1)%i_len, & 509 499 & tl_var(jk)%t_dim(2)%i_len) ) … … 526 516 & dl_minbat <= 0._dp )THEN 527 517 CALL logger_debug("CREATE BATHY: min value "//TRIM(fct_str(dl_minbat))) 528 CALL logger_ error("CREATE BATHY: Bathymetry has value <= 0")518 CALL logger_fatal("CREATE BATHY: Bathymetry has value <= 0") 529 519 ENDIF 530 520 … … 973 963 CALL dom_del_extra( tl_var, tl_dom, il_rho(:) ) 974 964 965 CALL dom_clean_extra( tl_dom ) 966 975 967 !- add ghost cell 976 968 CALL grid_add_ghost(tl_var,tl_dom%i_ghost(:,:)) … … 1109 1101 1110 1102 END SUBROUTINE create_bathy_interp 1103 !------------------------------------------------------------------- 1104 !> @brief 1105 !> This subroutine get depth variable value in an open mpp structure 1106 !> and check if agree with already input depth variable. 1107 !> 1108 !> @details 1109 !> 1110 !> @author J.Paul 1111 !> @date January, 2016 - Initial Version 1112 !> 1113 !> @param[in] td_mpp mpp structure 1114 !> @param[inout] td_depth depth variable structure 1115 !------------------------------------------------------------------- 1116 SUBROUTINE create_bathy_check_depth( td_mpp, td_depth ) 1117 1118 IMPLICIT NONE 1119 1120 ! Argument 1121 TYPE(TMPP) , INTENT(IN ) :: td_mpp 1122 TYPE(TVAR) , INTENT(INOUT) :: td_depth 1123 1124 ! local variable 1125 INTEGER(i4) :: il_varid 1126 TYPE(TVAR) :: tl_depth 1127 ! loop indices 1128 !---------------------------------------------------------------- 1129 1130 ! get or check depth value 1131 IF( td_mpp%t_proc(1)%i_depthid /= 0 )THEN 1132 1133 il_varid=td_mpp%t_proc(1)%i_depthid 1134 IF( ASSOCIATED(td_depth%d_value) )THEN 1135 1136 tl_depth=iom_mpp_read_var(td_mpp, il_varid) 1137 1138 IF( ANY( td_depth%d_value(:,:,:,:) /= & 1139 & tl_depth%d_value(:,:,:,:) ) )THEN 1140 1141 CALL logger_warn("CREATE BATHY: depth value from "//& 1142 & TRIM(td_mpp%c_name)//" not conform "//& 1143 & " to those from former file(s).") 1144 1145 ENDIF 1146 CALL var_clean(tl_depth) 1147 1148 ELSE 1149 td_depth=iom_mpp_read_var(td_mpp,il_varid) 1150 ENDIF 1151 1152 ENDIF 1153 1154 END SUBROUTINE create_bathy_check_depth 1155 !------------------------------------------------------------------- 1156 !> @brief 1157 !> This subroutine get date and time in an open mpp structure 1158 !> and check if agree with date and time already read. 1159 !> 1160 !> @details 1161 !> 1162 !> @author J.Paul 1163 !> @date January, 2016 - Initial Version 1164 !> 1165 !> @param[in] td_mpp mpp structure 1166 !> @param[inout] td_time time variable structure 1167 !------------------------------------------------------------------- 1168 SUBROUTINE create_bathy_check_time( td_mpp, td_time ) 1169 1170 IMPLICIT NONE 1171 1172 ! Argument 1173 TYPE(TMPP), INTENT(IN ) :: td_mpp 1174 TYPE(TVAR), INTENT(INOUT) :: td_time 1175 1176 ! local variable 1177 INTEGER(i4) :: il_varid 1178 TYPE(TVAR) :: tl_time 1179 1180 TYPE(TDATE) :: tl_date1 1181 TYPE(TDATE) :: tl_date2 1182 ! loop indices 1183 !---------------------------------------------------------------- 1184 1185 ! get or check depth value 1186 IF( td_mpp%t_proc(1)%i_timeid /= 0 )THEN 1187 1188 il_varid=td_mpp%t_proc(1)%i_timeid 1189 IF( ASSOCIATED(td_time%d_value) )THEN 1190 1191 tl_time=iom_mpp_read_var(td_mpp, il_varid) 1192 1193 tl_date1=var_to_date(td_time) 1194 tl_date2=var_to_date(tl_time) 1195 IF( tl_date1 - tl_date2 /= 0 )THEN 1196 1197 CALL logger_warn("CREATE BATHY: date from "//& 1198 & TRIM(td_mpp%c_name)//" not conform "//& 1199 & " to those from former file(s).") 1200 1201 ENDIF 1202 CALL var_clean(tl_time) 1203 1204 ELSE 1205 td_time=iom_mpp_read_var(td_mpp,il_varid) 1206 ENDIF 1207 1208 ENDIF 1209 1210 END SUBROUTINE create_bathy_check_time 1111 1211 END PROGRAM create_bathy
Note: See TracChangeset
for help on using the changeset viewer.