Changeset 435


Ignore:
Timestamp:
04/06/11 16:16:13 (13 years ago)
Author:
mmaipsl
Message:

Add switches to accept all synonyms of calendar names (respecfull with CF Convention)

File:
1 edited

Legend:

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

    r373 r435  
    2323#D-  types of calendars are possible : 
    2424#D- 
    25 #D-  - gregorian (other name leap) : 
     25#D-  - leap|gregorian|standard (other name leap) : 
    2626#D-      The normal calendar. The time origin for the 
    2727#D-      julian day in this case is 24 Nov -4713. 
    28 #D-  - noleap : 
     28#D-  - noleap|365_day : 
    2929#D-      A 365 day year without leap years. 
    30 #D-  - all_leap : 
     30#D-  - all_leap|366_day : 
    3131#D-      A 366 day year with only leap years. 
    32 #D-  - 360d : 
     32#D-  - 360d|360_day : 
    3333#D-      Year of 360 days with month of equal length. 
    3434 
     
    176176    # What is the calendar : 
    177177    case ${config_UserChoices_CalendarType} in 
    178         360d) 
     178        360d|360_day) 
    179179            if [ X$2 = X ] ; then 
    180180                echo 360 
     
    184184#       IGCM_debug_PopStack "IGCM_date_DaysInYear" 
    185185            return;; 
    186         noleap) 
     186        noleap|365_day) 
    187187            if [ X$2 = X ] ; then 
    188188                echo 365 
     
    193193#           IGCM_debug_PopStack "IGCM_date_DaysInYear" 
    194194            return;; 
    195         all_leap) 
     195        all_leap|366_day) 
    196196            if [ X$2 = X ] ; then 
    197197                echo 366 
     
    289289     
    290290    # What is the calendar : 
    291     if [ "${config_UserChoices_CalendarType}" = "360d" ] ; then 
     291    if ( [ "${config_UserChoices_CalendarType}" = "360d" ] || [ "${config_UserChoices_CalendarType}" = "360_day" ] ) ; then 
    292292        if [ X$3 = X ] ; then 
    293293            echo 30 
     
    637637    # Then add days in year until year2 matches year1 
    638638 
    639     if [ "${config_UserChoices_CalendarType}" = "360d" ] ; then 
    640         res=$(( ( ( $yyyy1 - $yyyy2 ) * 360 ) + $res )) 
    641     elif [ "${config_UserChoices_CalendarType}" = "noleap" ] ; then 
    642         res=$(( ( ( $yyyy1 - $yyyy2 ) * 365 ) + $res )) 
    643     elif [ "${config_UserChoices_CalendarType}" = "all_leap" ] ; then 
    644         res=$(( ( ( $yyyy1 - $yyyy2 ) * 366 ) + $res )) 
    645     elif ( [ "${config_UserChoices_CalendarType}" = "leap" ] || [ "${config_UserChoices_CalendarType}" = "gregorian" ] ) ; then 
    646         while [ $yyyy2 -lt $yyyy1 ] 
    647           do 
    648           IGCM_date_DaysInYear $yyyy2 diy 
    649           res=$(( $res + $diy )) 
    650           yyyy2=$(( $yyyy2 + 1 )) 
    651         done 
    652     fi 
     639    case ${config_UserChoices_CalendarType} in 
     640        360d|360_day)  
     641            res=$(( ( ( $yyyy1 - $yyyy2 ) * 360 ) + $res )) ;; 
     642        noleap|365_day) 
     643            res=$(( ( ( $yyyy1 - $yyyy2 ) * 365 ) + $res )) ;; 
     644        all_leap|366_day) 
     645            res=$(( ( ( $yyyy1 - $yyyy2 ) * 366 ) + $res )) ;; 
     646        leap|gregorian|standard) 
     647            while [ $yyyy2 -lt $yyyy1 ] 
     648            do 
     649                IGCM_date_DaysInYear $yyyy2 diy 
     650                res=$(( $res + $diy )) 
     651                yyyy2=$(( $yyyy2 + 1 )) 
     652            done 
     653            ;; 
     654    esac 
     655 
    653656 
    654657    # if argument 2 was larger than argument 1 then  
     
    747750    if   [ ${1} -lt  5000000 ]; then 
    748751        case ${config_UserChoices_CalendarType} in 
    749             360d)  
     752            360d|360_day)  
    750753                aux=-360;; 
    751             noleap) 
     754            noleap|365_day) 
    752755                aux=-365;; 
    753             all_leap)  
     756            all_leap|366_day)  
    754757                aux=-366;; 
    755             leap|gregorian) 
     758            leap|gregorian|standard) 
    756759                aux=-366;; 
    757760        esac 
     
    761764        # which is number of days since JC and 10000101 
    762765        case ${config_UserChoices_CalendarType} in 
    763             360d)  
     766            360d|360_day)  
    764767                aux=359640;; 
    765             noleap) 
     768            noleap|365_day) 
    766769                aux=364635;; 
    767             all_leap)  
     770            all_leap|366_day)  
    768771                aux=365634;; 
    769             leap|gregorian) 
     772            leap|gregorian|standard) 
    770773                aux=364877;; 
    771774        esac 
     
    775778        # which is number of days since JC and 19000101 
    776779        case ${config_UserChoices_CalendarType} in 
    777             360d)  
     780            360d|360_day)  
    778781                aux=683640;; 
    779             noleap) 
     782            noleap|365_day) 
    780783                aux=693135;; 
    781             all_leap)  
     784            all_leap|366_day)  
    782785                aux=695034;; 
    783             leap|gregorian) 
     786            leap|gregorian|standard) 
    784787                aux=693595;; 
    785788        esac 
Note: See TracChangeset for help on using the changeset viewer.