Changes in / [20:30]


Ignore:
Files:
1 added
13 edited

Legend:

Unmodified
Added
Removed
  • /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_platine.ksh

    r20 r30  
    12581258        echo "IGCM_sys_rebuild :" $@ 
    12591259    fi 
    1260     /home/cont003/p86ipsl/bin/platine/rebuild -f -o $@ 
     1260 
     1261    /home/cont003/p86ipsl/IA64/bin/rebuild -f -o $@ 
    12611262    if [ $? -gt 0 ] ; then 
    12621263       echo "IGCM_sys_rebuild : erreur ${@}." 
  • /trunk/libIGCM/AA_create_se

    r20 r30  
    441441    # 
    442442elif [ ${config_UserChoices_TagName} = "LMDZ4OR" ]  || \ 
    443      [ ${config_UserChoices_TagName} = "LMDZ4OR_v2" ] || \ 
    444      [ ${config_UserChoices_TagName} = "LMDz4OR_v2" ] ; then 
     443     [ ${config_UserChoices_TagName} = "LMDZ4OR_v2" ] ; then 
    445444    # 
    446445    IGCM_sys_QsubPost atlas_LMDZ         ; 
  • /trunk/libIGCM/AA_create_ts

    r20 r30  
    241241        FlagDir=$( echo ${FILE} | awk -F "_" '{print $1}' ) 
    242242        case ${FlagDir} in 
    243             1Y)    TS_Dir=TS_YE  ;; 
    244             1M)    TS_Dir=TS_MO  ;; 
    245             5D|1D) TS_Dir=TS_DA  ;; 
    246             HF)    TS_Dir=TS_HF  ;; 
    247             INS)   TS_Dir=TS_INS ;; 
     243            *Y)  TS_Dir=TS_YE  ;;  
     244            *M)  TS_Dir=TS_MO  ;;  
     245            *D)  TS_Dir=TS_DA  ;;  
     246            HF)  TS_Dir=TS_HF  ;; 
     247            INS) TS_Dir=TS_INS ;; 
    248248        esac 
    249249 
     
    297297    IGCM_debug_PushStack "create_ts_next_date" $@ 
    298298    typeset year month Length 
    299     case ${1} in 
    300         1Y|1y) 
    301             IGCM_date_GetYearMonth ${2} year month 
    302             Length=$( IGCM_date_DaysInYear $(( year + 1 )) ) ;; 
    303         1M|1m) 
    304             IGCM_date_GetYearMonth ${2} year month 
    305             if [ $month -lt 12 ] ; then 
    306                 Length=$( IGCM_date_DaysInMonth $year $(( month + 1 )) ) 
     299    case ${config_UserChoices_PeriodLength} in 
     300        *Y|*y)  
     301            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 
     302            IGCM_date_GetYearMonth ${1} year month 
     303            (( Length=0 )) 
     304            (( i=0 )) 
     305            until [ $i -ge $PeriodLengthInYears ] ; do 
     306                (( Length = Length + $( IGCM_date_DaysInYear $(( year + i + 1 )) ) ))  
     307                (( i=i+1 )) 
     308            done 
     309            ;; 
     310        *M|*m)  
     311            PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 
     312            IGCM_date_GetYearMonth ${1} year month 
     313            (( year0=year )) 
     314            if [ $(( month + 1 )) -lt 13 ] ; then 
     315                month0=$(( month + 1 )) 
    307316            else 
    308                 Length=$( IGCM_date_DaysInMonth $(( year + 1 )) 1 ) 
    309             fi ;; 
     317                month0=$(( month + 1 - 12 )) 
     318                (( year = year0 + 1 )) 
     319            fi 
     320            (( Length=0 )) 
     321            (( i=0 )) 
     322            until [ $i -ge $PeriodLengthInMonths ] ; do 
     323                if [ $(( month0 + i )) -lt 13 ] ; then 
     324                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i )) ) )) 
     325                else 
     326                    (( year = year0 + 1 )) 
     327                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i - 12 )) ) )) 
     328                fi 
     329                (( i=i+1 )) 
     330            done 
     331            ;; 
    310332        *D|*d) 
    311             Length=$( echo ${1} | sed -e "s/[dD]//" ) ;; 
     333            Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;; 
    312334        *) 
    313             IGCM_debug_Exit "create_ts " ${1} " invalid PeriodLength : choose in 1Y, 1M, 5D, 1D." 
     335            IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in 1Y, *M, *D." 
    314336            IGCM_debug_Verif_Exit_Post ;; 
    315337    esac 
     
    323345    IGCM_debug_PushStack "create_ts_begin_date" $@ 
    324346    typeset year month Length 
    325     case ${1} in 
    326         1Y|1y) 
    327             IGCM_date_GetYearMonth ${2} year month 
    328             Length=$( IGCM_date_DaysInYear $year ) ;; 
    329         1M|1m) 
    330             IGCM_date_GetYearMonth ${2} year month 
    331             Length=$( IGCM_date_DaysInMonth $year $month ) ;; 
     347    case ${config_UserChoices_PeriodLength} in 
     348        *Y|*y)  
     349            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 
     350            IGCM_date_GetYearMonth ${1} year month 
     351            if [ X${2} = Xend ] ; then 
     352                (( year = year - PeriodLengthInYears + 1)) 
     353            fi 
     354            (( Length=0 )) 
     355            (( i=0 )) 
     356            until [ $i -ge $PeriodLengthInYears ] ; do 
     357                (( Length = Length + $( IGCM_date_DaysInYear $(( year + i )) ) ))  
     358                (( i=i+1 )) 
     359            done 
     360            ;; 
     361        *M|*m)  
     362            PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 
     363            IGCM_date_GetYearMonth ${1} year month 
     364            if [ X${2} = Xend ] ; then 
     365                (( month = $month - $PeriodLengthInMonths + 1 )) 
     366            fi       
     367            (( year0=$year )) 
     368            if [ $month -le 0 ] ; then 
     369                (( month = $month + 12 )) 
     370                year=$( printf "%04i\n" $(( year - 1 )) ) 
     371            fi 
     372            month=$( printf "%02i\n" ${month} ) 
     373            (( Length=0 )) 
     374            (( i=0 )) 
     375            until [ $i -ge $PeriodLengthInMonths ] ; do 
     376                if [ $(( month + i )) -lt 13 ] ; then 
     377                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) 
     378                else 
     379                    (( year = year0 + 1 )) 
     380                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) 
     381                fi 
     382                (( i=i+1 )) 
     383            done 
     384            ;; 
    332385        *D|*d) 
    333             Length=$( echo ${1} | sed -e "s/[dD]//" ) ;; 
     386            Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;; 
    334387        *) 
    335             IGCM_debug_Exit "create_ts " ${1} " invalid PeriodLength : choose in 1Y, 1M, 5D, 1D." 
     388            IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in 1Y, *M, *D." 
    336389            IGCM_debug_Verif_Exit_Post ;; 
    337390    esac 
     
    375428    # First Time Series Submission 
    376429    FIRST_PASS=TRUE 
    377     Length=$( create_ts_begin_date ${config_UserChoices_PeriodLength} ${DateBegin} ) 
     430    Length=$( create_ts_begin_date ${DateBegin} begin) 
    378431    DATE_FIN_JOB_B=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( Length - 1 )) ) 
    379432else 
     
    402455            FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) 
    403456            case ${FlagDir} in 
    404                 1Y)    TS_Dir=TS_YE  ;; 
    405                 1M)    TS_Dir=TS_MO  ;; 
    406                 5D|1D) TS_Dir=TS_DA  ;; 
    407                 HF)    TS_Dir=TS_HF  ;; 
    408                 INS)   TS_Dir=TS_INS ;; 
     457                *Y)  TS_Dir=TS_YE  ;; 
     458                *M)  TS_Dir=TS_MO  ;; 
     459                *D) TS_Dir=TS_DA  ;; 
     460                HF)  TS_Dir=TS_HF  ;; 
     461                INS) TS_Dir=TS_INS ;; 
    409462            esac 
    410463            for var in $( eval echo \${LISTE_VARS_${file}[*]} ) ; do 
     
    438491    while [ ${DATE_COUNT} -lt ${PeriodDateEnd} ] ; do 
    439492        (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) 
    440         Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_COUNT} ) 
     493        Length=$( create_ts_next_date ${DATE_COUNT} ) 
    441494        DATE_COUNT=$( IGCM_date_AddDaysToGregorianDate ${DATE_COUNT} ${Length} ) 
    442495    done 
     
    469522            DATE_COURANTE=${DATE_FIN_JOB_B_LOOP} 
    470523        else 
    471             Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_FIN_JOB_B_LOOP} ) 
     524            Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} ) 
    472525            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} ) 
    473526        fi 
     
    486539 
    487540        if [ ! ${FIRST_PASS} = TRUE ] && [ ${CURRENT_LOOP} -eq 1 ] ; then 
    488             Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_FIN_JOB_B_LOOP} ) 
     541            Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} ) 
    489542            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} ) 
    490543        elif [ -z "${DATE_COURANTE}" ] ; then 
    491544            DATE_COURANTE=${DATE_FIN_JOB_B} 
    492545        else 
    493             Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_FIN} ) 
     546            Length=$( create_ts_next_date ${DATE_FIN} ) 
    494547            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} ) 
    495548        fi 
     
    501554        while [ ${COMPTEUR} -lt ${NBRE_FILE_LOOP} ] ; do 
    502555            # 
    503             Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_LOOP} ) 
     556            Length=$( create_ts_next_date ${DATE_LOOP} ) 
    504557            DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length} ) 
    505558            (( TotLength = TotLength + Length )) 
     
    518571        [ ${NBRE_FILE_LOOP} -eq 0 ] && NBRE_FILE_LOOP=${UNIX_MAX_LIMIT} 
    519572 
    520         Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_FIN} ) 
     573        Length=$( create_ts_next_date ${DATE_FIN} ) 
    521574        DATE_COURANTE=$(IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} ) 
    522575        DATE_FIN=${PeriodDateEnd} 
     
    546599            FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) 
    547600            case ${FlagDir} in 
    548                 1Y)    TS_Dir=TS_YE  ; FreqDir=AN  ;; 
    549                 1M)    TS_Dir=TS_MO  ; FreqDir=MO  ;; 
     601                *Y)    TS_Dir=TS_YE  ; FreqDir=YE  ;; 
     602                *M)    TS_Dir=TS_MO  ; FreqDir=MO  ;; 
    550603                *D)    TS_Dir=TS_DA  ; FreqDir=DA  ;; 
    551604                HF)    TS_Dir=TS_HF  ; FreqDir=HF  ;; 
     
    567620            while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] ; do 
    568621                # 
    569                 Length1=$( create_ts_begin_date ${config_UserChoices_PeriodLength} ${DATE_LOOP} ) 
     622                Length1=$( create_ts_begin_date ${DATE_LOOP} end) 
    570623                DATE_TAB=$(  IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} $(( 1 - Length1 )) )_${DATE_LOOP} 
    571624 
    572                 Length2=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_LOOP} ) 
     625                Length2=$( create_ts_next_date ${DATE_LOOP} end) 
    573626                DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length2} ) 
    574627 
     
    596649            # WE CAN CONCATENATE FILES AT THIS POINT 
    597650            [ "${FLAG_B}" = "TRUE" ] && DATE_BUILD_B=${DateBegin}_${DATE_FIN_JOB_B_LOOP_PREC} 
    598             Length=$( create_ts_begin_date ${config_UserChoices_PeriodLength} ${DATE_COURANTE} ) 
     651            Length=$( create_ts_begin_date ${DATE_COURANTE} end) 
    599652            DATE_BUILD1=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} -$(( Length - 1 )) ) 
    600653            DATE_BUILD=${DATE_BUILD1}_${DATE_FIN} 
  • /trunk/libIGCM/AA_job

    r20 r30  
    361361    #D- 
    362362    # ------------------------------------------------------------------ 
    363     #D- Launch post-treatment process if necessary 
    364     # ------------------------------------------------------------------ 
    365     IGCM_post_Initialize 
     363    #D- Launch remote rebuild or/and post-treatment process if necessary 
     364    # ------------------------------------------------------------------ 
     365    IGCM_post_Configure 
    366366 
    367367    #D- 
  • /trunk/libIGCM/libIGCM_card/IGCM_card_Test.ksh

    r20 r30  
    8282 
    8383diff ${libIGCM}/libIGCM_card/TestFile.card NewTestFile.card 
    84 rm -f NewTestFile.card 
     84rm -f NewTestFile.card NewTestFile.card.bak 
    8585 
  • /trunk/libIGCM/libIGCM_card/IGCM_card_WriteOption.awk

    r20 r30  
    102102END { 
    103103 
    104 if (! exit_value ) { 
     104    if (! exit_value ) { 
    105105 
    106 myprint("###############################") 
    107 myprint("section      ====> " section) 
    108 myprint("option       ====> " option) 
    109 myprint("value        ====> " value) 
     106        myprint("###############################") 
     107        myprint("section      ====> " section) 
     108        myprint("option       ====> " option) 
     109        myprint("value        ====> " value) 
     110         
     111        if (section_found == 0) { 
     112            print "Error: Section not found", section, option 
     113        } else if (option_found == 0) { 
     114            print "Error: Option not found", section, option 
     115        }        
     116         
     117    } else { 
    110118 
    111 if (section_found == 0) { 
    112         print "Error: Section not found" 
    113 } else if (option_found == 0) { 
    114         print "Error: Option not found" 
    115 }        
     119        print "Error in with IGCM_WriteOption : ", section, option 
    116120 
    117 } 
     121    } 
    118122 
    119123} 
  • /trunk/libIGCM/libIGCM_card/libIGCM_card.ksh

    r20 r30  
    167167#D-#================================================================== 
    168168#D-function IGCM_card_WriteOption 
    169 #D-* Purpose: Write an option from a given file.card and section 
     169#D-* Purpose: Write an option in a given file.card and section 
    170170#D-* Usage: IGCM_card_WriteOption file.card section newvalue 
    171171#D-* Examples: IGCM_card_WriteOption file.card Recipes Red 150 
     
    181181        typeset tmpfile=tmpfile_$$ 
    182182        ( awk -f ${libIGCM}/libIGCM_card/IGCM_card_WriteOption.awk -- "$@" 2> /dev/null ) > ${tmpfile} 
     183        cp $1 $1.bak 
    183184        mv ${tmpfile} $1 
    184185    else 
     
    188189    fi 
    189190    IGCM_debug_PopStack "IGCM_card_WriteOption" 
     191} 
     192 
     193#D-#================================================================== 
     194#D-function IGCM_card_WriteArrayOption 
     195#D-* Purpose: Write an array option a given file.card and section 
     196#D-* Usage: IGCM_card_WriteArrayOption file.card section option newarray 
     197#D-* Examples: set -A MyArray -- 1 2 3 
     198#D-            IGCM_card_WriteArrayOption file.card Recipes List MyArray 
     199#D- 
     200function IGCM_card_WriteArrayOption 
     201{ 
     202    IGCM_debug_PushStack "IGCM_card_WriteArrayOption" $@ 
     203 
     204    if [ -r "$1" ] && [ -w "$1" ] ; then 
     205        typeset tmpfile=tmpfile_$$ 
     206        if [ X"${4}" != X"" ]; then 
     207            tab=$4 
     208            IGCM_card_WriteOption $1 $2 $3 '('$( eval echo \${${tab}[@]} | sed -e 's/ /,/g' )')' 
     209        else 
     210            IGCM_card_WriteOption $1 $2 $3 '()' 
     211        fi 
     212    else 
     213        echo "--Error--> IGCM_card_WriteArrayOption $@" 
     214        echo "           $1 is not readable or not writable" 
     215        IGCM_debug_Exit "IGCM_card_WriteArrayOption" 
     216    fi 
     217    IGCM_debug_PopStack "IGCM_card_WriteArrayOption" 
    190218} 
    191219 
  • /trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh

    r20 r30  
    528528 
    529529    typeset ListTextName TextName0 
    530     typeset comp compname comptagname card ListFilesName FileName0 NbFiles  
     530    typeset comp compname comptagname card ListFilesName FileName0 NbFiles SaveOnArchive 
    531531    typeset i i_ file_in file_in_ file_out file_out_ generic_file_name nb_rebuild_file 
    532532    for comp in ${config_ListOfComponents[*]} ; do 
     
    585585            (( i=0 )) 
    586586            until [ $i -ge $NbFiles ]; do 
     587                SaveOnArchive=true 
    587588                eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 
    588589                eval file_in=${file_in_} 
     
    590591                eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 
    591592                eval file_out=${file_out_} 
    592  
     593                # 
    593594                generic_file_name=$( basename ${file_in} .nc ) 
    594595                nb_rebuild_file=$( ls | grep "${generic_file_name}[_0-9]*.nc" | wc -l ) 
    595                 if [ ${nb_rebuild_file} -gt 1 ] ; then 
    596                     IGCM_debug_Print 2 "Rebuilding  ${file_in}" 
    597                     IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc 
    598                     # DEBUG Rebuild : 
    599                     #eval IGCM_sys_Cp ${generic_file_name}_*.nc \${R_OUT_${comp}_O_M}/ 
    600                 elif [ -f ${generic_file_name}_0000.nc ] ; then 
     596                # 
     597                if ( [ ${nb_rebuild_file} -eq 1 ] && [ -f ${generic_file_name}_0000.nc ] ) ; then 
     598                    IGCM_debug_Print 2 "Parallelism with 1 process. Rebuilding ${file_in} not needed" 
    601599                    IGCM_sys_Mv ${generic_file_name}_0000.nc ${file_in} 
     600                elif [ ${nb_rebuild_file} -gt 1 ] ; then 
     601                    IGCM_debug_Print 2 "Parallelism detected rebuilding ${file_in} is needed" 
     602                    if ( [ X${config_Post_RebuildFrequency} = X${NULL_STR} ] || [ X${config_Post_RebuildFrequency} = XNONE ] ) ; then 
     603                        IGCM_debug_Print 2 "Rebuilding ${file_in} online" 
     604                        IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc 
     605                    else 
     606                        IGCM_debug_Print 2 "Preparing offline rebuild for ${file_in}" 
     607                        IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin} 
     608                        IGCM_sys_Mv ${generic_file_name}_????.nc ${RUN_DIR}/REBUILD_${PeriodDateBegin} 
     609                        # Prepare headers for the shell dedicated to offline rebuild 
     610                        if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then 
     611                            echo \#!/bin/ksh                               > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     612                            echo function IGCM_FlushRebuild               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     613                            echo {                                        >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     614                            echo IGCM_debug_PushStack "IGCM_FlushRebuild" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     615                            echo echo                                     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     616                            echo IGCM_debug_Print 1 "IGCM_FlushRebuild :" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     617                            echo echo                                     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     618                        fi 
     619                        # Prepare the shell dedicated to offline rebuild 
     620                        echo IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     621                        echo IGCM_sys_Put_Out ${file_in} ${file_out}               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     622                        echo IGCM_sys_Rm ${generic_file_name}_*.nc                 >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     623                        SaveOnArchive=false 
     624                    fi 
    602625                fi 
    603  
    604                 IGCM_sys_Put_Out ${file_in} ${file_out} 
    605                 if [ $? -eq 0 ] ; then 
    606                     eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1 
     626                # 
     627                if [ ${SaveOnArchive} = true ] ; then 
     628                    IGCM_sys_Put_Out ${file_in} ${file_out} 
     629                    [ $? -eq 0 ] && eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1 
    607630                    if [ ${nb_rebuild_file} -gt 1 ] ; then 
    608                         eval FileToBeDeleted[${#FileToBeDeleted[@]}]=$( ls | grep "${generic_file_name}_[0-9]*.nc" ) > /dev/null 2>&1 
     631                        for DelFile in $( ls | grep "${generic_file_name}[_0-9]*.nc" ) ; do 
     632                            eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${DelFile} > /dev/null 2>&1 
     633                        done 
    609634                    fi 
    610635                fi 
  • /trunk/libIGCM/libIGCM_config/libIGCM_config.ksh

    r20 r30  
    118118    done 
    119119 
     120    echo 
     121    IGCM_debug_Print 1 "DefineVariableFromOption : config_Post" 
     122    # 
     123    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Post RebuildFrequency 
     124    # 
     125 
    120126    #================================================================# 
    121127    #                  Test and Prepare directories                  # 
     
    195201 
    196202        case ${config_UserChoices_PeriodLength} in 
    197             1Y|1y)  
    198                 (( PeriodLengthInDays = $( IGCM_date_DaysInYear $year ) )) ;; 
    199             1M|1m)  
    200                 (( PeriodLengthInDays = $( IGCM_date_DaysInMonth $year $month ) )) ;; 
    201             5D|5d)  
    202                 (( PeriodLengthInDays = 5 )) ;; 
    203             1D|1d)  
    204                 (( 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}' ) ;; 
    205231            *)  
    206                 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." 
    207233                IGCM_debug_Verif_Exit ;; 
    208234        esac 
     
    271297        # Determine number of day(s) in PeriodLength : 
    272298        case ${config_UserChoices_PeriodLength} in 
    273             1Y|1y)  
    274                 (( PeriodLengthInDays = $( IGCM_date_DaysInYear $year ) )) ;; 
    275             1M|1m)  
    276                 (( PeriodLengthInDays = $( IGCM_date_DaysInMonth $year $month ) )) ;; 
    277             5D|5d)  
    278                 (( PeriodLengthInDays=5 )) ;; 
    279             1D|1d)  
    280                 (( 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}' ) ;; 
    281327            *)  
    282                 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." 
    283329                IGCM_debug_Verif_Exit ;; 
    284330        esac 
     
    457503    # Determine number of day(s) in PeriodLength : 
    458504    case ${config_UserChoices_PeriodLength} in 
    459         1Y|1y) PeriodLengthInDays=$( expr $( IGCM_date_DaysInYear $year ) ) ;; 
    460         1M|1m) PeriodLengthInDays=$( expr $( IGCM_date_DaysInMonth $year $month ) ) ;; 
    461         5D|5d) PeriodLengthInDays=$( expr 5 ) ;; 
    462         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}' ) ;; 
    463533    esac 
    464534    PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateBegin} $( expr ${PeriodLengthInDays} - 1 ) ) 
  • /trunk/libIGCM/libIGCM_date/libIGCM_date.ksh

    r20 r30  
    153153function IGCM_date_DaysInYear 
    154154{ 
    155     IGCM_debug_PushStack "IGCM_date_DaysInYear" $@ 
     155#    IGCM_debug_PushStack "IGCM_date_DaysInYear" $@ 
    156156    # return the number of days in a year 
    157157    # usage IGCM_date_DaysInYear yyyy 
     
    159159    # What is the calendar : 
    160160    if [ "${config_UserChoices_CalendarType}" = "360d" ] ; then 
    161         echo 360 
    162         IGCM_debug_PopStack "IGCM_date_DaysInYear" 
     161        if [ X$2 = X ] ; then 
     162            echo 360 
     163        else 
     164            eval $2=360 > /dev/null 2>&1 
     165        fi 
     166#       IGCM_debug_PopStack "IGCM_date_DaysInYear" 
    163167        return 
    164168    else 
    165169        if [ "${config_UserChoices_CalendarType}" = "noleap" ] ; then 
    166             echo 365 
    167             IGCM_debug_PopStack "IGCM_date_DaysInYear" 
     170            if [ X$2 = X ] ; then 
     171                echo 365 
     172            else 
     173                eval $2=365 > /dev/null 2>&1 
     174            fi 
     175 
     176#           IGCM_debug_PopStack "IGCM_date_DaysInYear" 
    168177            return 
    169178        fi 
    170179    fi 
     180 
     181    typeset y a 
    171182 
    172183    # if there is no argument on the command line,  
     
    184195 
    185196    # if it is evenly divisible by 400 it must be a leap year 
    186     a=$( expr $y \% 400 ) 
     197    a=$(( $y % 400 )) 
    187198    if [ $a = 0 ] 
    188199        then 
    189         echo 366 
    190         IGCM_debug_PopStack "IGCM_date_DaysInYear" 
     200        if [ X$2 = X ] ; then 
     201            echo 366 
     202        else 
     203            eval $2=366 > /dev/null 2>&1 
     204        fi 
     205 
     206#       IGCM_debug_PopStack "IGCM_date_DaysInYear" 
    191207        return 
    192208    fi 
    193209 
    194210    #if it is evenly divisible by 100 it must not be a leap year 
    195     a=$( expr $y \% 100 ) 
     211    a=$(( $y % 100 )) 
    196212    if [ $a = 0 ] 
    197213        then 
    198         echo 365 
    199         IGCM_debug_PopStack "IGCM_date_DaysInYear" 
     214        if [ X$2 = X ] ; then 
     215            echo 365 
     216        else 
     217            eval $2=365 > /dev/null 2>&1 
     218        fi 
     219 
     220#       IGCM_debug_PopStack "IGCM_date_DaysInYear" 
    200221        return 
    201222    fi 
    202223         
    203224    # if it is evenly divisible by 4 it must be a leap year 
    204     a=$( expr $y \% 4 ) 
     225    a=$(( $y % 4 )) 
    205226    if [ $a = 0 ] 
    206227        then 
    207         echo 366 
    208         IGCM_debug_PopStack "IGCM_date_DaysInYear" 
     228        if [ X$2 = X ] ; then 
     229            echo 366 
     230        else 
     231            eval $2=366 > /dev/null 2>&1 
     232        fi 
     233 
     234#       IGCM_debug_PopStack "IGCM_date_DaysInYear" 
    209235        return 
    210236    fi 
    211237 
    212238    # otherwise it is not a leap year 
    213     echo 365 
    214  
    215     IGCM_debug_PopStack "IGCM_date_DaysInYear" 
     239    if [ X$2 = X ] ; then 
     240        echo 365 
     241    else 
     242        eval $2=365 > /dev/null 2>&1 
     243    fi 
     244 
     245#    IGCM_debug_PopStack "IGCM_date_DaysInYear" 
    216246} 
    217247 
     
    227257function IGCM_date_DaysInMonth 
    228258{ 
    229     IGCM_debug_PushStack "IGCM_date_DaysInMonth" $@ 
     259#    IGCM_debug_PushStack "IGCM_date_DaysInMonth" $@ 
    230260 
    231261    # calculates the number of days in a month  
    232262    # usage IGCM_date_DaysInMonth yyyy mm 
    233263    # or IGCM_date_DaysInMonth yyyymmdd 
    234  
     264     
    235265    # What is the calendar : 
    236266    if [ "${config_UserChoices_CalendarType}" = "360d" ] ; then 
    237         echo 30 
    238         IGCM_debug_PopStack "IGCM_date_DaysInMonth" 
     267        if [ X$3 = X ] ; then 
     268            echo 30 
     269        else 
     270            eval $3=30 > /dev/null 2>&1 
     271        fi 
     272 
     273#       IGCM_debug_PopStack "IGCM_date_DaysInMonth" 
    239274        return 
    240275    fi 
     276 
     277    typeset ymd y m diy 
    241278 
    242279    # if there are no command line arguments then assume that a yyyymmdd is being 
     
    251288        ymd=$1 
    252289    else 
    253         ymd=$( expr \( \( $1 \* 10000 \) \+ \( $2 \* 100 \) \+ 1 \) ) 
     290        ymd=$(( ( $1 * 10000 ) + ( $2 * 100 ) + 1 )) 
    254291    fi 
    255292 
    256293    # extract the year and the month 
    257     y=$( expr $ymd / 10000 ) ; 
    258     m=$( expr \( $ymd \% 10000 \) / 100 ) ; 
     294    y=$(( $ymd / 10000 )) ; 
     295    m=$(( ( $ymd % 10000 ) / 100 )) ; 
    259296 
    260297    # 30 days hath september etc. 
    261298    case $m in 
    262299        1|3|5|7|8|10|12)  
    263             echo 31 
    264             IGCM_debug_PopStack "IGCM_date_DaysInMonth" 
     300            if [ X$3 = X ] ; then 
     301                echo 31 
     302            else 
     303                eval $3=31 > /dev/null 2>&1 
     304            fi 
     305 
     306#           IGCM_debug_PopStack "IGCM_date_DaysInMonth" 
    265307            return ;; 
    266308        4|6|9|11)  
    267             echo 30      
    268             IGCM_debug_PopStack "IGCM_date_DaysInMonth" 
     309            if [ X$3 = X ] ; then 
     310                echo 30 
     311            else 
     312                eval $3=30 > /dev/null 2>&1 
     313            fi 
     314         
     315#           IGCM_debug_PopStack "IGCM_date_DaysInMonth" 
    269316            return ;; 
    270317        *) ;; 
     
    274321    # Use IGCM_date_DaysInYear to get the number of days in the year and return a value 
    275322    # accordingly. 
    276     diy=$( IGCM_date_DaysInYear $y ) 
     323    IGCM_date_DaysInYear $y diy 
    277324    case $diy in 
    278325        365)  
    279             echo 28 
    280             IGCM_debug_PopStack "IGCM_date_DaysInMonth" 
     326            if [ X$3 = X ] ; then 
     327                echo 28 
     328            else 
     329                eval $3=28 > /dev/null 2>&1 
     330            fi 
     331 
     332#           IGCM_debug_PopStack "IGCM_date_DaysInMonth" 
    281333            return ;; 
    282334        366)  
    283             echo 29 
    284             IGCM_debug_PopStack "IGCM_date_DaysInMonth" 
     335            if [ X$3 = X ] ; then 
     336                echo 29 
     337            else 
     338                eval $3=29 > /dev/null 2>&1 
     339            fi 
     340 
     341#           IGCM_debug_PopStack "IGCM_date_DaysInMonth" 
    285342            return ;; 
    286343    esac 
    287344 
    288     IGCM_debug_PopStack "IGCM_date_DaysInMonth" 
     345#    IGCM_debug_PopStack "IGCM_date_DaysInMonth" 
    289346} 
    290347 
     
    303360    # usage IGCM_date_ConvertGregorianDateToJulian 19980429 
    304361 
     362    typeset dt y m d x jul 
     363 
    305364    # if there is no command line argument, then assume that the date 
    306365    # is coming in on a pipe and use read to collect it     
     
    313372 
    314373    # break the yyyymmdd into separate parts for year, month and day 
    315     y=$( expr $dt / 10000 ) 
    316     m=$( expr \( $dt \% 10000 \) / 100 ) 
    317     d=$( expr \( $dt \% 100 \) ) 
     374    y=$(( $dt / 10000 )) 
     375    m=$(( ( $dt % 10000 ) / 100 )) 
     376    d=$(( ( $dt % 100 ) )) 
    318377 
    319378    # add the days in each month up to (but not including the month itself) 
     
    323382    # and add them to 14. 
    324383    x=1 
    325     while [ $( expr $x \< $m ) = 1 ] 
     384    while [ $x -lt $m ] 
    326385      do 
    327       md=$( IGCM_date_DaysInMonth $y $x ) 
    328       d=$( expr \( $d \+ $md \) ) 
    329       x=$( expr \( $x \+ 1 \) ) 
     386      IGCM_date_DaysInMonth $y $x md 
     387      d=$(( $d + $md )) 
     388      x=$(( $x + 1 )) 
    330389    done 
    331390 
    332391    # combine the year and day back together again and you have the julian date. 
    333     jul=$( expr \( $y \* 1000 \) + $d ) 
     392    jul=$(( ( $y * 1000 ) + $d )) 
    334393    echo $jul 
    335394 
     
    351410    # usage IGCM_date_ConvertJulianDateToGregorian 1998213 
    352411 
     412    typeset dt y m d md grg 
     413 
    353414    # if there is no command line argument, assume one is being  
    354415    # piped in and read it 
     
    361422         
    362423    # break apart the year and the days 
    363     y=$( expr $dt / 1000 ) 
    364     d=$( expr $dt \% 1000 ) 
     424    y=$(( $dt / 1000 )) 
     425    d=$(( $dt % 1000 )) 
    365426         
    366427    # subtract the number of days in each month starting from 1 
     
    369430    # month to get the correct day of the month 
    370431    m=1 
    371     while [ $( expr $d \> 0 ) = 1 ] 
     432    while [ $d -gt 0 ] 
    372433      do 
    373       md=$( IGCM_date_DaysInMonth $y $m ) 
    374       d=$( expr $d \- $md ) 
    375       m=$( expr $m \+ 1 ) 
     434      IGCM_date_DaysInMonth $y $m md 
     435      d=$(( $d - $md )) 
     436      m=$(( $m + 1 )) 
    376437    done 
    377438 
    378     d=$( expr $d \+ $md ) 
     439    d=$(( $d + $md )) 
    379440 
    380441    # the loop steps one past the correct month, so back up the month 
    381     m=$( expr $m \- 1 ) 
     442    m=$(( $m - 1 )) 
    382443 
    383444    # assemble the results into a gregorian date 
    384     grg=$( expr \( $y \* 10000 \) \+ \( $m \* 100 \) \+ $d ) 
     445    grg=$(( ( $y * 10000 ) + ( $m * 100 ) + $d )) 
    385446    echo $( IGCM_date_GregorianDigit $grg ) 
    386447 
     
    402463    # usage IGCM_date_AddDaysToJulianDate 1998312 { ,-}14 
    403464 
     465    typeset dif yd d y diy 
     466 
    404467    # Read the difference from the command lines 
    405468    # and the date from the command line, or standard input 
     
    414477 
    415478    # Break it into pieces 
    416     d=$( expr $yd \% 1000 ) 
    417     y=$( expr $yd / 1000 ) 
     479    d=$(( $yd % 1000 )) 
     480    y=$(( $yd / 1000 )) 
    418481 
    419482    # Add the number of days (if days is negative this results is 
    420483    # a subtraction) 
    421     d=$( expr $d \+ $dif ) 
     484    d=$(( $d + $dif )) 
    422485 
    423486    # Extract the days in the year 
    424     diy=$( IGCM_date_DaysInYear $y ) 
     487    IGCM_date_DaysInYear $y diy 
    425488 
    426489    # If the calculated day exceeds the days in the year,  
     
    429492    # test until you end up with a day number that falls within the 
    430493    # days of the year 
    431     while [ $( expr $d \> $diy ) = 1 ] 
     494    while [ $d -gt $diy ] 
    432495      do 
    433       d=$( expr $d - $diy ) 
    434       y=$( expr $y \+ 1 ) 
    435       diy=$( IGCM_date_DaysInYear $y ) 
     496      d=$(( $d - $diy )) 
     497      y=$(( $y + 1 )) 
     498      IGCM_date_DaysInYear $y diy 
    436499    done 
    437500 
     
    441504    # loop on this test until you end up with a number that 
    442505    # falls within the days of the year 
    443     while [ $( expr $d \< 1 ) = 1 ] 
     506    while [ $d -lt 1 ] 
    444507      do 
    445       y=$( expr $y - 1 ) 
    446       diy=$( IGCM_date_DaysInYear $y ) 
    447       d=$( expr $d \+ $diy ) 
     508      y=$(( $y - 1 )) 
     509      IGCM_date_DaysInYear $y diy 
     510      d=$(( $d + $diy )) 
    448511    done 
    449512 
    450513    # put the year and day back together and echo the result 
    451     yd=$( expr \( $y \* 1000 \) + $d ) 
     514    yd=$(( ( $y * 1000 ) + $d )) 
    452515 
    453516    echo $yd 
     
    539602 
    540603    # Break the dates in to year and day portions 
    541     yyyy1=$( expr $jul1 / 1000 ) 
    542     yyyy2=$( expr $jul2 / 1000 ) 
    543     ddd1=$( expr $jul1 \% 1000 ) 
    544     ddd2=$( expr $jul2 \% 1000 ) 
     604    yyyy1=$(( $jul1 / 1000 )) 
     605    yyyy2=$(( $jul2 / 1000 )) 
     606    ddd1=$(( $jul1 % 1000 )) 
     607    ddd2=$(( $jul2 % 1000 )) 
    545608 
    546609    # Subtract days 
    547     res=$( expr $ddd1 - $ddd2 ) 
     610    res=$(( $ddd1 - $ddd2 )) 
    548611 
    549612    # Then add days in year until year2 matches year1 
    550613 
    551614    if [ "${config_UserChoices_CalendarType}" = "360d" ] ; then 
    552         res=$( expr \( \( $yyyy1 \- $yyyy2 \) \* 360 \) \+ $res ) 
     615        res=$(( ( ( $yyyy1 - $yyyy2 ) * 360 ) + $res )) 
    553616    elif [ "${config_UserChoices_CalendarType}" = "noleap" ] ; then 
    554         res=$( expr \( \( $yyyy1 \- $yyyy2 \) \* 365 \) \+ $res ) 
     617        res=$(( ( ( $yyyy1 - $yyyy2 ) * 365 ) + $res )) 
    555618    elif ( [ "${config_UserChoices_CalendarType}" = "leap" ] || [ "${config_UserChoices_CalendarType}" = "gregorian" ] ) ; then 
    556619        while [ $yyyy2 -lt $yyyy1 ] 
    557620          do 
    558           diy=$( IGCM_date_DaysInYear $yyyy2 ) 
    559           res=$( expr $res + $diy ) 
    560           yyyy2=$( expr $yyyy2 + 1 ) 
     621          IGCM_date_DaysInYear $yyyy2 diy 
     622          res=$(( $res + $diy )) 
     623          yyyy2=$(( $yyyy2 + 1 )) 
    561624        done 
    562625    fi 
     
    567630    if [ $1 -lt $2 ] 
    568631        then 
    569         res=$( expr $res \* -1 ) 
     632        res=$(( $res * -1 )) 
    570633    fi 
    571634  
     
    690753        num=19000101 
    691754    fi 
    692     echo $( expr \( $( IGCM_date_DaysBetweenGregorianDate $1 ${num} ) \+ $aux \) ) 
     755    echo $(( $( IGCM_date_DaysBetweenGregorianDate $1 ${num} ) + $aux )) 
    693756 
    694757    IGCM_debug_PopStack "IGCM_date_DaysSinceJC" 
  • /trunk/libIGCM/libIGCM_post/libIGCM_post.ksh

    r20 r30  
    1515 
    1616#======================================================================= 
     17 
     18function IGCM_post_Configure 
     19{ 
     20    IGCM_debug_PushStack "IGCM_post_Configure" 
     21 
     22    # Debug Print : 
     23    echo 
     24    IGCM_debug_Print 1 "IGCM_post_Configure :" 
     25    echo 
     26 
     27    typeset NbDays PeriodEndJul PostEndJul PeriodPost 
     28    RebuildFrequency=false 
     29 
     30    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then 
     31 
     32        IGCM_debug_Print 1 "Asynchronous rebuild has been activated." 
     33        echo 
     34 
     35        case ${config_Post_RebuildFrequency} in 
     36            *y|*Y) 
     37                PeriodYear=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[yY]//" ) 
     38                case ${config_UserChoices_PeriodLength} in 
     39                    *Y|*y) 
     40                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[yY]//" ) 
     41                        if [ ${PeriodPost} -le ${PeriodYear} ] ; then 
     42                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodYear}  ) -eq 0 ] ;  then 
     43                                RebuildFrequency=true 
     44                                NbRebuildDir=$( expr ${PeriodYear} / ${PeriodPost} ) 
     45                            fi 
     46                        else 
     47                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
     48                            IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" 
     49                        fi ;; 
     50                    *M|*m) 
     51                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" ) 
     52                        if [ ${PeriodPost} -le $(( ${PeriodYear} * 12 )) ] ; then 
     53                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then 
     54                                RebuildFrequency=true 
     55                                NbRebuildDir=$( expr $(( 12 * ${PeriodYear} )) / ${PeriodPost} ) 
     56                            fi 
     57                        else 
     58                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
     59                            IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" 
     60                        fi ;; 
     61                    *D|*d) 
     62                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) 
     63                        NbDays=$( IGCM_date_DaysInYear ${year} ) 
     64                        if [ ${config_UserChoices_CalendarType} = 360d ] || [ ${config_UserChoices_CalendarType} = noleap ] ; then 
     65                            if [ ${PeriodPost} -le $(( ${PeriodYear} * ${NbDays} )) ] ; then 
     66                                if [ $( expr ${CumulPeriod} % $( expr \( ${NbDays} \* ${PeriodYear} \/ ${PeriodPost} \) ) ) -eq 0 ] ; then 
     67                                    RebuildFrequency=true 
     68                                    NbRebuildDir=$( expr $(( ${NbDays} * ${PeriodYear} )) / ${PeriodPost} ) 
     69                                fi 
     70                            else 
     71                                IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
     72                                IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" 
     73                            fi 
     74                        else 
     75#                           if [ ${PeriodYear} -eq 1 ] ; then 
     76#                               PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} ) 
     77#                               PostEndJul=${year}${NbDays} 
     78#                               #echo "PeriodYear=${PeriodYear} NbDays=${NbDays}" 
     79#                               #echo "PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}" 
     80#                               if [ ${PostEndJul} -eq ${PeriodEndJul} ] ; then 
     81#                                   RebuildFrequency=true 
     82#                                   NbRebuildDir=$( expr ${NbDays} / ${PeriodPost} ) 
     83#                               fi 
     84#                           else 
     85                            IGCM_debug_Print 3 "For RebuildFrequency with leap calendar:" 
     86                            IGCM_debug_Print 3 "We have a daily PeriodLength frequency and RebuildFrequency=${PeriodYear}Y." 
     87                            IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment." 
     88#                           fi 
     89                        fi;; 
     90                esac ;; 
     91            *M|*m) 
     92                PeriodMonth=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[mM]//" ) 
     93                case ${config_UserChoices_PeriodLength} in 
     94                    *Y|*y) 
     95                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
     96                        IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;; 
     97                    *M|*m) 
     98                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" ) 
     99                        if [ ${PeriodPost} -le ${PeriodMonth} ] ; then 
     100                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodMonth}  ) -eq 0 ] ;  then 
     101                                RebuildFrequency=true 
     102                                NbRebuildDir=$( expr ${PeriodMonth} / ${PeriodPost} ) 
     103                            fi 
     104                        else 
     105                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
     106                            IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" 
     107                        fi ;; 
     108                    *D|*d) 
     109                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
     110                        IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" ;; 
     111                esac 
     112                ;; 
     113            NONE|none) 
     114                ;; 
     115            *) 
     116                IGCM_debug_Print 3 "KeyWord not allowed for RebuildFrequency in config.card" 
     117                ;; 
     118        esac 
     119    else 
     120        # 
     121        IGCM_debug_Print 1 "Asynchronous rebuild has not been activated" 
     122        IGCM_debug_Print 1 "Proceed with standard post-treatment pathway" 
     123        echo 
     124        # 
     125    fi 
     126 
     127    IGCM_debug_Print 1 "RebuildFrequency flag value : ${RebuildFrequency}" 
     128    IGCM_post_Initialize 
     129 
     130    IGCM_debug_PopStack "IGCM_post_Configure" 
     131} 
     132 
    17133function IGCM_post_Initialize 
    18134{ 
     
    29145    # READ TIME SERIES OR SEASONAL FREQUENCY 
    30146    # AND TURN ON THE FLAG WHEN MODULO IS ZERO 
    31     for post_freq in RebuildFrequency TimeSeriesFrequency SeasonalFrequency ; do 
     147    for post_freq in TimeSeriesFrequency SeasonalFrequency ; do 
    32148        # 
    33149        # Initialize 
     
    45161        # 
    46162        if ( [ X${config_Post_post_freq} = X${NULL_STR} ] || [ X${config_Post_post_freq} = XNONE ] ) ; then 
    47           # 
    48           continue 
    49           # 
     163            # 
     164            continue 
     165            # 
    50166        fi 
    51167        # 
     
    60176            # 
    61177            if [ X${FileName0} != X${NULL_STR} ] ; then 
    62               # 
    63               #IGCM_debug_Print 1 "Component      : ${compname}" 
    64               # 
    65               # INITIALISATION 
    66               # 
    67               eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 
    68               typeset i=0 
    69               # 
    70               until [ $i -eq $NbFiles ]; do 
    71178                # 
    72                 eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 
    73                 eval file_in=${file_in_} 
    74                 let $(( i_ = i+2 )) 
    75                 eval flag_post_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 
    76                 eval flag_post=${flag_post_} 
     179                #IGCM_debug_Print 1 "Component      : ${compname}" 
    77180                # 
    78                 if [ X${flag_post} != XNONE ] ; then 
    79                   # 
    80                   # Initialize ${flag_post}_${compname}_${post_freq} 
    81                   # 
    82                   eval ${flag_post}_${compname}_${post_freq}=false 
    83                   # 
    84                   case ${config_Post_post_freq} in 
    85                     *y|*Y) 
    86                       PeriodYear=$( echo ${config_Post_post_freq} | sed -e "s/[yY]//" ) 
    87                       case ${config_UserChoices_PeriodLength} in 
    88                         1Y|1y) 
    89                           if [ $( expr ${CumulPeriod} % ${PeriodYear}  ) -eq 0 ] ;  then 
    90                              eval ${flag_post}_${compname}_${post_freq}=true 
    91                              eval ${post_freq}=true 
    92                              POST=true 
    93                           fi ;; 
    94                         1M|1m) 
    95                           if [ $( expr ${CumulPeriod} % $( expr ${PeriodYear} \* 12 ) ) -eq 0 ] ; then 
    96                              eval ${flag_post}_${compname}_${post_freq}=true 
    97                              eval ${post_freq}=true 
    98                              POST=true 
    99                           fi ;; 
    100                         *D|*d) 
    101                           LengthDays=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) 
    102                           NbDays=$( IGCM_date_DaysInYear ${year} ) 
    103                           if [ ${config_UserChoices_CalendarType} = 360d ] | [ ${config_UserChoices_CalendarType} = noleap ] ; then 
    104                              if [ $( expr ${CumulPeriod} % $( expr \( ${NbDays} \* ${PeriodYear} \/ ${LengthDays} \) ) ) -eq 0 ] ; then 
    105                                 eval ${flag_post}_${compname}_${post_freq}=true 
    106                                 eval ${post_freq}=true 
    107                                 POST=true 
    108                              fi 
    109                           else 
    110                               if [ ${PeriodYear} -eq 1 ] ; then 
    111                                 PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} ) 
    112                                 PostEndJul=${year}${NbDays} 
    113                                 #echo "PeriodYear=${PeriodYear} Year ; NbDays${NbDays} PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}" 
    114                                 if [ ${PostEndJul} -le ${PeriodEndJul} ] ; then 
    115                                    eval ${flag_post}_${compname}_${post_freq}=true 
    116                                    eval ${post_freq}=true 
    117                                    POST=true 
    118                                 fi 
    119                               else 
    120                                 echo "For ${post_freq}, for ${comp} and ${file_in} :" 
    121                                 echo "We have a daily WriteFrequency and ${post_freq}=${PeriodYear}Y." 
    122                                 echo "No post-treatment." 
    123                               fi 
    124                             fi;; 
    125                       esac ;; 
    126                     1M|1m) 
    127                       case ${config_UserChoices_PeriodLength} in 
    128                         1Y|1y) 
    129                           IGCM_debug_Print 3 "Frequency not allowed for TimeSeriesFrequency in ${flag_post}" ;; 
    130                         1M|1m) 
    131                           eval ${flag_post}_${compname}_${post_freq}=true 
    132                           eval ${post_freq}=true 
    133                           POST=true;; 
    134                         *D|*d) 
    135                           NbDays=$( IGCM_date_DaysInMonth ${year} ${month} ) 
    136                           PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} ) 
    137                           PostEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${year}${month}${NbDays} ) 
    138                           #echo "year_month=${year}_${month} Month ; NbDays${NbDays} PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}" 
    139                           if [ ${PostEndJul} -le ${PeriodEndJul} ] ; then 
    140                             eval ${flag_post}_${compname}_${post_freq}=true 
    141                             eval ${post_freq}=true 
    142                             POST=true 
    143                           fi 
    144                           ;; 
    145                       esac 
    146                         ;; 
    147                     NONE|none) 
    148                       ;; 
    149                     *) 
    150                       IGCM_debug_Print 3 "KeyWord not allowed for ${post_freq} in config.card" 
    151                       ;; 
    152                   esac 
    153                 fi 
    154                 let $(( i=i+3 )) 
    155               done 
     181                # INITIALISATION 
     182                # 
     183                eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 
     184                typeset i=0 
     185                # 
     186                until [ $i -eq $NbFiles ]; do 
     187                    # 
     188                    eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 
     189                    eval file_in=${file_in_} 
     190                    let $(( i_ = i+2 )) 
     191                    eval flag_post_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 
     192                    eval flag_post=${flag_post_} 
     193                    # 
     194                    if [ X${flag_post} != XNONE ] ; then 
     195                    # 
     196                        case ${config_Post_post_freq} in 
     197                            *y|*Y) 
     198                                PeriodYear=$( echo ${config_Post_post_freq} | sed -e "s/[yY]//" ) 
     199                                case ${config_UserChoices_PeriodLength} in 
     200                                    *Y|*y) 
     201                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[yY]//" ) 
     202                                        if [ ${PeriodPost} -le ${PeriodYear} ] ; then 
     203                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodYear}  ) -eq 0 ] ;  then 
     204                                                eval ${post_freq}=true 
     205                                                POST=true 
     206                                            fi 
     207                                        else 
     208                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
     209                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " 
     210                                        fi ;; 
     211                                    *M|*m) 
     212                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" ) 
     213                                        if [ ${PeriodPost} -le $(( ${PeriodYear} * 12 )) ] ; then 
     214                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then 
     215                                                eval ${post_freq}=true 
     216                                                POST=true 
     217                                            fi 
     218                                        else 
     219                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
     220                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " 
     221                                        fi ;; 
     222                                    *D|*d) 
     223                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) 
     224                                        NbDays=$( IGCM_date_DaysInYear ${year} ) 
     225                                        if [ ${config_UserChoices_CalendarType} = 360d ] | [ ${config_UserChoices_CalendarType} = noleap ] ; then 
     226                                            if [ ${PeriodPost} -le $(( ${PeriodYear} * ${NbDays} )) ] ; then 
     227                                                if [ $( expr ${CumulPeriod} % $( expr \( ${NbDays} \* ${PeriodYear} \/ ${PeriodPost} \) ) ) -eq 0 ] ; then 
     228                                                    eval ${post_freq}=true 
     229                                                    POST=true 
     230                                                fi 
     231                                            else 
     232                                                IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
     233                                                IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " 
     234                                            fi 
     235                                        else 
     236#                                           if [ ${PeriodYear} -eq 1 ] ; then 
     237#                                               PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} ) 
     238#                                               PostEndJul=${year}${NbDays} 
     239#                                                #echo "PeriodYear=${PeriodYear} NbDays=${NbDays}" 
     240#                                               #echo PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}" 
     241#                                               if [ ${PostEndJul} -le ${PeriodEndJul} ] ; then 
     242#                                                   eval ${post_freq}=true 
     243#                                                   POST=true 
     244#                                               fi 
     245#                                           else 
     246                                            IGCM_debug_Print 3 "For ${post_freq} with leap calendar, for ${comp} and ${file_in} :" 
     247                                            IGCM_debug_Print 3 "We have a daily PeriodLength frequency and RebuildFrequency=${PeriodYear}Y." 
     248                                            IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment." 
     249#                                           fi 
     250                                        fi;; 
     251                                esac ;; 
     252                            *M|*m) 
     253                                PeriodMonth=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[mM]//" ) 
     254                                case ${config_UserChoices_PeriodLength} in 
     255                                    *Y|*y) 
     256                                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
     257                                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;; 
     258                                    *M|*m) 
     259                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" ) 
     260                                        if [ ${PeriodPost} -le ${PeriodMonth} ] ; then 
     261                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodMonth}  ) -eq 0 ] ;  then 
     262                                                eval ${post_freq}=true 
     263                                                POST=true 
     264                                            fi 
     265                                        else 
     266                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
     267                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " 
     268                                        fi;; 
     269                                    *D|*d) 
     270                                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with" 
     271                                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;; 
     272                                esac ;; 
     273                            NONE|none) 
     274                                ;; 
     275                            *) 
     276                                IGCM_debug_Print 3 "KeyWord not allowed for ${post_freq} in config.card" 
     277                                ;; 
     278                        esac 
     279                    fi 
     280                    let $(( i=i+3 )) 
     281                done 
    156282            fi 
    157283        done 
    158284    done 
    159285    IGCM_debug_Print 1 "POST-TREATEMENT flag value : ${POST}" 
    160     [ ${POST} = true ] && IGCM_post_Submit 
     286    [ ${POST} = true ] || [ ${RebuildFrequency} = true ] && IGCM_post_Submit 
    161287 
    162288    IGCM_debug_PopStack "IGCM_post_Initialize" 
     
    172298    echo 
    173299 
    174     typeset comp 
    175  
    176300    POST_DIR=${R_OUT_POST}/${config_UserChoices_TagName}/${config_UserChoices_JobName} 
    177     echo "POST_DIR = ${POST_DIR}" 
     301    IGCM_debug_Print 1 "POST_DIR = ${POST_DIR}" 
     302 
     303    #============ TIME SERIES POST-TREATMENT ===========# 
     304    if [ ${TimeSeriesFrequency} = true ] ; then 
     305 
     306        IGCM_debug_Print 2 "TIME SERIES POST-TREATMENT :" 
     307        echo 
     308        # 
     309        typeset listVarEnv 
     310        listVarEnv="MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF" 
     311 
     312        if [ ${RebuildFrequency} = true ] ; then 
     313            # 
     314            echo IGCM_sys_QsubPost create_ts >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     315            # 
     316        else 
     317            # 
     318            IGCM_sys_RshPost <<-EOF 
     319            export MODIPSL=${MODIPSL} 
     320            export libIGCM_SX=${libIGCM} 
     321            export libIGCM=${libIGCM_POST} 
     322            export SUBMIT_DIR=${SUBMIT_DIR} 
     323            export POST_DIR=${POST_DIR} 
     324            export DateBegin=${DateBegin} 
     325            export PeriodDateEnd=${PeriodDateEnd} 
     326            export StandAlone=false 
     327            export RESOL_ATM=${RESOL_ATM} 
     328            export RESOL_OCE=${RESOL_OCE} 
     329            export RESOL_ICE=${RESOL_ICE} 
     330            export RESOL_SRF=${RESOL_SRF} 
     331            export listVarEnv=${listVarEnv} 
     332            . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh 
     333            . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh 
     334            IGCM_sys_MkdirWork ${POST_DIR} 
     335            IGCM_debug_Verif_Exit 
     336            IGCM_sys_QsubPost create_ts 
     337EOF 
     338            # 
     339        fi 
     340    fi 
     341 
     342    #=============  SEASONAL POST-TREATMENT ============# 
     343    if [ ${SeasonalFrequency} = true ] ; then 
     344        # 
     345        IGCM_debug_Print 2 "SEASONNAL POST-TREATMENT :" 
     346        echo 
     347        # 
     348        typeset listVarEnv 
     349        listVarEnv="MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF" 
     350 
     351        if [ ${RebuildFrequency} = true ] ; then 
     352            # 
     353            echo IGCM_sys_QsubPost create_se >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh 
     354            # 
     355        else 
     356            # 
     357            IGCM_sys_RshPost <<-EOF 
     358            export MODIPSL=${MODIPSL} 
     359            export libIGCM_SX=${libIGCM} 
     360            export libIGCM=${libIGCM_POST} 
     361            export SUBMIT_DIR=${SUBMIT_DIR} 
     362            export POST_DIR=${POST_DIR} 
     363            export DateBegin=${DateBegin} 
     364            export PeriodDateEnd=${PeriodDateEnd} 
     365            export StandAlone=false 
     366            export RESOL_ATM=${RESOL_ATM} 
     367            export RESOL_OCE=${RESOL_OCE} 
     368            export RESOL_ICE=${RESOL_ICE} 
     369            export RESOL_SRF=${RESOL_SRF} 
     370            export listVarEnv=${listVarEnv} 
     371            . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh 
     372            . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh 
     373            IGCM_sys_MkdirWork ${POST_DIR} 
     374            IGCM_debug_Verif_Exit 
     375            IGCM_sys_QsubPost create_se 
     376EOF 
     377        # 
     378        fi 
     379    fi 
    178380 
    179381    #============== REBUILD POST-TREATMENT =============# 
     
    183385        echo 
    184386        # 
    185         # BUILD A PACKED LIST FOR POST-TREATMENT JOB 
    186         # BECAUSE IT'S NOT POSSIBLE TO DEFINE DYNAMICAL 
    187         # VARIABLE NAME THROUGHT RSH !! 
    188         # 
    189         LISTE_PACK=" " 
    190         # 
    191     fi 
    192  
    193     #============ TIME SERIES POST-TREATMENT ===========# 
    194     if [ ${TimeSeriesFrequency} = true ] ; then 
    195  
    196         IGCM_debug_Print 2 "TIME SERIES POST-TREATMENT :" 
    197         echo 
    198         # 
    199387        typeset listVarEnv 
    200         listVarEnv="MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF" 
     388        listVarEnv="MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,RUN_DIR,POST_DIR,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF" 
    201389        IGCM_sys_RshPost <<-EOF 
    202390        export MODIPSL=${MODIPSL} 
     
    204392        export libIGCM=${libIGCM_POST} 
    205393        export SUBMIT_DIR=${SUBMIT_DIR} 
     394        export RUN_DIR=${RUN_DIR} 
    206395        export POST_DIR=${POST_DIR} 
    207396        export DateBegin=${DateBegin} 
     397        export PeriodDateBegin=${PeriodDateBegin} 
    208398        export PeriodDateEnd=${PeriodDateEnd} 
     399        export NbRebuildDir=${NbRebuildDir} 
    209400        export StandAlone=false 
    210401        export RESOL_ATM=${RESOL_ATM} 
     
    217408        IGCM_sys_MkdirWork ${POST_DIR} 
    218409        IGCM_debug_Verif_Exit 
    219         IGCM_sys_QsubPost create_ts 
     410        IGCM_sys_QsubPost rebuild 
    220411EOF 
    221412    fi 
    222413 
    223     #=============  SEASONAL POST-TREATMENT ============# 
    224     if [ ${SeasonalFrequency} = true ] ; then 
    225         # 
    226         IGCM_debug_Print 2 "SEASONNAL POST-TREATMENT :" 
    227         echo 
    228         # 
    229         typeset listVarEnv 
    230         listVarEnv="MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF" 
    231         IGCM_sys_RshPost <<-EOF 
    232         export MODIPSL=${MODIPSL} 
    233         export SUBMIT_DIR=${SUBMIT_DIR} 
    234         export libIGCM_SX=${libIGCM} 
    235         export libIGCM=${libIGCM_POST} 
    236         export SUBMIT_DIR=${SUBMIT_DIR} 
    237         export POST_DIR=${POST_DIR} 
    238         export DateBegin=${DateBegin} 
    239         export PeriodDateEnd=${PeriodDateEnd} 
    240         export StandAlone=false 
    241         export RESOL_ATM=${RESOL_ATM} 
    242         export RESOL_OCE=${RESOL_OCE} 
    243         export RESOL_ICE=${RESOL_ICE} 
    244         export RESOL_SRF=${RESOL_SRF} 
    245         export listVarEnv=${listVarEnv} 
    246         . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh 
    247         . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh 
    248         IGCM_sys_MkdirWork ${POST_DIR} 
    249         IGCM_debug_Verif_Exit 
    250         IGCM_sys_QsubPost create_se 
    251 EOF 
    252     fi 
    253  
    254414    IGCM_debug_PopStack "IGCM_post_Submit" 
    255415} 
    256  
    257  
  • /trunk/libIGCM/libIGCM_sys/libIGCM_sys_platine.ksh

    r20 r30  
    135135if [ $LSB_QUEUE == post ] ; then 
    136136    typeset -r RUN_DIR_PATH=${SCRATCHDIR}/tmp$$ 
     137    if [ ! -d ${RUN_DIR_PATH} ]; then  
     138        \mkdir -p ${RUN_DIR_PATH} 
     139        if [ $? -gt 0 ] ; then 
     140            echo "Error in creation of "${RUN_DIR_PATH} 
     141        fi 
     142    fi 
    137143fi 
    138144 
    139145#==================================================== 
    140146#- HOST_MPIRUN_COMMAND 
    141 typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="srun"} 
     147typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time srun"} 
    142148 
    143149#D-#================================================== 
     
    12521258        echo "IGCM_sys_rebuild :" $@ 
    12531259    fi 
    1254     /home/cont003/p86ipsl/bin/platine/rebuild -f -o $@ 
     1260    /home/cont003/p86ipsl/IA64/bin/rebuild -f -o $@ 
    12551261    if [ $? -gt 0 ] ; then 
    12561262       echo "IGCM_sys_rebuild : erreur ${@}." 
  • /trunk/libIGCM/run.card.init

    r20 r30  
    2020[PostProcessing] 
    2121# postraitements state == .date 
    22 PostState = Start 
    2322 
    24 MonitoringRunning=n 
    25 MonitoringCompleted= 
     23#RebuildRunning=y/n 
     24#RebuildToComplete=number of dir to rebuild 
     25#RebuildDateID=PeriodDateEnd correspondant au dernier flag de RebuildFrequency=true 
    2626 
    2727TimeSeriesRunning=n 
     
    2929 
    3030SeasonalRunning=n 
    31 SeasonalCompleted= 
    3231 
    3332# machine time == .log 
Note: See TracChangeset for help on using the changeset viewer.