Changeset 522


Ignore:
Timestamp:
12/02/11 19:17:07 (13 years ago)
Author:
sdipsl
Message:

Source driver from ${SUBMIT_DIR}/DRIVER/ if it exists ; otherwise back to default
Add yyyymm_m1, yyyymm_p1, month_m1, month_p1 and day as available global variables. Needed by LMDZ-REPROBUS
Add IGCM_date_GetYearMonthDay function
JG

Location:
trunk/libIGCM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh

    r480 r522  
    5252        # Debug Print : 
    5353        IGCM_debug_Print 2 "Initialize following component library" 
    54         IGCM_debug_Print 2 ${SUBMIT_DIR}/COMP/${compname}.driver 
    55         IGCM_debug_Print 3 "With tag : ${comptagname}" 
    56         # Source component library 
    57         . ${SUBMIT_DIR}/COMP/${compname}.driver 
     54 
     55        # Source drivers in directory DRIVER if it exist 
     56        # else source them from directory COMP 
     57        if [ -d ${SUBMIT_DIR}/DRIVER ] ; then 
     58            IGCM_debug_Print 2 ${SUBMIT_DIR}/DRIVER/${compname}.driver 
     59            # Source component library 
     60            . ${SUBMIT_DIR}/DRIVER/${compname}.driver 
     61        else 
     62            IGCM_debug_Print 2 ${SUBMIT_DIR}/COMP/${compname}.driver 
     63            # Source component library 
     64            . ${SUBMIT_DIR}/COMP/${compname}.driver 
     65        fi 
     66        IGCM_debug_Print 3 "With tag : ${comptagname}" 
     67         
    5868 
    5969        # Debug Print 
  • trunk/libIGCM/libIGCM_config/libIGCM_config.ksh

    r473 r522  
    396396        #================================================# 
    397397 
    398         IGCM_date_GetYearMonth $DateBegin year month 
    399         year_m1=$(( year - 1 )) 
    400         year_p1=$(( year + 1 ))  
     398        IGCM_date_GetYearMonthDay $DateBegin year month day 
    401399        IGCM_config_Analyse_PeriodLength 
    402400 
     
    477475        fi 
    478476 
    479         IGCM_date_GetYearMonth $PeriodDateBegin year month 
    480         year_m1=$(( year - 1 )) 
    481         year_p1=$(( year + 1 ))  
     477        IGCM_date_GetYearMonthDay $PeriodDateBegin year month day 
    482478        IGCM_config_Analyse_PeriodLength 
    483479 
     
    486482    fi     
    487483    OldPrefix=${config_UserChoices_JobName}_${PeriodDateEnd} 
    488    
     484 
     485    # BEGIN: SHOULD GO IN A FUNCTION FROM libIGCM_date.ksh 
     486    # Compute year_m1 and year_p1 (year minus 1Y and year plus 1Y) 
     487    year_m1=$(( year - 1 )) 
     488    year_p1=$(( year + 1 ))      
     489    # Compute month_m1 (month minus 1M) 
     490    # Compute yyyymm_m1 (yyyymm minus 1M) 
     491    month_m1=$(( month - 1 )) 
     492    if [ ${month_m1} = 0 ]; then 
     493        month_m1=12 
     494        yyyymm_m1=${year_m1}12 
     495    elif [ ${month_m1} -le 9 ]; then 
     496        month_m1=0${month_m1} 
     497        yyyymm_m1=${year}${month_m1} 
     498    else 
     499        yyyymm_m1=${year}${month_m1} 
     500    fi 
     501    # Compute month_p1 (month plus 1M) 
     502    # Compute yyyymm_p1 (yyyymm plus 1M) 
     503    month_p1=$(( month + 1 )) 
     504    if [ ${month_p1} = 13 ]; then 
     505        month_p1=01 
     506        yyyymm_p1=${year_p1}01 
     507    elif [ ${month_p1} -le 9 ]; then 
     508        month_p1=0${month_p1} 
     509        yyyymm_p1=${year}${month_p1} 
     510    else 
     511        yyyymm_p1=${year}${month_p1} 
     512    fi 
     513    #IGCM_debug_Print 1 "jg 1 month_m1 = ${month_m1} month_p1 = ${month_p1} " 
     514    #IGCM_debug_Print 1 "jg 1 calculate yyyymm_m1 = ${yyyymm_m1} " 
     515    #IGCM_debug_Print 1 "jg 1 calculate yyyymm_p1 = ${yyyymm_p1} " 
     516 
     517    # END: SHOULD GO IN A FUNCTION FROM libIGCM_date.ksh 
     518 
    489519    #===================================================================# 
    490520    # Prepare variables available for ${COMP}.card and ${COMP}.driver   # 
     
    735765 
    736766    PeriodDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} 1 ) 
    737     IGCM_date_GetYearMonth $PeriodDateBegin year month 
     767    IGCM_date_GetYearMonthDay $PeriodDateBegin year month day 
    738768    year_m1=$(( year - 1 )) 
    739769    year_p1=$(( year + 1 )) 
  • trunk/libIGCM/libIGCM_date/libIGCM_date.ksh

    r435 r522  
    159159 
    160160    IGCM_debug_PopStack "IGCM_date_GetYearMonth" 
     161} 
     162 
     163#================================================================== 
     164function IGCM_date_GetYearMonthDay 
     165{ 
     166    IGCM_debug_PushStack "IGCM_date_GetYearMonthDay" $@ 
     167 
     168    # from a yyyymmdd date format return  
     169    # a yyyy year, mm month and dd day 
     170    # usage IGCM_date_GetYearMonthDay yyyymmdd year_var month_var day_var 
     171 
     172    # if there is no argument on the command line,  
     173    # then assume that a yyyymmdd formated date is being  
     174    # piped in 
     175    typeset dt 
     176    if [ $# = 0 ] 
     177        then 
     178        read dt 
     179    else 
     180        dt=$1 
     181    fi 
     182 
     183    # break the yyyymmdd into separate parts for year, month and day 
     184    eval $2=$( echo $( IGCM_date_GregorianDigit ${dt} ) \ 
     185        | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1/" ) 
     186    eval $3=$( echo $( IGCM_date_GregorianDigit ${dt} ) \ 
     187        | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\2/" ) 
     188    eval $4=$( echo $( IGCM_date_GregorianDigit ${dt} ) \ 
     189        | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\3/" ) 
     190 
     191    IGCM_debug_PopStack "IGCM_date_GetYearMonthDay" 
    161192} 
    162193 
Note: See TracChangeset for help on using the changeset viewer.