Changeset 10 for branches


Ignore:
Timestamp:
05/30/08 10:10:34 (16 years ago)
Author:
mmaipsl
Message:

MM: All frequencies in post-treatement.

Location:
branches/AllPostFred
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/AllPostFred/AA_create_se

    r5 r10  
    139139DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )} 
    140140# 
    141 PeriodDateEnd=${PeriodDateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )} 
     141DateEnd=${DateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )} 
    142142# 
    143143freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" ) 
    144144# 
    145 an_fin=$( expr $( IGCM_date_ConvertGregorianDateToJulian $PeriodDateEnd ) / 1000 ) 
     145an_fin=$( expr $( IGCM_date_ConvertGregorianDateToJulian $DateEnd ) / 1000 ) 
    146146an_deb=$( IGCM_date_YearDigit $(( an_fin - freq + 1 )) ) 
    147147an_fin=$( IGCM_date_YearDigit ${an_fin} ) 
     
    227227        FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) 
    228228        case ${FlagDir} in 
    229             1Y)    FreqDir=YE  ;; 
    230             1M)    FreqDir=MO  ;; 
    231             5D|1D) FreqDir=DA  ;; 
     229            *Y)    FreqDir=YE  ;; 
     230            *M)    FreqDir=MO  ;; 
     231            5D|1D|*D) FreqDir=DA  ;; 
    232232            HF)    FreqDir=HF  ;; 
    233233            INS)   FreqDir=INS ;; 
     
    286286          IGCM_debug_Verif_Exit_Post 
    287287          ;; 
     288        # For a Multi-Year simulation : 
     289        *Y|*y) 
     290          PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 
     291          (( an = an_deb )) 
     292          # Initialize array 
     293          set -A liste_file_se 
     294          set -A liste_file_se_tmp 
     295          while [ ${an} -le ${an_fin} ] ; do 
     296              moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) 
     297              # 
     298              an4=$(printf "%04i\n" ${an} ) 
     299              # 
     300              (( diy = 0 )) 
     301              (( ian = 0 )) 
     302              while [ ${ian} -lt ${PeriodLengthInYears} ] ; do 
     303                  # 
     304                  ian4=$(printf "%04i\n" $(( an + ian )) ) 
     305                  (( diy = diy + $( IGCM_date_DaysInYear $ian4 ) )) 
     306                  (( ian = ian + 1 )) 
     307              done 
     308              afin=$( IGCM_date_AddDaysToGregorianDate ${an4}0101 $(( diy - 1 )) ) 
     309              date=${an4}0101_${afin} 
     310              set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 
     311              set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc 
     312              (( an = an + PeriodLengthInYears )) 
     313          done 
     314          # 
     315          IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} 
     316          eval ExitFlag=false 
     317          IGCM_debug_Verif_Exit_Post 
     318           
     319          # Apply IGCM_Patch if needed 
     320          if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then 
     321              for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do 
     322                  for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do 
     323                      IGCM_${Patch} ${file_t} 
     324                  done 
     325              done 
     326          fi 
     327 
     328          for mois in  01 02 03 04 05 06 07 08 09 10 11 12 ; do 
     329          # 
     330              (( nb = ${mois} - 1 )) 
     331          # 
     332              OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc 
     333              IGCM_sys_ncra -O -d time_counter,${nb},,12 ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} 
     334          done 
     335          IGCM_sys_Rm ${liste_file_se_tmp[*]} 
     336          eval ExitFlag=false 
     337          IGCM_debug_Verif_Exit_Post 
     338          ;; 
    288339        # For Monthly simulation : 
    289340        1M|1m) 
     
    322373              fi 
    323374               
    324               IGCM_sys_ncra -O ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} 
    325               IGCM_sys_Rm ${liste_file_se_tmp[*]} 
    326               eval ExitFlag=false 
     375              IGCM_sys_ncra -O ${liste_file_se_tmp} ${OUT_SE[${nb}]} 
     376              MENAGE_LOCAL ${liste_file_se_tmp} 
     377              # 
    327378              IGCM_debug_Verif_Exit_Post 
    328379          done 
     380          ;; 
     381 
     382        # For Multi-Monthly simulation : 
     383        *M|*m) 
     384          PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 
     385          # Must be a divisor of 12 !!! e.g. 2,3,4 and 6 only 
     386          if ( [ $PeriodLengthInMonths -ne 2 ] && \ 
     387               [ $PeriodLengthInMonths -ne 3 ] && \ 
     388               [ $PeriodLengthInMonths -ne 4 ] && \ 
     389               [ $PeriodLengthInMonths -ne 6 ] ) ; then 
     390              echo "create_se.job can't work with this monthly Period : ",$PeriodLengthInMonths,"M !!" 
     391              echo "It must be a divisor of twelve." 
     392              echo "We will stop there." 
     393              IGCM_debug_Verif_Exit_Post 
     394          else 
     395              # 
     396              (( NbSet = 12 / PeriodLengthInMonths )) 
     397              (( moisd = 01 )) 
     398              (( Mset = 1 ))  
     399              while [ ${Mset} -le ${NbSet} ] ; do 
     400                  moisf=$(printf "%02i\n" $(( moisd + PeriodLengthInMonths - 1 )) ) 
     401                  moisd=$(printf "%02i\n" ${moisd} ) 
     402                  # 
     403                  (( an = an_deb )) 
     404                  # Initialize array 
     405                  set -A liste_file_se 
     406                  set -A liste_file_se_tmp 
     407                  while [ ${an} -le ${an_fin} ] ; do 
     408                      moisL=$( IGCM_date_DaysInMonth ${an} ${moisf} ) 
     409                      # 
     410                      an4=$(printf "%04i\n" ${an} ) 
     411                      # 
     412                      date=${an4}${moisd}01_${an4}${moisf}${moisL} 
     413                      set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 
     414                      set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc 
     415                      (( an = an + 1 )) 
     416                  done 
     417                  # 
     418                  IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} 
     419                  eval ExitFlag=false 
     420                  IGCM_debug_Verif_Exit_Post 
     421               
     422                  # Apply IGCM_Patch if needed 
     423                  if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then 
     424                      for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do 
     425                          for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do 
     426                              IGCM_${Patch} ${file_t} 
     427                          done 
     428                      done 
     429                  fi 
     430         
     431                  (( imois = moisd )) 
     432                  (( i = 0 )) 
     433                  while [ ${imois} -le ${moisf} ] ; do 
     434                      # 
     435                      (( nb = ${imois} - 1 )) 
     436                      # 
     437                      OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${imois}_${an_deb}_${an_fin}_${file}.nc 
     438                      IGCM_sys_ncra -O -d time_counter,${i},,${PeriodLengthInMonths} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} 
     439                      (( imois = imois + 1 )) 
     440                      (( i = i + 1 )) 
     441                  done 
     442 
     443                  IGCM_sys_Rm ${liste_file_se_tmp[*]} 
     444                  eval ExitFlag=false 
     445                  IGCM_debug_Verif_Exit_Post 
     446                  moisf=$(printf "%02i\n" $(( moisf + 1 )) ) 
     447 
     448                  (( Mset = Mset + 1 )) 
     449              done 
     450          fi 
    329451          ;; 
    330452        *D|*d) 
  • branches/AllPostFred/AA_create_ts

    r5 r10  
    3232#-Q- default ## DEFAULT HOST ## 
    3333#-Q- default ################## 
     34#-Q- default date 
    3435 
    3536#set -vx 
     
    240241        FlagDir=$( echo ${FILE} | awk -F "_" '{print $1}' ) 
    241242        case ${FlagDir} in 
    242             1Y)    TS_Dir=TS_YE  ;; 
    243             1M)    TS_Dir=TS_MO  ;; 
    244             5D|1D) TS_Dir=TS_DA  ;; 
     243            *Y)    TS_Dir=TS_YE  ;; 
     244            *M)    TS_Dir=TS_MO  ;; 
     245            5D|1D|*D) TS_Dir=TS_DA  ;; 
    245246            HF)    TS_Dir=TS_HF  ;; 
    246247            INS)   TS_Dir=TS_INS ;; 
     
    296297    IGCM_debug_PushStack "create_ts_next_date" $@ 
    297298    typeset year month Length 
    298     case ${1} in 
     299    case ${config_UserChoices_PeriodLength} in 
    299300        1Y|1y) 
    300             IGCM_date_GetYearMonth ${2} year month 
     301            IGCM_date_GetYearMonth ${1} year month 
    301302            Length=$( IGCM_date_DaysInYear $(( year + 1 )) ) ;; 
     303        *Y|*y)  
     304            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 
     305            IGCM_date_GetYearMonth ${1} year month 
     306            (( Length=0 )) 
     307            (( i=0 )) 
     308            until [ $i -ge $PeriodLengthInYears ] ; do 
     309                (( Length = Length + $( IGCM_date_DaysInYear $(( year + PeriodLengthInYears + i )) ) ))  
     310                (( i=i+1 )) 
     311            done 
     312            ;; 
    302313        1M|1m) 
    303             IGCM_date_GetYearMonth ${2} year month 
     314            IGCM_date_GetYearMonth ${1} year month 
    304315            if [ $month -lt 12 ] ; then 
    305316                Length=$( IGCM_date_DaysInMonth $year $(( month + 1 )) ) 
     
    307318                Length=$( IGCM_date_DaysInMonth $(( year + 1 )) 1 ) 
    308319            fi ;; 
     320        *M|*m)  
     321            PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 
     322            IGCM_date_GetYearMonth ${1} year month 
     323            (( year0=year )) 
     324            if [ $(( month + 1 )) -lt 13 ] ; then 
     325                month0=$(( month + 1 )) 
     326            else 
     327                month0=$(( month + 1 - 12 )) 
     328                (( year = year0 + 1 )) 
     329            fi 
     330            (( Length=0 )) 
     331            (( i=0 )) 
     332            until [ $i -ge $PeriodLengthInMonths ] ; do 
     333                if [ $(( month0 + i )) -lt 13 ] ; then 
     334                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i )) ) )) 
     335                else 
     336                    (( year = year0 + 1 )) 
     337                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i - 12 )) ) )) 
     338                fi 
     339                (( i=i+1 )) 
     340            done 
     341            ;; 
    309342        *D|*d) 
    310             Length=$( echo ${1} | sed -e "s/[dD]//" ) ;; 
     343            Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;; 
    311344        *) 
    312             IGCM_debug_Exit "create_ts " ${1} " invalid PeriodLength : choose in 1Y, 1M, 5D, 1D." 
     345            IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in 1Y, *M, *D." 
    313346            IGCM_debug_Verif_Exit_Post ;; 
    314347    esac 
     
    322355    IGCM_debug_PushStack "create_ts_begin_date" $@ 
    323356    typeset year month Length 
    324     case ${1} in 
     357    case ${config_UserChoices_PeriodLength} in 
    325358        1Y|1y) 
    326             IGCM_date_GetYearMonth ${2} year month 
     359            IGCM_date_GetYearMonth ${1} year month 
    327360            Length=$( IGCM_date_DaysInYear $year ) ;; 
     361        *Y|*y)  
     362            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 
     363            IGCM_date_GetYearMonth ${1} year month 
     364            if [ X${2} = Xend ] ; then 
     365                (( year = year - PeriodLengthInYears + 1)) 
     366            fi 
     367            (( Length=0 )) 
     368            (( i=0 )) 
     369            until [ $i -ge $PeriodLengthInYears ] ; do 
     370                (( Length = Length + $( IGCM_date_DaysInYear $(( year + i )) ) ))  
     371                (( i=i+1 )) 
     372            done 
     373            ;; 
    328374        1M|1m) 
    329             IGCM_date_GetYearMonth ${2} year month 
     375            IGCM_date_GetYearMonth ${1} year month 
    330376            Length=$( IGCM_date_DaysInMonth $year $month ) ;; 
     377        *M|*m)  
     378            PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 
     379            IGCM_date_GetYearMonth ${1} year month 
     380            if [ X${2} = Xend ] ; then 
     381                (( month = $month - $PeriodLengthInMonths + 1 )) 
     382            fi       
     383            (( year0=$year )) 
     384            if [ $month -le 0 ] ; then 
     385                (( month = $month + 12 )) 
     386                year=$( printf "%04i\n" $(( year - 1 )) ) 
     387            fi 
     388            month=$( printf "%02i\n" ${month} ) 
     389            (( Length=0 )) 
     390            (( i=0 )) 
     391            until [ $i -ge $PeriodLengthInMonths ] ; do 
     392                if [ $(( month + i )) -lt 13 ] ; then 
     393                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) 
     394                else 
     395                    (( year = year0 + 1 )) 
     396                    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) 
     397                fi 
     398                (( i=i+1 )) 
     399            done 
     400            ;; 
    331401        *D|*d) 
    332             Length=$( echo ${1} | sed -e "s/[dD]//" ) ;; 
     402            Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;; 
    333403        *) 
    334             IGCM_debug_Exit "create_ts " ${1} " invalid PeriodLength : choose in 1Y, 1M, 5D, 1D." 
     404            IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in 1Y, *M, *D." 
    335405            IGCM_debug_Verif_Exit_Post ;; 
    336406    esac 
     
    374444    # First Time Series Submission 
    375445    FIRST_PASS=TRUE 
    376     Length=$( create_ts_begin_date ${config_UserChoices_PeriodLength} ${DateBegin} ) 
     446    Length=$( create_ts_begin_date ${DateBegin} begin) 
    377447    DATE_FIN_JOB_B=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( Length - 1 )) ) 
    378448else 
     
    401471            FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) 
    402472            case ${FlagDir} in 
    403                 1Y)    TS_Dir=TS_YE  ;; 
    404                 1M)    TS_Dir=TS_MO  ;; 
    405                 5D|1D) TS_Dir=TS_DA  ;; 
     473                *Y)    TS_Dir=TS_YE  ;; 
     474                *M)    TS_Dir=TS_MO  ;; 
     475                5D|1D|*D) TS_Dir=TS_DA  ;; 
    406476                HF)    TS_Dir=TS_HF  ;; 
    407477                INS)   TS_Dir=TS_INS ;; 
     
    437507    while [ ${DATE_COUNT} -lt ${PeriodDateEnd} ] ; do 
    438508        (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) 
    439         Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_COUNT} ) 
     509        Length=$( create_ts_next_date ${DATE_COUNT} ) 
    440510        DATE_COUNT=$( IGCM_date_AddDaysToGregorianDate ${DATE_COUNT} ${Length} ) 
    441511    done 
     
    468538            DATE_COURANTE=${DATE_FIN_JOB_B_LOOP} 
    469539        else 
    470             Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_FIN_JOB_B_LOOP} ) 
     540            Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} ) 
    471541            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} ) 
    472542        fi 
     
    485555 
    486556        if [ ! ${FIRST_PASS} = TRUE ] && [ ${CURRENT_LOOP} -eq 1 ] ; then 
    487             Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_FIN_JOB_B_LOOP} ) 
     557            Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} ) 
    488558            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} ) 
    489559        elif [ -z "${DATE_COURANTE}" ] ; then 
    490560            DATE_COURANTE=${DATE_FIN_JOB_B} 
    491561        else 
    492             Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_FIN} ) 
     562            Length=$( create_ts_next_date ${DATE_FIN} ) 
    493563            DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} ) 
    494564        fi 
     
    500570        while [ ${COMPTEUR} -lt ${NBRE_FILE_LOOP} ] ; do 
    501571            # 
    502             Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_LOOP} ) 
     572            Length=$( create_ts_next_date ${DATE_LOOP} ) 
    503573            DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length} ) 
    504574            (( TotLength = TotLength + Length )) 
     
    517587        [ ${NBRE_FILE_LOOP} -eq 0 ] && NBRE_FILE_LOOP=${UNIX_MAX_LIMIT} 
    518588 
    519         Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_FIN} ) 
     589        Length=$( create_ts_next_date ${DATE_FIN} ) 
    520590        DATE_COURANTE=$(IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} ) 
    521591        DATE_FIN=${PeriodDateEnd} 
     
    545615            FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) 
    546616            case ${FlagDir} in 
    547                 1Y)    TS_Dir=TS_YE  ; FreqDir=AN  ;; 
    548                 1M)    TS_Dir=TS_MO  ; FreqDir=MO  ;; 
     617                *Y)    TS_Dir=TS_YE  ; FreqDir=YE  ;; 
     618                *M)    TS_Dir=TS_MO  ; FreqDir=MO  ;; 
    549619                *D)    TS_Dir=TS_DA  ; FreqDir=DA  ;; 
    550620                HF)    TS_Dir=TS_HF  ; FreqDir=HF  ;; 
     
    566636            while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] ; do 
    567637                # 
    568                 Length1=$( create_ts_begin_date ${config_UserChoices_PeriodLength} ${DATE_LOOP} ) 
     638                Length1=$( create_ts_begin_date ${DATE_LOOP} end) 
    569639                DATE_TAB=$(  IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} $(( 1 - Length1 )) )_${DATE_LOOP} 
    570640 
    571                 Length2=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_LOOP} ) 
     641                Length2=$( create_ts_next_date ${DATE_LOOP} end) 
    572642                DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length2} ) 
    573643 
     
    595665            # WE CAN CONCATENATE FILES AT THIS POINT 
    596666            [ "${FLAG_B}" = "TRUE" ] && DATE_BUILD_B=${DateBegin}_${DATE_FIN_JOB_B_LOOP_PREC} 
    597             Length=$( create_ts_begin_date ${config_UserChoices_PeriodLength} ${DATE_COURANTE} ) 
     667            Length=$( create_ts_begin_date ${DATE_COURANTE} end) 
    598668            DATE_BUILD1=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} -$(( Length - 1 )) ) 
    599669            DATE_BUILD=${DATE_BUILD1}_${DATE_FIN} 
  • branches/AllPostFred/libIGCM_comp/libIGCM_comp.ksh

    r5 r10  
    8686        eval first_option=\${${compname}_UserChoices[0]} > /dev/null 2>&1 
    8787        if [ X${first_option} != X"Error:" ] ; then 
    88             eval IGCM_debug_Print 2 "${compname}_UserChoices_Options:" \${${compname}_UserChoices[*]} 
    8988            if [ X${card_UserChoices[0]} != X ] ; then 
    9089                unset card_UserChoices 
     
    9493            for option in ${card_UserChoices[*]} ; do 
    9594                IGCM_card_DefineVariableFromOption ${card} UserChoices ${option} 
    96                 eval IGCM_debug_Print 3 "${compname}_UserChoices_values: ${card_UserChoices[*]}" 
     95                eval IGCM_debug_Print 2 "${compname}_UserChoices_values: ${option} \${card_UserChoices_${option}}" 
    9796            done 
    9897        fi 
  • branches/AllPostFred/libIGCM_config/libIGCM_config.ksh

    r7 r10  
    197197            1Y|1y)  
    198198                (( PeriodLengthInDays = $( IGCM_date_DaysInYear $year ) )) ;; 
     199            *Y|*y)  
     200                PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 
     201                echo "Number of years for PeriodLength : " $PeriodLengthInYears 
     202                (( PeriodLengthInDays = 0 ))  
     203                (( i=0 )) 
     204                until [ $i -ge $PeriodLengthInYears ] ; do 
     205                    (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) 
     206                    (( i=i+1 )) 
     207                done 
     208                ;; 
    199209            1M|1m)  
    200210                (( PeriodLengthInDays = $( IGCM_date_DaysInMonth $year $month ) )) ;; 
     211            *M|*m)  
     212                PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 
     213                echo "Number of months for PeriodLength : " $PeriodLengthInMonths 
     214                typeset year1 
     215                (( year1=year )) 
     216                (( PeriodLengthInDays = 0 ))  
     217                (( i=0 )) 
     218                until [ $i -ge $PeriodLengthInMonths ] ; do 
     219                    if [ $(( month + i )) -lt 13 ] ; then 
     220                        (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) ))  
     221                    else 
     222                        (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) ))  
     223                    fi 
     224                    (( i=i+1 )) 
     225                done 
     226                ;; 
    201227            5D|5d)  
    202228                (( PeriodLengthInDays = 5 )) ;; 
    203229            1D|1d)  
    204230                (( PeriodLengthInDays = 1 )) ;; 
     231            *D|*d)  
     232                PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | awk -F '[dD]' '{print $1}' ) ;; 
    205233            *)  
    206                 IGCM_debug_Exit "IGCM_config_PeriodStart " ${config_UserChoices_PeriodLength} " invalid period length : choose in 1Y, 1M, 5D, 1D." 
     234                IGCM_debug_Exit "IGCM_config_PeriodStart " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D, 5D, 1D."  
    207235                IGCM_debug_Verif_Exit ;; 
    208236        esac 
     
    273301            1Y|1y)  
    274302                (( PeriodLengthInDays = $( IGCM_date_DaysInYear $year ) )) ;; 
     303            *Y|*y)  
     304                PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 
     305                echo "Number of years for PeriodLength : " $PeriodLengthInYears 
     306                (( PeriodLengthInDays = 0 ))  
     307                (( i=0 )) 
     308                until [ $i -ge $PeriodLengthInYears ] ; do 
     309                    (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) 
     310                    (( i=i+1 )) 
     311                done 
     312                ;; 
    275313            1M|1m)  
    276314                (( PeriodLengthInDays = $( IGCM_date_DaysInMonth $year $month ) )) ;; 
     315            *M|*m)  
     316                PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 
     317                echo "Number of months for PeriodLength : " $PeriodLengthInMonths 
     318                typeset year1 
     319                (( year1=year )) 
     320                (( PeriodLengthInDays = 0 ))  
     321                (( i=0 )) 
     322                until [ $i -ge $PeriodLengthInMonths ] ; do 
     323                    if [ $(( month + i )) -lt 13 ] ; then 
     324                        (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) ))  
     325                    else 
     326                        (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) ))  
     327                    fi 
     328                    (( i=i+1 )) 
     329                done 
     330                ;; 
    277331            5D|5d)  
    278332                (( PeriodLengthInDays=5 )) ;; 
    279333            1D|1d)  
    280334                (( PeriodLengthInDays=1 )) ;; 
     335            *D|*d)  
     336                PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | awk -F '[dD]' '{print $1}' ) ;; 
    281337            *)  
    282                 IGCM_debug_Exit "IGCM_config_PeriodStart " ${config_UserChoices_PeriodLength} " invalid period length : choose in 1Y, 1M, 5D, 1D." 
     338                IGCM_debug_Exit "IGCM_config_PeriodStart " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D, 5D, 1D." 
    283339                IGCM_debug_Verif_Exit ;; 
    284340        esac 
     
    458514    case ${config_UserChoices_PeriodLength} in 
    459515        1Y|1y) PeriodLengthInDays=$( expr $( IGCM_date_DaysInYear $year ) ) ;; 
     516        *Y|*y)  
     517            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 
     518            echo "Number of years for PeriodLength : " $PeriodLengthInYears 
     519            (( PeriodLengthInDays = 0 ))  
     520            (( i=0 )) 
     521            until [ $i -ge $PeriodLengthInYears ] ; do 
     522                (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) 
     523                (( i=i+1 )) 
     524            done 
     525            ;; 
    460526        1M|1m) PeriodLengthInDays=$( expr $( IGCM_date_DaysInMonth $year $month ) ) ;; 
     527        *M|*m)  
     528            PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 
     529            echo "Number of months for PeriodLength : " $PeriodLengthInMonths 
     530            typeset year1 
     531            (( year1=year )) 
     532            (( PeriodLengthInDays = 0 ))  
     533            (( i=0 )) 
     534            until [ $i -ge $PeriodLengthInMonths ] ; do 
     535                if [ $(( month + i )) -lt 13 ] ; then 
     536                    (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) ))  
     537                    else 
     538                    (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) ))  
     539                fi 
     540                (( i=i+1 )) 
     541            done 
     542            ;; 
    461543        5D|5d) PeriodLengthInDays=$( expr 5 ) ;; 
    462544        1D|1d) PeriodLengthInDays=$( expr 1 ) ;; 
     545        *D|*d)  
     546            PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | awk -F '[dD]' '{print $1}' ) ;; 
    463547    esac 
    464548    PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateBegin} $( expr ${PeriodLengthInDays} - 1 ) ) 
  • branches/AllPostFred/libIGCM_post/libIGCM_post.ksh

    r5 r10  
    8686                      PeriodYear=$( echo ${config_Post_post_freq} | sed -e "s/[yY]//" ) 
    8787                      case ${config_UserChoices_PeriodLength} in 
    88                         1Y|1y) 
     88                        *Y|*y) 
     89                          echo "POST : Y->Y = " ${CumulPeriod} ',' ${PeriodYear} "," $( expr ${CumulPeriod} % ${PeriodYear}  ) 
    8990                          if [ $( expr ${CumulPeriod} % ${PeriodYear}  ) -eq 0 ] ;  then 
    9091                             eval ${flag_post}_${compname}_${post_freq}=true 
     
    9495                        1M|1m) 
    9596                          if [ $( expr ${CumulPeriod} % $( expr ${PeriodYear} \* 12 ) ) -eq 0 ] ; then 
     97                             eval ${flag_post}_${compname}_${post_freq}=true 
     98                             eval ${post_freq}=true 
     99                             POST=true 
     100                          fi ;; 
     101                        *M|*m) 
     102                          PeriodMonths=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" ) 
     103                          if [ $( expr $(( ${CumulPeriod} * ${PeriodMonths} )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then 
    96104                             eval ${flag_post}_${compname}_${post_freq}=true 
    97105                             eval ${post_freq}=true 
     
    126134                    1M|1m) 
    127135                      case ${config_UserChoices_PeriodLength} in 
    128                         1Y|1y) 
     136                        *Y|*y) 
    129137                          IGCM_debug_Print 3 "Frequency not allowed for TimeSeriesFrequency in ${flag_post}" ;; 
    130                         1M|1m) 
     138                        *M|*m) 
    131139                          eval ${flag_post}_${compname}_${post_freq}=true 
    132140                          eval ${post_freq}=true 
     
    145153                      esac 
    146154                        ;; 
     155                    *M|*m) 
     156                      case ${config_UserChoices_PeriodLength} in 
     157                        *Y|*y) 
     158                          IGCM_debug_Print 3 "Frequency not allowed for TimeSeriesFrequency in ${flag_post}" ;; 
     159                        *M|*m) 
     160                          eval ${flag_post}_${compname}_${post_freq}=true 
     161                          eval ${post_freq}=true 
     162                          POST=true;; 
     163                      esac 
     164                      ;; 
    147165                    NONE|none) 
    148166                      ;; 
Note: See TracChangeset for help on using the changeset viewer.