Changeset 693 for IOIPSL/trunk


Ignore:
Timestamp:
07/29/09 17:49:31 (15 years ago)
Author:
bellier
Message:

Added an integer function "ioget_year_len(year)" returning the
true length of a year in days according to the used calendar.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • IOIPSL/trunk/src/calendar.f90

    r428 r693  
    4444  PRIVATE 
    4545  PUBLIC :: ymds2ju,ju2ymds,tlen2itau,isittime,ioconf_calendar, & 
    46  &          ioget_calendar,ioget_mon_len,itau2date,ioget_timestamp, & 
    47  &          ioconf_startdate,itau2ymds,time_diff,time_add, & 
    48  &          lock_calendar 
     46 &          ioget_calendar,ioget_mon_len,ioget_year_len,itau2date, & 
     47 &          ioget_timestamp,ioconf_startdate,itau2ymds, & 
     48 &          time_diff,time_add,lock_calendar 
    4949!- 
    5050  INTERFACE ioget_calendar 
     
    909909!=== 
    910910!- 
     911INTEGER FUNCTION ioget_year_len (year) 
     912!!-------------------------------------------------------------------- 
     913!! The "ioget_year_len" function returns 
     914!! the number of days in "year", in the current calendar. 
     915!! 
     916!! INTEGER FUNCTION ioget_year_len (year) 
     917!! 
     918!! INPUT 
     919!! 
     920!! (I) year  : year 
     921!! 
     922!! OUTPUT 
     923!! 
     924!! (I) ioget_year_len : number of days in the year 
     925!!-------------------------------------------------------------------- 
     926  IMPLICIT NONE 
     927!- 
     928  INTEGER,INTENT(IN) :: year 
     929!- 
     930  INTEGER :: yl 
     931!--------------------------------------------------------------------- 
     932  SELECT CASE(TRIM(calendar_used)) 
     933  CASE('gregorian') 
     934    yl = 365 
     935    IF (    ((MOD(year,4) == 0).AND.(MOD(year,100) /= 0)) & 
     936        .OR.(MOD(year,400) == 0) ) THEN 
     937      yl = yl+1 
     938    ENDIF 
     939  CASE('julian') 
     940    yl = 365 
     941    IF (MOD(year,4) == 0) THEN 
     942      yl = yl+1 
     943    ENDIF 
     944  CASE DEFAULT 
     945    yl = NINT(one_year) 
     946  END SELECT 
     947  ioget_year_len = yl 
     948!-------------------------- 
     949END FUNCTION ioget_year_len 
     950!- 
     951!=== 
     952!- 
    911953SUBROUTINE ioget_timestamp (string) 
    912954!--------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.