Changeset 571 for branches/libIGCM_MPI_OpenMP/AA_create_ts
- Timestamp:
- 03/07/12 10:39:55 (12 years ago)
- Location:
- branches/libIGCM_MPI_OpenMP
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/libIGCM_MPI_OpenMP
-
Property
svn:mergeinfo
set to
False
/trunk/libIGCM merged eligible
-
Property
svn:mergeinfo
set to
False
-
branches/libIGCM_MPI_OpenMP/AA_create_ts
r563 r571 99 99 #-Q- titane ###################### 100 100 #-Q- titane #MSUB -r TS # Nom du job 101 #-Q- titane #MSUB - N 1 # Reservation du noeud101 #-Q- titane #MSUB -eo 102 102 #-Q- titane #MSUB -n 1 # Reservation du processus 103 103 #-Q- titane #MSUB -T 86400 # Limite de temps elapsed du job 104 #-Q- titane #MSUB -E "-j o" 105 #-Q- titane #MSUB -E "-S /bin/ksh" 106 #-Q- titane ##MSUB -e nco.out # Sortie standard 107 #-Q- titane ##MSUB -o nco.out # Sortie standard 104 #-Q- titane #MSUB -q mono 108 105 #-Q- lxiv8 ###################### 109 106 #-Q- lxiv8 ## OBELIX LSCE ## … … 146 143 StandAlone=${StandAlone:=true} 147 144 148 #D- Low level debug : to bypass lib test checks and stack construction145 #D- Path to libIGCM 149 146 #D- Default : value from AA_job if any 147 # WARNING For StandAlone use : To run this script on some machine (ulam and cesium) 148 # WARNING you must check MirrorlibIGCM variable in sys library. 149 # WARNING If this variable is true, you must use libIGCM_POST path instead 150 # WARNING of your running libIGCM directory. 150 151 libIGCM=${libIGCM:=::modipsl::/libIGCM} 151 # WARNING for StandAlone used : To run this script on some machine,152 # you must check MirrorlibIGCM variable in sys library.153 # If this variable is true, you must use libIGCM_POST path instead154 # of your running libIGCM directory.155 152 156 153 #D- Flag to determine allready produced time series. Empty if you start from the beginning … … 271 268 #================================== 272 269 #R_SAVE : Job output directory 270 #R_BUFR : Job output buffered directory 273 271 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then 274 272 FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' ) 275 273 R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} 274 R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} 276 275 R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} 277 276 else 278 277 R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 278 R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 279 279 R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName} 280 280 fi … … 469 469 ######################################################################## 470 470 # 471 # DEFINE DATE FUNCTIONS472 #473 ########################################################################474 475 # Give the end of the next $1 period from $2 date476 function create_ts_next_date {477 IGCM_debug_PushStack "create_ts_next_date" $@478 typeset Length479 case ${config_UserChoices_PeriodLength} in480 *Y|*y)481 PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )482 IGCM_date_GetYearMonth ${1} year month483 year=$( IGCM_date_SupressZeros ${year} )484 (( Length=0 ))485 (( i=0 ))486 until [ $i -ge $PeriodLengthInYears ] ; do487 (( Length = Length + $( IGCM_date_DaysInYear $(( year + i + 1 )) ) ))488 (( i=i+1 ))489 done490 ;;491 *M|*m)492 PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )493 IGCM_date_GetYearMonth ${1} year month494 year=$( IGCM_date_SupressZeros ${year} )495 (( year0 = year ))496 if [ $(( month + 1 )) -lt 13 ] ; then497 month0=$(( month + 1 ))498 else499 month0=$(( month + 1 - 12 ))500 (( year = year0 + 1 ))501 fi502 (( Length=0 ))503 (( i=0 ))504 until [ $i -ge $PeriodLengthInMonths ] ; do505 if [ $(( month0 + i )) -lt 13 ] ; then506 (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i )) ) ))507 else508 (( year = year0 + 1 ))509 (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i - 12 )) ) ))510 fi511 (( i=i+1 ))512 done513 ;;514 *D|*d)515 Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;;516 *)517 IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in *Y, *M, *D."518 IGCM_debug_Verif_Exit_Post ;;519 esac520 echo ${Length}521 522 IGCM_debug_PopStack "create_ts_next_date"523 }524 525 # Give the end of the actual $1 period from $2 date526 function create_ts_begin_date {527 IGCM_debug_PushStack "create_ts_begin_date" $@528 typeset Length529 case ${config_UserChoices_PeriodLength} in530 *Y|*y)531 PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )532 IGCM_date_GetYearMonth ${1} year month533 year=$( IGCM_date_SupressZeros ${year} )534 if [ X${2} = Xend ] ; then535 (( year = year - PeriodLengthInYears + 1))536 fi537 (( Length=0 ))538 (( i=0 ))539 until [ $i -ge $PeriodLengthInYears ] ; do540 (( Length = Length + $( IGCM_date_DaysInYear $(( year + i )) ) ))541 (( i=i+1 ))542 done543 ;;544 *M|*m)545 PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )546 IGCM_date_GetYearMonth ${1} year month547 year=$( IGCM_date_SupressZeros ${year} )548 if [ X${2} = Xend ] ; then549 (( month = month - PeriodLengthInMonths + 1 ))550 fi551 (( year0 = year ))552 if [ $month -le 0 ] ; then553 (( month = month + 12 ))554 year=$( printf "%04i\n" $(( year - 1 )) )555 fi556 month=$( printf "%02i\n" ${month} )557 (( Length=0 ))558 (( i=0 ))559 until [ $i -ge $PeriodLengthInMonths ] ; do560 if [ $(( month + i )) -lt 13 ] ; then561 (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i )) ) ))562 else563 (( year = year0 + 1 ))564 (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) ))565 fi566 (( i=i+1 ))567 done568 ;;569 *D|*d)570 Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;;571 *)572 IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in *Y, *M, *D."573 IGCM_debug_Verif_Exit_Post ;;574 esac575 echo ${Length}576 577 IGCM_debug_PopStack "create_ts_begin_date"578 }579 580 ########################################################################581 #582 471 # IS THERE SOME ALLREADY PRODUCED TIME SERIES ? 583 472 # IF SO BRING THEM IN THE WORKING DIRECTORY … … 622 511 # First Time Series Submission 623 512 FIRST_PASS=TRUE 624 Length=$( create_ts_begin_date ${DateBegin} begin)513 Length=$( IGCM_date_DaysInPreviousPeriod ${DateBegin} ${config_UserChoices_PeriodLength} begin) 625 514 DATE_FIN_JOB_B=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( Length - 1 )) ) 626 515 else … … 692 581 while [ ${DATE_COUNT} -lt ${PeriodDateEnd} ] ; do 693 582 (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) 694 Length=$( create_ts_next_date ${DATE_COUNT} )583 Length=$( IGCM_date_DaysInNextPeriod ${DATE_COUNT} ${config_UserChoices_PeriodLength} ) 695 584 DATE_COUNT=$( IGCM_date_AddDaysToGregorianDate ${DATE_COUNT} ${Length} ) 696 585 done … … 723 612 DATE_COURANTE=${DATE_FIN_JOB_B_LOOP} 724 613 else 725 Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} )614 Length=$( IGCM_date_DaysInNextPeriod ${DATE_FIN_JOB_B_LOOP} ${config_UserChoices_PeriodLength} ) 726 615 DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} ) 727 616 fi … … 740 629 741 630 if [ ! ${FIRST_PASS} = TRUE ] && [ ${CURRENT_LOOP} -eq 1 ] ; then 742 Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} )631 Length=$( IGCM_date_DaysInNextPeriod ${DATE_FIN_JOB_B_LOOP} ${config_UserChoices_PeriodLength} ) 743 632 DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} ) 744 633 elif [ -z "${DATE_COURANTE}" ] ; then 745 634 DATE_COURANTE=${DATE_FIN_JOB_B} 746 635 else 747 Length=$( create_ts_next_date ${DATE_FIN} )636 Length=$( IGCM_date_DaysInNextPeriod ${DATE_FIN} ${config_UserChoices_PeriodLength} ) 748 637 DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} ) 749 638 fi … … 755 644 while [ ${COMPTEUR} -lt ${NBRE_FILE_LOOP} ] ; do 756 645 # 757 Length=$( create_ts_next_date ${DATE_LOOP} )646 Length=$( IGCM_date_DaysInNextPeriod ${DATE_LOOP} ${config_UserChoices_PeriodLength} ) 758 647 DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length} ) 759 648 (( TotLength = TotLength + Length )) … … 772 661 [ ${NBRE_FILE_LOOP} -eq 0 ] && NBRE_FILE_LOOP=${UNIX_MAX_LIMIT} 773 662 774 Length=$( create_ts_next_date ${DATE_FIN} )663 Length=$( IGCM_date_DaysInNextPeriod ${DATE_FIN} ${config_UserChoices_PeriodLength} ) 775 664 DATE_COURANTE=$(IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} ) 776 665 DATE_FIN=${PeriodDateEnd} … … 823 712 while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] ; do 824 713 # 825 Length1=$( create_ts_begin_date ${DATE_LOOP} end)714 Length1=$( IGCM_date_DaysInPreviousPeriod ${DATE_LOOP} ${config_UserChoices_PeriodLength} end) 826 715 DATE_TAB=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} $(( 1 - Length1 )) )_${DATE_LOOP} 827 716 828 Length2=$( create_ts_next_date ${DATE_LOOP} end)717 Length2=$( IGCM_date_DaysInNextPeriod ${DATE_LOOP} ${config_UserChoices_PeriodLength} ) 829 718 DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length2} ) 830 719 … … 856 745 # WE CAN CONCATENATE FILES AT THIS POINT 857 746 [ "${FLAG_B}" = "TRUE" ] && DATE_BUILD_B=${DateBegin}_${DATE_FIN_JOB_B_LOOP_PREC} 858 Length=$( create_ts_begin_date ${DATE_COURANTE} end)747 Length=$( IGCM_date_DaysInPreviousPeriod ${DATE_COURANTE} ${config_UserChoices_PeriodLength} end) 859 748 DATE_BUILD1=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} -$(( Length - 1 )) ) 860 749 DATE_BUILD=${DATE_BUILD1}_${DATE_FIN}
Note: See TracChangeset
for help on using the changeset viewer.