- Timestamp:
- Aug 12, 2014, 10:52:35 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/WRF+LMDZ_launch.bash
r29 r167 1 #!/bin/bash 1 #!/bin/bash 2 2 ## g.e. # WRF+LMDZ_launch.bash 19790101000000 19800101000000 28 /d4/lflmd/etudes/WRF_LMDZ/test_phylmd/AR40.0/control 3 3 ## g.e. # WRF+LMDZ_launch.bash 19790101000000 19800101000000 month /d4/lflmd/etudes/WRF_LMDZ/test_phylmd/AR40.0/control … … 14 14 else 15 15 16 checking_date() { 17 # Function to check date (in [YYYY][MM][DD][HH][MI][SS] format) 18 fname='checking_date' 19 20 errfunc='ERROR -- error -- ERROR -- error' 21 22 datev=$1 23 24 Ldate=`expr length ${datev}` 25 if test ${Ldate} -ne 14; then 26 echo ${errfunc} 27 echo " "${fname}": date '"${datev}"' does not have the appropriated length: " \ 28 ${Ldate}" should be: 14 !!!!" 29 exit 30 fi 31 32 yr=${datev:0:4} 33 mon=${datev:4:2} 34 day=${datev:6:2} 35 YMD1=${datev:0:8} 36 hour=${datev:8:2} 37 min=${datev:10:2} 38 sec=${datev:12:2} 39 40 datefmt=${yr}'/'${mon}'/'${day}' '${hour}':'${min}':'${sec} 41 # Checking individually 42 # 43 # yr 44 chkyr=`date -d"${yr}0101"` 45 if test $? -ne 0; then 46 echo ${errfunc} 47 echo " "${fname}": "${datefmt}" wrong year '"${yr}"' !!!!" 48 exit 49 fi 50 # mon 51 chkyr=`date -d"${yr}${mon}01"` 52 if test $? -ne 0; then 53 echo ${errfunc} 54 echo " "${fname}": "${datefmt}" wrong month '"${mon}"' !!!!" 55 exit 56 fi 57 # day 58 chkyr=`date -d"${yr}${mon}${day}"` 59 if test $? -ne 0; then 60 echo ${errfunc} 61 echo " "${fname}": "${datefmt}" wrong day '"${day}"' !!!!" 62 exit 63 fi 64 # hour 65 if test ${hour} -gt 23; then 66 echo ${errfunc} 67 echo " "${fname}": "${datefmt}" wrong hour '"${hour}"' !!!!" 68 exit 69 fi 70 # minute 71 if test ${min} -gt 59; then 72 echo ${errfunc} 73 echo " "${fname}": "${datefmt}" wrong minute '"${min}"' !!!!" 74 exit 75 fi 76 # second 77 if test ${sec} -gt 59; then 78 echo ${errfunc} 79 echo " "${fname}": "${datefmt}" wrong second '"${sec}"' !!!!" 80 exit 81 fi 82 # echo ${datefmt} 83 } 84 16 85 seconds_between_dates() { 17 86 # Functino to provide the seconds between two dates … … 102 171 fr=$3 103 172 173 # dd=`echo ${id:6:2} | awk '{print $1 + 0}'` 174 # day=`printf %d ${dd}` 175 104 176 day=`date -u "+%j" -d"${id:0:8}"` 105 177 … … 153 225 154 226 idate=${inidate} 155 isubperiod=1 156 157 if test ${restart} == 'true'; then 227 if test ${restart} = 'true'; then 228 isubperiod=2 229 else 230 isubperiod=1 231 fi 232 233 checking_date ${idate} 234 checking_date ${enddate} 235 236 if test ${restart} = 'true'; then 158 237 echo "Continuing the simulation from the last wrfrst" 159 238 else … … 179 258 ## 180 259 runperiod=true 181 if test ${restart} = ='true' && test -f ${odir}/wrfout/wrfrst_d01_${nextdate:0:4}-${nextdate:4:2}-${nextdate:6:2}_${nextdate:8:2}:${nextdate:10:2}:${nextdate:12:2}; then260 if test ${restart} = 'true' && test -f ${odir}/wrfout/wrfrst_d01_${nextdate:0:4}-${nextdate:4:2}-${nextdate:6:2}_${nextdate:8:2}:${nextdate:10:2}:${nextdate:12:2}; then 182 261 runperiod=false 262 else 263 runperiod=true 183 264 cp ${odir}/wrfout/wrfrst_d01_${idate:0:4}-${idate:4:2}-${idate:6:2}_${idate:8:2}:${idate:10:2}:${idate:12:2} ${odir} 184 265 echo " resuming the simulation from: "${idate:0:4}-${idate:4:2}-${idate:6:2}_${idate:8:2}:${idate:10:2}:${idate:12:2} 185 else186 runperiod=true187 266 fi 188 267
Note: See TracChangeset
for help on using the changeset viewer.