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

MM: All frequencies in post-treatement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 ) ) 
Note: See TracChangeset for help on using the changeset viewer.