Ignore:
Timestamp:
03/07/12 10:39:55 (12 years ago)
Author:
mafoipsl
Message:

First try to merge libIGCM_MPI_OpenMP branch with libIGCM trunk revision 569. Tested on vargas with PackFrequency?=NONE included into config.card.

Location:
branches/libIGCM_MPI_OpenMP
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/libIGCM_MPI_OpenMP

  • branches/libIGCM_MPI_OpenMP/AA_create_ts

    r563 r571  
    9999#-Q- titane ###################### 
    100100#-Q- titane #MSUB -r TS             # Nom du job                 
    101 #-Q- titane #MSUB -N 1              # Reservation du noeud 
     101#-Q- titane #MSUB -eo 
    102102#-Q- titane #MSUB -n 1              # Reservation du processus 
    103103#-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 
    108105#-Q- lxiv8 ###################### 
    109106#-Q- lxiv8 ## OBELIX      LSCE ## 
     
    146143StandAlone=${StandAlone:=true} 
    147144 
    148 #D- Low level debug : to bypass lib test checks and stack construction 
     145#D- Path to libIGCM 
    149146#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. 
    150151libIGCM=${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 instead 
    154 # of your running libIGCM directory. 
    155152 
    156153#D- Flag to determine allready produced time series. Empty if you start from the beginning 
     
    271268#================================== 
    272269#R_SAVE : Job output directory 
     270#R_BUFR : Job output buffered directory 
    273271if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then 
    274272    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' ) 
    275273    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} 
    276275    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName} 
    277276else 
    278277    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 
     278    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 
    279279    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName} 
    280280fi 
     
    469469######################################################################## 
    470470# 
    471 #                          DEFINE DATE FUNCTIONS 
    472 # 
    473 ######################################################################## 
    474  
    475 # Give the end of the next $1 period from $2 date 
    476 function create_ts_next_date { 
    477     IGCM_debug_PushStack "create_ts_next_date" $@ 
    478     typeset Length 
    479     case ${config_UserChoices_PeriodLength} in 
    480         *Y|*y)  
    481             PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 
    482             IGCM_date_GetYearMonth ${1} year month 
    483             year=$( IGCM_date_SupressZeros ${year} ) 
    484             (( Length=0 )) 
    485             (( i=0 )) 
    486             until [ $i -ge $PeriodLengthInYears ] ; do 
    487                 (( Length = Length + $( IGCM_date_DaysInYear $(( year + i + 1 )) ) ))  
    488                 (( i=i+1 )) 
    489             done 
    490             ;; 
    491         *M|*m)  
    492             PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 
    493             IGCM_date_GetYearMonth ${1} year month 
    494             year=$( IGCM_date_SupressZeros ${year} ) 
    495             (( year0 = year )) 
    496             if [ $(( month + 1 )) -lt 13 ] ; then 
    497                 month0=$(( month + 1 )) 
    498             else 
    499                 month0=$(( month + 1 - 12 )) 
    500                 (( year = year0 + 1 )) 
    501             fi 
    502             (( Length=0 )) 
    503             (( i=0 )) 
    504             until [ $i -ge $PeriodLengthInMonths ] ; do 
    505                 if [ $(( month0 + i )) -lt 13 ] ; then 
    506                     (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i )) ) )) 
    507                 else 
    508                     (( year = year0 + 1 )) 
    509                     (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i - 12 )) ) )) 
    510                 fi 
    511                 (( i=i+1 )) 
    512             done 
    513             ;; 
    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     esac 
    520     echo ${Length} 
    521  
    522     IGCM_debug_PopStack "create_ts_next_date" 
    523 } 
    524  
    525 # Give the end of the actual $1 period from $2 date 
    526 function create_ts_begin_date { 
    527     IGCM_debug_PushStack "create_ts_begin_date" $@ 
    528     typeset Length 
    529     case ${config_UserChoices_PeriodLength} in 
    530         *Y|*y)  
    531             PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 
    532             IGCM_date_GetYearMonth ${1} year month 
    533             year=$( IGCM_date_SupressZeros ${year} ) 
    534             if [ X${2} = Xend ] ; then 
    535                 (( year = year - PeriodLengthInYears + 1)) 
    536             fi 
    537             (( Length=0 )) 
    538             (( i=0 )) 
    539             until [ $i -ge $PeriodLengthInYears ] ; do 
    540                 (( Length = Length + $( IGCM_date_DaysInYear $(( year + i )) ) ))  
    541                 (( i=i+1 )) 
    542             done 
    543             ;; 
    544         *M|*m)  
    545             PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 
    546             IGCM_date_GetYearMonth ${1} year month 
    547             year=$( IGCM_date_SupressZeros ${year} ) 
    548             if [ X${2} = Xend ] ; then 
    549                 (( month = month - PeriodLengthInMonths + 1 )) 
    550             fi       
    551             (( year0 = year )) 
    552             if [ $month -le 0 ] ; then 
    553                 (( month = month + 12 )) 
    554                 year=$( printf "%04i\n" $(( year - 1 )) ) 
    555             fi 
    556             month=$( printf "%02i\n" ${month} ) 
    557             (( Length=0 )) 
    558             (( i=0 )) 
    559             until [ $i -ge $PeriodLengthInMonths ] ; do 
    560                 if [ $(( month + i )) -lt 13 ] ; then 
    561                     (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) 
    562                 else 
    563                     (( year = year0 + 1 )) 
    564                     (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) 
    565                 fi 
    566                 (( i=i+1 )) 
    567             done 
    568             ;; 
    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     esac 
    575     echo ${Length} 
    576  
    577     IGCM_debug_PopStack "create_ts_begin_date" 
    578 } 
    579  
    580 ######################################################################## 
    581 # 
    582471#               IS THERE SOME ALLREADY PRODUCED TIME SERIES ? 
    583472#                 IF SO BRING THEM IN THE WORKING DIRECTORY 
     
    622511    # First Time Series Submission 
    623512    FIRST_PASS=TRUE 
    624     Length=$( create_ts_begin_date ${DateBegin} begin) 
     513    Length=$( IGCM_date_DaysInPreviousPeriod ${DateBegin} ${config_UserChoices_PeriodLength} begin) 
    625514    DATE_FIN_JOB_B=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( Length - 1 )) ) 
    626515else 
     
    692581    while [ ${DATE_COUNT} -lt ${PeriodDateEnd} ] ; do 
    693582        (( 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} ) 
    695584        DATE_COUNT=$( IGCM_date_AddDaysToGregorianDate ${DATE_COUNT} ${Length} ) 
    696585    done 
     
    723612            DATE_COURANTE=${DATE_FIN_JOB_B_LOOP} 
    724613        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} ) 
    726615            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} ) 
    727616        fi 
     
    740629 
    741630        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} ) 
    743632            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} ) 
    744633        elif [ -z "${DATE_COURANTE}" ] ; then 
    745634            DATE_COURANTE=${DATE_FIN_JOB_B} 
    746635        else 
    747             Length=$( create_ts_next_date ${DATE_FIN} ) 
     636            Length=$( IGCM_date_DaysInNextPeriod ${DATE_FIN} ${config_UserChoices_PeriodLength} ) 
    748637            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} ) 
    749638        fi 
     
    755644        while [ ${COMPTEUR} -lt ${NBRE_FILE_LOOP} ] ; do 
    756645            # 
    757             Length=$( create_ts_next_date ${DATE_LOOP} ) 
     646            Length=$( IGCM_date_DaysInNextPeriod ${DATE_LOOP} ${config_UserChoices_PeriodLength} ) 
    758647            DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length} ) 
    759648            (( TotLength = TotLength + Length )) 
     
    772661        [ ${NBRE_FILE_LOOP} -eq 0 ] && NBRE_FILE_LOOP=${UNIX_MAX_LIMIT} 
    773662 
    774         Length=$( create_ts_next_date ${DATE_FIN} ) 
     663        Length=$( IGCM_date_DaysInNextPeriod ${DATE_FIN} ${config_UserChoices_PeriodLength} ) 
    775664        DATE_COURANTE=$(IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} ) 
    776665        DATE_FIN=${PeriodDateEnd} 
     
    823712            while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] ; do 
    824713                # 
    825                 Length1=$( create_ts_begin_date ${DATE_LOOP} end) 
     714                Length1=$( IGCM_date_DaysInPreviousPeriod ${DATE_LOOP} ${config_UserChoices_PeriodLength} end) 
    826715                DATE_TAB=$(  IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} $(( 1 - Length1 )) )_${DATE_LOOP} 
    827716 
    828                 Length2=$( create_ts_next_date ${DATE_LOOP} end) 
     717                Length2=$( IGCM_date_DaysInNextPeriod ${DATE_LOOP} ${config_UserChoices_PeriodLength} ) 
    829718                DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length2} ) 
    830719 
     
    856745            # WE CAN CONCATENATE FILES AT THIS POINT 
    857746            [ "${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) 
    859748            DATE_BUILD1=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} -$(( Length - 1 )) ) 
    860749            DATE_BUILD=${DATE_BUILD1}_${DATE_FIN} 
Note: See TracChangeset for help on using the changeset viewer.