Changeset 28
- Timestamp:
- 11/03/08 12:22:16 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_config/libIGCM_config.ksh
r22 r28 201 201 202 202 case ${config_UserChoices_PeriodLength} in 203 1Y|1y) 204 (( PeriodLengthInDays = $( IGCM_date_DaysInYear $year ) )) ;; 205 1M|1m) 206 (( PeriodLengthInDays = $( IGCM_date_DaysInMonth $year $month ) )) ;; 207 5D|5d) 208 (( PeriodLengthInDays = 5 )) ;; 209 1D|1d) 210 (( PeriodLengthInDays = 1 )) ;; 203 *Y|*y) 204 PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 205 IGCM_debug_Print 1 "Number of years for PeriodLength : ${PeriodLengthInYears}" 206 PeriodLengthInDays=0 207 i=0 208 until [ $i -ge $PeriodLengthInYears ] ; do 209 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) 210 (( i=i+1 )) 211 done 212 ;; 213 *M|*m) 214 PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 215 IGCM_debug_Print 1 "Number of months for PeriodLength : ${PeriodLengthInMonths}" 216 typeset year1 217 PeriodLengthInDays=0 218 year1=year 219 i=0 220 until [ $i -ge $PeriodLengthInMonths ] ; do 221 if [ $(( month + i )) -lt 13 ] ; then 222 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) 223 else 224 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) 225 fi 226 (( i=i+1 )) 227 done 228 ;; 229 *D|*d) 230 PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | awk -F '[dD]' '{print $1}' ) ;; 211 231 *) 212 IGCM_debug_Exit "IGCM_config_PeriodStart " ${config_UserChoices_PeriodLength} " invalid period length : choose in 1Y, 1M, 5D, 1D."232 IGCM_debug_Exit "IGCM_config_PeriodStart " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D." 213 233 IGCM_debug_Verif_Exit ;; 214 234 esac … … 277 297 # Determine number of day(s) in PeriodLength : 278 298 case ${config_UserChoices_PeriodLength} in 279 1Y|1y) 280 (( PeriodLengthInDays = $( IGCM_date_DaysInYear $year ) )) ;; 281 1M|1m) 282 (( PeriodLengthInDays = $( IGCM_date_DaysInMonth $year $month ) )) ;; 283 5D|5d) 284 (( PeriodLengthInDays=5 )) ;; 285 1D|1d) 286 (( PeriodLengthInDays=1 )) ;; 299 *Y|*y) 300 PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 301 IGCM_debug_Print 1 "Number of years for PeriodLength : ${PeriodLengthInYears}" 302 PeriodLengthInDays=0 303 i=0 304 until [ $i -ge $PeriodLengthInYears ] ; do 305 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) 306 (( i=i+1 )) 307 done 308 ;; 309 *M|*m) 310 PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 311 IGCM_debug_Print 1 "Number of months for PeriodLength : ${PeriodLengthInMonths}" 312 typeset year1 313 PeriodLengthInDays=0 314 year1=year 315 i=0 316 until [ $i -ge $PeriodLengthInMonths ] ; do 317 if [ $(( month + i )) -lt 13 ] ; then 318 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) 319 else 320 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) 321 fi 322 (( i=i+1 )) 323 done 324 ;; 325 *D|*d) 326 PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | awk -F '[dD]' '{print $1}' ) ;; 287 327 *) 288 IGCM_debug_Exit "IGCM_config_PeriodStart " ${config_UserChoices_PeriodLength} " invalid period length : choose in 1Y, 1M, 5D, 1D."328 IGCM_debug_Exit "IGCM_config_PeriodStart " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D." 289 329 IGCM_debug_Verif_Exit ;; 290 330 esac … … 463 503 # Determine number of day(s) in PeriodLength : 464 504 case ${config_UserChoices_PeriodLength} in 465 1Y|1y) PeriodLengthInDays=$( expr $( IGCM_date_DaysInYear $year ) ) ;; 466 1M|1m) PeriodLengthInDays=$( expr $( IGCM_date_DaysInMonth $year $month ) ) ;; 467 5D|5d) PeriodLengthInDays=$( expr 5 ) ;; 468 1D|1d) PeriodLengthInDays=$( expr 1 ) ;; 505 *Y|*y) 506 PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 507 IGCM_debug_Print 1 "Number of years for PeriodLength : ${PeriodLengthInYears}" 508 PeriodLengthInDays=0 509 i=0 510 until [ $i -ge $PeriodLengthInYears ] ; do 511 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) 512 (( i=i+1 )) 513 done 514 ;; 515 M|*m) 516 PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 517 IGCM_debug_Print 1 "Number of months for PeriodLength : ${PeriodLengthInMonths}" 518 typeset year1 519 PeriodLengthInDays=0 520 year1=year 521 i=0 522 until [ $i -ge $PeriodLengthInMonths ] ; do 523 if [ $(( month + i )) -lt 13 ] ; then 524 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) 525 else 526 (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) 527 fi 528 (( i=i+1 )) 529 done 530 ;; 531 *D|*d) 532 PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | awk -F '[dD]' '{print $1}' ) ;; 469 533 esac 470 534 PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateBegin} $( expr ${PeriodLengthInDays} - 1 ) )
Note: See TracChangeset
for help on using the changeset viewer.