Changeset 10 for branches/AllPostFred/libIGCM_config/libIGCM_config.ksh
- Timestamp:
- 05/30/08 10:10:34 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/AllPostFred/libIGCM_config/libIGCM_config.ksh
r7 r10 197 197 1Y|1y) 198 198 (( PeriodLengthInDays = $( IGCM_date_DaysInYear $year ) )) ;; 199 *Y|*y) 200 PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 201 echo "Number of years for PeriodLength : " $PeriodLengthInYears 202 (( PeriodLengthInDays = 0 )) 203 (( i=0 )) 204 until [ $i -ge $PeriodLengthInYears ] ; do 205 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) 206 (( i=i+1 )) 207 done 208 ;; 199 209 1M|1m) 200 210 (( PeriodLengthInDays = $( IGCM_date_DaysInMonth $year $month ) )) ;; 211 *M|*m) 212 PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 213 echo "Number of months for PeriodLength : " $PeriodLengthInMonths 214 typeset year1 215 (( year1=year )) 216 (( PeriodLengthInDays = 0 )) 217 (( i=0 )) 218 until [ $i -ge $PeriodLengthInMonths ] ; do 219 if [ $(( month + i )) -lt 13 ] ; then 220 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) 221 else 222 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) 223 fi 224 (( i=i+1 )) 225 done 226 ;; 201 227 5D|5d) 202 228 (( PeriodLengthInDays = 5 )) ;; 203 229 1D|1d) 204 230 (( PeriodLengthInDays = 1 )) ;; 231 *D|*d) 232 PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | awk -F '[dD]' '{print $1}' ) ;; 205 233 *) 206 IGCM_debug_Exit "IGCM_config_PeriodStart " ${config_UserChoices_PeriodLength} " invalid period length : choose in 1Y, 1M, 5D, 1D."234 IGCM_debug_Exit "IGCM_config_PeriodStart " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D, 5D, 1D." 207 235 IGCM_debug_Verif_Exit ;; 208 236 esac … … 273 301 1Y|1y) 274 302 (( PeriodLengthInDays = $( IGCM_date_DaysInYear $year ) )) ;; 303 *Y|*y) 304 PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 305 echo "Number of years for PeriodLength : " $PeriodLengthInYears 306 (( PeriodLengthInDays = 0 )) 307 (( i=0 )) 308 until [ $i -ge $PeriodLengthInYears ] ; do 309 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) 310 (( i=i+1 )) 311 done 312 ;; 275 313 1M|1m) 276 314 (( PeriodLengthInDays = $( IGCM_date_DaysInMonth $year $month ) )) ;; 315 *M|*m) 316 PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 317 echo "Number of months for PeriodLength : " $PeriodLengthInMonths 318 typeset year1 319 (( year1=year )) 320 (( PeriodLengthInDays = 0 )) 321 (( i=0 )) 322 until [ $i -ge $PeriodLengthInMonths ] ; do 323 if [ $(( month + i )) -lt 13 ] ; then 324 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) 325 else 326 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) 327 fi 328 (( i=i+1 )) 329 done 330 ;; 277 331 5D|5d) 278 332 (( PeriodLengthInDays=5 )) ;; 279 333 1D|1d) 280 334 (( PeriodLengthInDays=1 )) ;; 335 *D|*d) 336 PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | awk -F '[dD]' '{print $1}' ) ;; 281 337 *) 282 IGCM_debug_Exit "IGCM_config_PeriodStart " ${config_UserChoices_PeriodLength} " invalid period length : choose in 1Y, 1M, 5D, 1D."338 IGCM_debug_Exit "IGCM_config_PeriodStart " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D, 5D, 1D." 283 339 IGCM_debug_Verif_Exit ;; 284 340 esac … … 458 514 case ${config_UserChoices_PeriodLength} in 459 515 1Y|1y) PeriodLengthInDays=$( expr $( IGCM_date_DaysInYear $year ) ) ;; 516 *Y|*y) 517 PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 518 echo "Number of years for PeriodLength : " $PeriodLengthInYears 519 (( PeriodLengthInDays = 0 )) 520 (( i=0 )) 521 until [ $i -ge $PeriodLengthInYears ] ; do 522 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) 523 (( i=i+1 )) 524 done 525 ;; 460 526 1M|1m) PeriodLengthInDays=$( expr $( IGCM_date_DaysInMonth $year $month ) ) ;; 527 *M|*m) 528 PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 529 echo "Number of months for PeriodLength : " $PeriodLengthInMonths 530 typeset year1 531 (( year1=year )) 532 (( PeriodLengthInDays = 0 )) 533 (( i=0 )) 534 until [ $i -ge $PeriodLengthInMonths ] ; do 535 if [ $(( month + i )) -lt 13 ] ; then 536 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) 537 else 538 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) 539 fi 540 (( i=i+1 )) 541 done 542 ;; 461 543 5D|5d) PeriodLengthInDays=$( expr 5 ) ;; 462 544 1D|1d) PeriodLengthInDays=$( expr 1 ) ;; 545 *D|*d) 546 PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | awk -F '[dD]' '{print $1}' ) ;; 463 547 esac 464 548 PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateBegin} $( expr ${PeriodLengthInDays} - 1 ) )
Note: See TracChangeset
for help on using the changeset viewer.