Ignore:
Timestamp:
12/02/11 19:17:07 (12 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.