Changeset 10 for branches/AllPostFred
- Timestamp:
- 05/30/08 10:10:34 (16 years ago)
- Location:
- branches/AllPostFred
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/AllPostFred/AA_create_se
r5 r10 139 139 DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )} 140 140 # 141 PeriodDateEnd=${PeriodDateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )}141 DateEnd=${DateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )} 142 142 # 143 143 freq=$( echo ${config_Post_SeasonalFrequency} | sed -e "s/[yY]//" ) 144 144 # 145 an_fin=$( expr $( IGCM_date_ConvertGregorianDateToJulian $ PeriodDateEnd ) / 1000 )145 an_fin=$( expr $( IGCM_date_ConvertGregorianDateToJulian $DateEnd ) / 1000 ) 146 146 an_deb=$( IGCM_date_YearDigit $(( an_fin - freq + 1 )) ) 147 147 an_fin=$( IGCM_date_YearDigit ${an_fin} ) … … 227 227 FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) 228 228 case ${FlagDir} in 229 1Y) FreqDir=YE ;;230 1M) FreqDir=MO ;;231 5D|1D ) FreqDir=DA ;;229 *Y) FreqDir=YE ;; 230 *M) FreqDir=MO ;; 231 5D|1D|*D) FreqDir=DA ;; 232 232 HF) FreqDir=HF ;; 233 233 INS) FreqDir=INS ;; … … 286 286 IGCM_debug_Verif_Exit_Post 287 287 ;; 288 # For a Multi-Year simulation : 289 *Y|*y) 290 PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 291 (( an = an_deb )) 292 # Initialize array 293 set -A liste_file_se 294 set -A liste_file_se_tmp 295 while [ ${an} -le ${an_fin} ] ; do 296 moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) 297 # 298 an4=$(printf "%04i\n" ${an} ) 299 # 300 (( diy = 0 )) 301 (( ian = 0 )) 302 while [ ${ian} -lt ${PeriodLengthInYears} ] ; do 303 # 304 ian4=$(printf "%04i\n" $(( an + ian )) ) 305 (( diy = diy + $( IGCM_date_DaysInYear $ian4 ) )) 306 (( ian = ian + 1 )) 307 done 308 afin=$( IGCM_date_AddDaysToGregorianDate ${an4}0101 $(( diy - 1 )) ) 309 date=${an4}0101_${afin} 310 set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 311 set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc 312 (( an = an + PeriodLengthInYears )) 313 done 314 # 315 IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} 316 eval ExitFlag=false 317 IGCM_debug_Verif_Exit_Post 318 319 # Apply IGCM_Patch if needed 320 if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then 321 for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do 322 for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do 323 IGCM_${Patch} ${file_t} 324 done 325 done 326 fi 327 328 for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do 329 # 330 (( nb = ${mois} - 1 )) 331 # 332 OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc 333 IGCM_sys_ncra -O -d time_counter,${nb},,12 ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} 334 done 335 IGCM_sys_Rm ${liste_file_se_tmp[*]} 336 eval ExitFlag=false 337 IGCM_debug_Verif_Exit_Post 338 ;; 288 339 # For Monthly simulation : 289 340 1M|1m) … … 322 373 fi 323 374 324 IGCM_sys_ncra -O ${liste_file_se_tmp [*]} ${OUT_SE[${nb}]}325 IGCM_sys_Rm ${liste_file_se_tmp[*]}326 eval ExitFlag=false375 IGCM_sys_ncra -O ${liste_file_se_tmp} ${OUT_SE[${nb}]} 376 MENAGE_LOCAL ${liste_file_se_tmp} 377 # 327 378 IGCM_debug_Verif_Exit_Post 328 379 done 380 ;; 381 382 # For Multi-Monthly simulation : 383 *M|*m) 384 PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 385 # Must be a divisor of 12 !!! e.g. 2,3,4 and 6 only 386 if ( [ $PeriodLengthInMonths -ne 2 ] && \ 387 [ $PeriodLengthInMonths -ne 3 ] && \ 388 [ $PeriodLengthInMonths -ne 4 ] && \ 389 [ $PeriodLengthInMonths -ne 6 ] ) ; then 390 echo "create_se.job can't work with this monthly Period : ",$PeriodLengthInMonths,"M !!" 391 echo "It must be a divisor of twelve." 392 echo "We will stop there." 393 IGCM_debug_Verif_Exit_Post 394 else 395 # 396 (( NbSet = 12 / PeriodLengthInMonths )) 397 (( moisd = 01 )) 398 (( Mset = 1 )) 399 while [ ${Mset} -le ${NbSet} ] ; do 400 moisf=$(printf "%02i\n" $(( moisd + PeriodLengthInMonths - 1 )) ) 401 moisd=$(printf "%02i\n" ${moisd} ) 402 # 403 (( an = an_deb )) 404 # Initialize array 405 set -A liste_file_se 406 set -A liste_file_se_tmp 407 while [ ${an} -le ${an_fin} ] ; do 408 moisL=$( IGCM_date_DaysInMonth ${an} ${moisf} ) 409 # 410 an4=$(printf "%04i\n" ${an} ) 411 # 412 date=${an4}${moisd}01_${an4}${moisf}${moisL} 413 set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 414 set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc 415 (( an = an + 1 )) 416 done 417 # 418 IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} 419 eval ExitFlag=false 420 IGCM_debug_Verif_Exit_Post 421 422 # Apply IGCM_Patch if needed 423 if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then 424 for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do 425 for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do 426 IGCM_${Patch} ${file_t} 427 done 428 done 429 fi 430 431 (( imois = moisd )) 432 (( i = 0 )) 433 while [ ${imois} -le ${moisf} ] ; do 434 # 435 (( nb = ${imois} - 1 )) 436 # 437 OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${imois}_${an_deb}_${an_fin}_${file}.nc 438 IGCM_sys_ncra -O -d time_counter,${i},,${PeriodLengthInMonths} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} 439 (( imois = imois + 1 )) 440 (( i = i + 1 )) 441 done 442 443 IGCM_sys_Rm ${liste_file_se_tmp[*]} 444 eval ExitFlag=false 445 IGCM_debug_Verif_Exit_Post 446 moisf=$(printf "%02i\n" $(( moisf + 1 )) ) 447 448 (( Mset = Mset + 1 )) 449 done 450 fi 329 451 ;; 330 452 *D|*d) -
branches/AllPostFred/AA_create_ts
r5 r10 32 32 #-Q- default ## DEFAULT HOST ## 33 33 #-Q- default ################## 34 #-Q- default date 34 35 35 36 #set -vx … … 240 241 FlagDir=$( echo ${FILE} | awk -F "_" '{print $1}' ) 241 242 case ${FlagDir} in 242 1Y) TS_Dir=TS_YE ;;243 1M) TS_Dir=TS_MO ;;244 5D|1D ) TS_Dir=TS_DA ;;243 *Y) TS_Dir=TS_YE ;; 244 *M) TS_Dir=TS_MO ;; 245 5D|1D|*D) TS_Dir=TS_DA ;; 245 246 HF) TS_Dir=TS_HF ;; 246 247 INS) TS_Dir=TS_INS ;; … … 296 297 IGCM_debug_PushStack "create_ts_next_date" $@ 297 298 typeset year month Length 298 case ${ 1} in299 case ${config_UserChoices_PeriodLength} in 299 300 1Y|1y) 300 IGCM_date_GetYearMonth ${ 2} year month301 IGCM_date_GetYearMonth ${1} year month 301 302 Length=$( IGCM_date_DaysInYear $(( year + 1 )) ) ;; 303 *Y|*y) 304 PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 305 IGCM_date_GetYearMonth ${1} year month 306 (( Length=0 )) 307 (( i=0 )) 308 until [ $i -ge $PeriodLengthInYears ] ; do 309 (( Length = Length + $( IGCM_date_DaysInYear $(( year + PeriodLengthInYears + i )) ) )) 310 (( i=i+1 )) 311 done 312 ;; 302 313 1M|1m) 303 IGCM_date_GetYearMonth ${ 2} year month314 IGCM_date_GetYearMonth ${1} year month 304 315 if [ $month -lt 12 ] ; then 305 316 Length=$( IGCM_date_DaysInMonth $year $(( month + 1 )) ) … … 307 318 Length=$( IGCM_date_DaysInMonth $(( year + 1 )) 1 ) 308 319 fi ;; 320 *M|*m) 321 PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 322 IGCM_date_GetYearMonth ${1} year month 323 (( year0=year )) 324 if [ $(( month + 1 )) -lt 13 ] ; then 325 month0=$(( month + 1 )) 326 else 327 month0=$(( month + 1 - 12 )) 328 (( year = year0 + 1 )) 329 fi 330 (( Length=0 )) 331 (( i=0 )) 332 until [ $i -ge $PeriodLengthInMonths ] ; do 333 if [ $(( month0 + i )) -lt 13 ] ; then 334 (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i )) ) )) 335 else 336 (( year = year0 + 1 )) 337 (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i - 12 )) ) )) 338 fi 339 (( i=i+1 )) 340 done 341 ;; 309 342 *D|*d) 310 Length=$( echo ${ 1} | sed -e "s/[dD]//" ) ;;343 Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;; 311 344 *) 312 IGCM_debug_Exit "create_ts " ${ 1} " invalid PeriodLength : choose in 1Y, 1M, 5D, 1D."345 IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in 1Y, *M, *D." 313 346 IGCM_debug_Verif_Exit_Post ;; 314 347 esac … … 322 355 IGCM_debug_PushStack "create_ts_begin_date" $@ 323 356 typeset year month Length 324 case ${ 1} in357 case ${config_UserChoices_PeriodLength} in 325 358 1Y|1y) 326 IGCM_date_GetYearMonth ${ 2} year month359 IGCM_date_GetYearMonth ${1} year month 327 360 Length=$( IGCM_date_DaysInYear $year ) ;; 361 *Y|*y) 362 PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 363 IGCM_date_GetYearMonth ${1} year month 364 if [ X${2} = Xend ] ; then 365 (( year = year - PeriodLengthInYears + 1)) 366 fi 367 (( Length=0 )) 368 (( i=0 )) 369 until [ $i -ge $PeriodLengthInYears ] ; do 370 (( Length = Length + $( IGCM_date_DaysInYear $(( year + i )) ) )) 371 (( i=i+1 )) 372 done 373 ;; 328 374 1M|1m) 329 IGCM_date_GetYearMonth ${ 2} year month375 IGCM_date_GetYearMonth ${1} year month 330 376 Length=$( IGCM_date_DaysInMonth $year $month ) ;; 377 *M|*m) 378 PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 379 IGCM_date_GetYearMonth ${1} year month 380 if [ X${2} = Xend ] ; then 381 (( month = $month - $PeriodLengthInMonths + 1 )) 382 fi 383 (( year0=$year )) 384 if [ $month -le 0 ] ; then 385 (( month = $month + 12 )) 386 year=$( printf "%04i\n" $(( year - 1 )) ) 387 fi 388 month=$( printf "%02i\n" ${month} ) 389 (( Length=0 )) 390 (( i=0 )) 391 until [ $i -ge $PeriodLengthInMonths ] ; do 392 if [ $(( month + i )) -lt 13 ] ; then 393 (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) 394 else 395 (( year = year0 + 1 )) 396 (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) 397 fi 398 (( i=i+1 )) 399 done 400 ;; 331 401 *D|*d) 332 Length=$( echo ${ 1} | sed -e "s/[dD]//" ) ;;402 Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;; 333 403 *) 334 IGCM_debug_Exit "create_ts " ${ 1} " invalid PeriodLength : choose in 1Y, 1M, 5D, 1D."404 IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in 1Y, *M, *D." 335 405 IGCM_debug_Verif_Exit_Post ;; 336 406 esac … … 374 444 # First Time Series Submission 375 445 FIRST_PASS=TRUE 376 Length=$( create_ts_begin_date ${ config_UserChoices_PeriodLength} ${DateBegin})446 Length=$( create_ts_begin_date ${DateBegin} begin) 377 447 DATE_FIN_JOB_B=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( Length - 1 )) ) 378 448 else … … 401 471 FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) 402 472 case ${FlagDir} in 403 1Y) TS_Dir=TS_YE ;;404 1M) TS_Dir=TS_MO ;;405 5D|1D) TS_Dir=TS_DA ;;473 *Y) TS_Dir=TS_YE ;; 474 *M) TS_Dir=TS_MO ;; 475 5D|1D|*D) TS_Dir=TS_DA ;; 406 476 HF) TS_Dir=TS_HF ;; 407 477 INS) TS_Dir=TS_INS ;; … … 437 507 while [ ${DATE_COUNT} -lt ${PeriodDateEnd} ] ; do 438 508 (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) 439 Length=$( create_ts_next_date ${ config_UserChoices_PeriodLength} ${DATE_COUNT} )509 Length=$( create_ts_next_date ${DATE_COUNT} ) 440 510 DATE_COUNT=$( IGCM_date_AddDaysToGregorianDate ${DATE_COUNT} ${Length} ) 441 511 done … … 468 538 DATE_COURANTE=${DATE_FIN_JOB_B_LOOP} 469 539 else 470 Length=$( create_ts_next_date ${ config_UserChoices_PeriodLength} ${DATE_FIN_JOB_B_LOOP} )540 Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} ) 471 541 DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} ) 472 542 fi … … 485 555 486 556 if [ ! ${FIRST_PASS} = TRUE ] && [ ${CURRENT_LOOP} -eq 1 ] ; then 487 Length=$( create_ts_next_date ${ config_UserChoices_PeriodLength} ${DATE_FIN_JOB_B_LOOP} )557 Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} ) 488 558 DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} ) 489 559 elif [ -z "${DATE_COURANTE}" ] ; then 490 560 DATE_COURANTE=${DATE_FIN_JOB_B} 491 561 else 492 Length=$( create_ts_next_date ${ config_UserChoices_PeriodLength} ${DATE_FIN} )562 Length=$( create_ts_next_date ${DATE_FIN} ) 493 563 DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} ) 494 564 fi … … 500 570 while [ ${COMPTEUR} -lt ${NBRE_FILE_LOOP} ] ; do 501 571 # 502 Length=$( create_ts_next_date ${ config_UserChoices_PeriodLength} ${DATE_LOOP} )572 Length=$( create_ts_next_date ${DATE_LOOP} ) 503 573 DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length} ) 504 574 (( TotLength = TotLength + Length )) … … 517 587 [ ${NBRE_FILE_LOOP} -eq 0 ] && NBRE_FILE_LOOP=${UNIX_MAX_LIMIT} 518 588 519 Length=$( create_ts_next_date ${ config_UserChoices_PeriodLength} ${DATE_FIN} )589 Length=$( create_ts_next_date ${DATE_FIN} ) 520 590 DATE_COURANTE=$(IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} ) 521 591 DATE_FIN=${PeriodDateEnd} … … 545 615 FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) 546 616 case ${FlagDir} in 547 1Y) TS_Dir=TS_YE ; FreqDir=AN;;548 1M) TS_Dir=TS_MO ; FreqDir=MO ;;617 *Y) TS_Dir=TS_YE ; FreqDir=YE ;; 618 *M) TS_Dir=TS_MO ; FreqDir=MO ;; 549 619 *D) TS_Dir=TS_DA ; FreqDir=DA ;; 550 620 HF) TS_Dir=TS_HF ; FreqDir=HF ;; … … 566 636 while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] ; do 567 637 # 568 Length1=$( create_ts_begin_date ${ config_UserChoices_PeriodLength} ${DATE_LOOP})638 Length1=$( create_ts_begin_date ${DATE_LOOP} end) 569 639 DATE_TAB=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} $(( 1 - Length1 )) )_${DATE_LOOP} 570 640 571 Length2=$( create_ts_next_date ${ config_UserChoices_PeriodLength} ${DATE_LOOP})641 Length2=$( create_ts_next_date ${DATE_LOOP} end) 572 642 DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length2} ) 573 643 … … 595 665 # WE CAN CONCATENATE FILES AT THIS POINT 596 666 [ "${FLAG_B}" = "TRUE" ] && DATE_BUILD_B=${DateBegin}_${DATE_FIN_JOB_B_LOOP_PREC} 597 Length=$( create_ts_begin_date ${ config_UserChoices_PeriodLength} ${DATE_COURANTE})667 Length=$( create_ts_begin_date ${DATE_COURANTE} end) 598 668 DATE_BUILD1=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} -$(( Length - 1 )) ) 599 669 DATE_BUILD=${DATE_BUILD1}_${DATE_FIN} -
branches/AllPostFred/libIGCM_comp/libIGCM_comp.ksh
r5 r10 86 86 eval first_option=\${${compname}_UserChoices[0]} > /dev/null 2>&1 87 87 if [ X${first_option} != X"Error:" ] ; then 88 eval IGCM_debug_Print 2 "${compname}_UserChoices_Options:" \${${compname}_UserChoices[*]}89 88 if [ X${card_UserChoices[0]} != X ] ; then 90 89 unset card_UserChoices … … 94 93 for option in ${card_UserChoices[*]} ; do 95 94 IGCM_card_DefineVariableFromOption ${card} UserChoices ${option} 96 eval IGCM_debug_Print 3 "${compname}_UserChoices_values: ${card_UserChoices[*]}"95 eval IGCM_debug_Print 2 "${compname}_UserChoices_values: ${option} \${card_UserChoices_${option}}" 97 96 done 98 97 fi -
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 ) ) -
branches/AllPostFred/libIGCM_post/libIGCM_post.ksh
r5 r10 86 86 PeriodYear=$( echo ${config_Post_post_freq} | sed -e "s/[yY]//" ) 87 87 case ${config_UserChoices_PeriodLength} in 88 1Y|1y) 88 *Y|*y) 89 echo "POST : Y->Y = " ${CumulPeriod} ',' ${PeriodYear} "," $( expr ${CumulPeriod} % ${PeriodYear} ) 89 90 if [ $( expr ${CumulPeriod} % ${PeriodYear} ) -eq 0 ] ; then 90 91 eval ${flag_post}_${compname}_${post_freq}=true … … 94 95 1M|1m) 95 96 if [ $( expr ${CumulPeriod} % $( expr ${PeriodYear} \* 12 ) ) -eq 0 ] ; then 97 eval ${flag_post}_${compname}_${post_freq}=true 98 eval ${post_freq}=true 99 POST=true 100 fi ;; 101 *M|*m) 102 PeriodMonths=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" ) 103 if [ $( expr $(( ${CumulPeriod} * ${PeriodMonths} )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then 96 104 eval ${flag_post}_${compname}_${post_freq}=true 97 105 eval ${post_freq}=true … … 126 134 1M|1m) 127 135 case ${config_UserChoices_PeriodLength} in 128 1Y|1y)136 *Y|*y) 129 137 IGCM_debug_Print 3 "Frequency not allowed for TimeSeriesFrequency in ${flag_post}" ;; 130 1M|1m)138 *M|*m) 131 139 eval ${flag_post}_${compname}_${post_freq}=true 132 140 eval ${post_freq}=true … … 145 153 esac 146 154 ;; 155 *M|*m) 156 case ${config_UserChoices_PeriodLength} in 157 *Y|*y) 158 IGCM_debug_Print 3 "Frequency not allowed for TimeSeriesFrequency in ${flag_post}" ;; 159 *M|*m) 160 eval ${flag_post}_${compname}_${post_freq}=true 161 eval ${post_freq}=true 162 POST=true;; 163 esac 164 ;; 147 165 NONE|none) 148 166 ;;
Note: See TracChangeset
for help on using the changeset viewer.