Ignore:
Timestamp:
02/10/15 14:23:02 (9 years ago)
Author:
rlacroix
Message:

Add a new user defined calendar type.

A new calendar type "user_defined" is now available. This allows the users to create a custom calendar that we can configured to be suitable for planets other than the Earth.

An user defined calendar is always defined by two mandatory attributes:

  • day_length: the duration of a day, in seconds
  • and either:
    • month_length: an array containing the duration of each month, in days (the number of elements in the array is the number of months in a year)
    • or year_length: the duration of a year, in seconds (in that case, the calendar does not have months).

If the calendar has months (i.e. month_length attribute is set) and only in that case, it is possible to define leap years in order to compensate for the duration of an astronomical year not being a multiple of the day length. The leap years are defined by two mandatory attributes:

  • leap_year_month: the month to which the extra day will be added in case of leap year, expressed as an integer number in the range [1, numberOfMonths]
  • and leap_year_drift: the fraction of a day representing the yearly drift between the calendar year and the astronomical year, expressed as a real number in the range [0, 1).

Optionally, one can define the leap_year_drift_offset attribute to set the original drift at the beginning of the time origin's year, again expressed as a real number in the range [0, 1). If leap_year_drift_offset + leap_year_drift is greater or equal to 1, then the first year will be a leap year.

For example, the following configuration creates a Gregorian-like calendar:

<calendar type="user_defined" start_date="2012-03-01 15:00:00" time_origin="2012-02-28 15:00:00 + 1d" day_length="86400" month_lengths="(1, 12) [31 28 31 30 31 30 31 31 30 31 30 31]" leap_year_month="2" leap_year_drift="0.25" leap_year_drift_offset="0.75" />

Note that dates attributes must be written differently in the configuration file when using an user defined calendar without months:

  • if the year length is greater than the day length, the input format is year-day hh:min:sec instead of year-month-day hh:min:sec
  • if the day length is greater or equal to the year length, the input format is year hh:min:sec.

In all cases, it is still possible to use the date + duration notation to build a date (with both the date and duration parts being optional).

The Fortran interface has been updated accordingly so that xios_define_calendar can accept the new attributes necessary to define custom calendars.

Location:
XIOS/trunk/src/interface
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/interface/c_attr/iccalendar_wrapper_attr.cpp

    r549 r550  
    1818  typedef xios::CCalendarWrapper*  calendar_wrapper_Ptr; 
    1919   
     20  void cxios_set_calendar_wrapper_day_length(calendar_wrapper_Ptr calendar_wrapper_hdl, int day_length) 
     21  { 
     22     CTimer::get("XIOS").resume(); 
     23    calendar_wrapper_hdl->day_length.setValue(day_length); 
     24     CTimer::get("XIOS").suspend(); 
     25  } 
     26   
     27  void cxios_get_calendar_wrapper_day_length(calendar_wrapper_Ptr calendar_wrapper_hdl, int* day_length) 
     28  { 
     29    *day_length = calendar_wrapper_hdl->day_length.getInheritedValue(); 
     30  } 
     31   
     32  bool cxios_is_defined_calendar_wrapper_day_length(calendar_wrapper_Ptr calendar_wrapper_hdl ) 
     33  { 
     34     CTimer::get("XIOS").resume(); 
     35    return calendar_wrapper_hdl->day_length.hasInheritedValue(); 
     36     CTimer::get("XIOS").suspend(); 
     37  } 
     38   
     39   
     40   
     41  void cxios_set_calendar_wrapper_leap_year_drift(calendar_wrapper_Ptr calendar_wrapper_hdl, double leap_year_drift) 
     42  { 
     43     CTimer::get("XIOS").resume(); 
     44    calendar_wrapper_hdl->leap_year_drift.setValue(leap_year_drift); 
     45     CTimer::get("XIOS").suspend(); 
     46  } 
     47   
     48  void cxios_get_calendar_wrapper_leap_year_drift(calendar_wrapper_Ptr calendar_wrapper_hdl, double* leap_year_drift) 
     49  { 
     50    *leap_year_drift = calendar_wrapper_hdl->leap_year_drift.getInheritedValue(); 
     51  } 
     52   
     53  bool cxios_is_defined_calendar_wrapper_leap_year_drift(calendar_wrapper_Ptr calendar_wrapper_hdl ) 
     54  { 
     55     CTimer::get("XIOS").resume(); 
     56    return calendar_wrapper_hdl->leap_year_drift.hasInheritedValue(); 
     57     CTimer::get("XIOS").suspend(); 
     58  } 
     59   
     60   
     61   
     62  void cxios_set_calendar_wrapper_leap_year_drift_offset(calendar_wrapper_Ptr calendar_wrapper_hdl, double leap_year_drift_offset) 
     63  { 
     64     CTimer::get("XIOS").resume(); 
     65    calendar_wrapper_hdl->leap_year_drift_offset.setValue(leap_year_drift_offset); 
     66     CTimer::get("XIOS").suspend(); 
     67  } 
     68   
     69  void cxios_get_calendar_wrapper_leap_year_drift_offset(calendar_wrapper_Ptr calendar_wrapper_hdl, double* leap_year_drift_offset) 
     70  { 
     71    *leap_year_drift_offset = calendar_wrapper_hdl->leap_year_drift_offset.getInheritedValue(); 
     72  } 
     73   
     74  bool cxios_is_defined_calendar_wrapper_leap_year_drift_offset(calendar_wrapper_Ptr calendar_wrapper_hdl ) 
     75  { 
     76     CTimer::get("XIOS").resume(); 
     77    return calendar_wrapper_hdl->leap_year_drift_offset.hasInheritedValue(); 
     78     CTimer::get("XIOS").suspend(); 
     79  } 
     80   
     81   
     82   
     83  void cxios_set_calendar_wrapper_leap_year_month(calendar_wrapper_Ptr calendar_wrapper_hdl, int leap_year_month) 
     84  { 
     85     CTimer::get("XIOS").resume(); 
     86    calendar_wrapper_hdl->leap_year_month.setValue(leap_year_month); 
     87     CTimer::get("XIOS").suspend(); 
     88  } 
     89   
     90  void cxios_get_calendar_wrapper_leap_year_month(calendar_wrapper_Ptr calendar_wrapper_hdl, int* leap_year_month) 
     91  { 
     92    *leap_year_month = calendar_wrapper_hdl->leap_year_month.getInheritedValue(); 
     93  } 
     94   
     95  bool cxios_is_defined_calendar_wrapper_leap_year_month(calendar_wrapper_Ptr calendar_wrapper_hdl ) 
     96  { 
     97     CTimer::get("XIOS").resume(); 
     98    return calendar_wrapper_hdl->leap_year_month.hasInheritedValue(); 
     99     CTimer::get("XIOS").suspend(); 
     100  } 
     101   
     102   
     103   
     104  void cxios_set_calendar_wrapper_month_lengths(calendar_wrapper_Ptr calendar_wrapper_hdl, int* month_lengths, int extent1) 
     105  { 
     106    CTimer::get("XIOS").resume(); 
     107    CArray<int,1> tmp(month_lengths,shape(extent1),neverDeleteData) ; 
     108    calendar_wrapper_hdl->month_lengths.reference(tmp.copy()); 
     109     CTimer::get("XIOS").suspend(); 
     110  } 
     111   
     112  void cxios_get_calendar_wrapper_month_lengths(calendar_wrapper_Ptr calendar_wrapper_hdl, int* month_lengths, int extent1) 
     113  { 
     114    CTimer::get("XIOS").resume(); 
     115    CArray<int,1> tmp(month_lengths,shape(extent1),neverDeleteData) ; 
     116    tmp=calendar_wrapper_hdl->month_lengths.getInheritedValue() ; 
     117     CTimer::get("XIOS").suspend(); 
     118  } 
     119   
     120  bool cxios_is_defined_calendar_wrapper_month_lengths(calendar_wrapper_Ptr calendar_wrapper_hdl ) 
     121  { 
     122     CTimer::get("XIOS").resume(); 
     123    return calendar_wrapper_hdl->month_lengths.hasInheritedValue(); 
     124     CTimer::get("XIOS").suspend(); 
     125  } 
     126   
     127   
     128   
    20129  void cxios_set_calendar_wrapper_start_date(calendar_wrapper_Ptr calendar_wrapper_hdl, const char * start_date, int start_date_size) 
    21130  { 
     
    134243   
    135244   
     245  void cxios_set_calendar_wrapper_year_length(calendar_wrapper_Ptr calendar_wrapper_hdl, int year_length) 
     246  { 
     247     CTimer::get("XIOS").resume(); 
     248    calendar_wrapper_hdl->year_length.setValue(year_length); 
     249     CTimer::get("XIOS").suspend(); 
     250  } 
     251   
     252  void cxios_get_calendar_wrapper_year_length(calendar_wrapper_Ptr calendar_wrapper_hdl, int* year_length) 
     253  { 
     254    *year_length = calendar_wrapper_hdl->year_length.getInheritedValue(); 
     255  } 
     256   
     257  bool cxios_is_defined_calendar_wrapper_year_length(calendar_wrapper_Ptr calendar_wrapper_hdl ) 
     258  { 
     259     CTimer::get("XIOS").resume(); 
     260    return calendar_wrapper_hdl->year_length.hasInheritedValue(); 
     261     CTimer::get("XIOS").suspend(); 
     262  } 
     263   
     264   
     265   
    136266   
    137267} 
  • XIOS/trunk/src/interface/fortran/icalendar.F90

    r549 r550  
    2020   CONTAINS ! Fonctions disponibles pour les utilisateurs. 
    2121 
    22    SUBROUTINE xios(define_calendar)(type, timestep, start_date, time_origin) 
     22   SUBROUTINE xios(define_calendar)(type, timestep, start_date, time_origin, & 
     23                                    day_length, month_lengths, year_length, & 
     24                                    leap_year_month, leap_year_drift, leap_year_drift_offset) 
    2325      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle) 
    2426      USE icalendar_wrapper_attr, ONLY : xios(set_calendar_wrapper_attr_hdl) 
     
    3032      TYPE(txios(date)),     OPTIONAL, INTENT(IN) :: start_date 
    3133      TYPE(txios(date)),     OPTIONAL, INTENT(IN) :: time_origin 
     34      INTEGER,               OPTIONAL, INTENT(IN) :: day_length 
     35      INTEGER,               OPTIONAL, INTENT(IN) :: month_lengths(:) 
     36      INTEGER,               OPTIONAL, INTENT(IN) :: year_length 
     37      REAL (KIND=8),         OPTIONAL, INTENT(IN) :: leap_year_drift 
     38      REAL (KIND=8),         OPTIONAL, INTENT(IN) :: leap_year_drift_offset 
     39      INTEGER,               OPTIONAL, INTENT(IN) :: leap_year_month 
    3240      TYPE(txios(calendar_wrapper)) :: calendar_wrapper 
    3341 
     
    3846         CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, timestep=timestep) 
    3947      END IF 
     48      IF (PRESENT(day_length)) THEN 
     49         CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, day_length=day_length) 
     50      END IF 
     51      IF (PRESENT(month_lengths)) THEN 
     52         CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, month_lengths=month_lengths) 
     53      END IF 
     54      IF (PRESENT(year_length)) THEN 
     55         CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, year_length=year_length) 
     56      END IF 
     57      IF (PRESENT(leap_year_month)) THEN 
     58         CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, leap_year_month=leap_year_month) 
     59      END IF 
     60      IF (PRESENT(leap_year_drift)) THEN 
     61         CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, leap_year_drift=leap_year_drift) 
     62      END IF 
     63      IF (PRESENT(leap_year_drift_offset)) THEN 
     64         CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, leap_year_drift_offset=leap_year_drift_offset) 
     65      END IF 
    4066 
    4167      CALL xios(create_calendar)(calendar_wrapper) 
  • XIOS/trunk/src/interface/fortran_attr/calendar_wrapper_interface_attr.F90

    r549 r550  
    1010     
    1111     
     12    SUBROUTINE cxios_set_calendar_wrapper_day_length(calendar_wrapper_hdl, day_length) BIND(C) 
     13      USE ISO_C_BINDING 
     14      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     15      INTEGER (KIND=C_INT)      , VALUE :: day_length 
     16    END SUBROUTINE cxios_set_calendar_wrapper_day_length 
     17     
     18    SUBROUTINE cxios_get_calendar_wrapper_day_length(calendar_wrapper_hdl, day_length) BIND(C) 
     19      USE ISO_C_BINDING 
     20      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     21      INTEGER (KIND=C_INT)             :: day_length 
     22    END SUBROUTINE cxios_get_calendar_wrapper_day_length 
     23     
     24    FUNCTION cxios_is_defined_calendar_wrapper_day_length(calendar_wrapper_hdl ) BIND(C) 
     25      USE ISO_C_BINDING 
     26      LOGICAL(kind=C_BOOL) :: cxios_is_defined_calendar_wrapper_day_length 
     27      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     28    END FUNCTION cxios_is_defined_calendar_wrapper_day_length 
     29     
     30     
     31    SUBROUTINE cxios_set_calendar_wrapper_leap_year_drift(calendar_wrapper_hdl, leap_year_drift) BIND(C) 
     32      USE ISO_C_BINDING 
     33      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     34      REAL (KIND=C_DOUBLE)      , VALUE :: leap_year_drift 
     35    END SUBROUTINE cxios_set_calendar_wrapper_leap_year_drift 
     36     
     37    SUBROUTINE cxios_get_calendar_wrapper_leap_year_drift(calendar_wrapper_hdl, leap_year_drift) BIND(C) 
     38      USE ISO_C_BINDING 
     39      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     40      REAL (KIND=C_DOUBLE)             :: leap_year_drift 
     41    END SUBROUTINE cxios_get_calendar_wrapper_leap_year_drift 
     42     
     43    FUNCTION cxios_is_defined_calendar_wrapper_leap_year_drift(calendar_wrapper_hdl ) BIND(C) 
     44      USE ISO_C_BINDING 
     45      LOGICAL(kind=C_BOOL) :: cxios_is_defined_calendar_wrapper_leap_year_drift 
     46      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     47    END FUNCTION cxios_is_defined_calendar_wrapper_leap_year_drift 
     48     
     49     
     50    SUBROUTINE cxios_set_calendar_wrapper_leap_year_drift_offset(calendar_wrapper_hdl, leap_year_drift_offset) BIND(C) 
     51      USE ISO_C_BINDING 
     52      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     53      REAL (KIND=C_DOUBLE)      , VALUE :: leap_year_drift_offset 
     54    END SUBROUTINE cxios_set_calendar_wrapper_leap_year_drift_offset 
     55     
     56    SUBROUTINE cxios_get_calendar_wrapper_leap_year_drift_offset(calendar_wrapper_hdl, leap_year_drift_offset) BIND(C) 
     57      USE ISO_C_BINDING 
     58      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     59      REAL (KIND=C_DOUBLE)             :: leap_year_drift_offset 
     60    END SUBROUTINE cxios_get_calendar_wrapper_leap_year_drift_offset 
     61     
     62    FUNCTION cxios_is_defined_calendar_wrapper_leap_year_drift_offset(calendar_wrapper_hdl ) BIND(C) 
     63      USE ISO_C_BINDING 
     64      LOGICAL(kind=C_BOOL) :: cxios_is_defined_calendar_wrapper_leap_year_drift_offset 
     65      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     66    END FUNCTION cxios_is_defined_calendar_wrapper_leap_year_drift_offset 
     67     
     68     
     69    SUBROUTINE cxios_set_calendar_wrapper_leap_year_month(calendar_wrapper_hdl, leap_year_month) BIND(C) 
     70      USE ISO_C_BINDING 
     71      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     72      INTEGER (KIND=C_INT)      , VALUE :: leap_year_month 
     73    END SUBROUTINE cxios_set_calendar_wrapper_leap_year_month 
     74     
     75    SUBROUTINE cxios_get_calendar_wrapper_leap_year_month(calendar_wrapper_hdl, leap_year_month) BIND(C) 
     76      USE ISO_C_BINDING 
     77      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     78      INTEGER (KIND=C_INT)             :: leap_year_month 
     79    END SUBROUTINE cxios_get_calendar_wrapper_leap_year_month 
     80     
     81    FUNCTION cxios_is_defined_calendar_wrapper_leap_year_month(calendar_wrapper_hdl ) BIND(C) 
     82      USE ISO_C_BINDING 
     83      LOGICAL(kind=C_BOOL) :: cxios_is_defined_calendar_wrapper_leap_year_month 
     84      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     85    END FUNCTION cxios_is_defined_calendar_wrapper_leap_year_month 
     86     
     87     
     88    SUBROUTINE cxios_set_calendar_wrapper_month_lengths(calendar_wrapper_hdl, month_lengths, extent1) BIND(C) 
     89      USE ISO_C_BINDING 
     90      INTEGER (kind = C_INTPTR_T), VALUE       :: calendar_wrapper_hdl 
     91      INTEGER (KIND=C_INT)     , DIMENSION(*) :: month_lengths 
     92      INTEGER (kind = C_INT), VALUE  :: extent1 
     93    END SUBROUTINE cxios_set_calendar_wrapper_month_lengths 
     94     
     95    SUBROUTINE cxios_get_calendar_wrapper_month_lengths(calendar_wrapper_hdl, month_lengths, extent1) BIND(C) 
     96      USE ISO_C_BINDING 
     97      INTEGER (kind = C_INTPTR_T), VALUE       :: calendar_wrapper_hdl 
     98      INTEGER (KIND=C_INT)     , DIMENSION(*) :: month_lengths 
     99      INTEGER (kind = C_INT), VALUE  :: extent1 
     100    END SUBROUTINE cxios_get_calendar_wrapper_month_lengths 
     101     
     102    FUNCTION cxios_is_defined_calendar_wrapper_month_lengths(calendar_wrapper_hdl ) BIND(C) 
     103      USE ISO_C_BINDING 
     104      LOGICAL(kind=C_BOOL) :: cxios_is_defined_calendar_wrapper_month_lengths 
     105      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     106    END FUNCTION cxios_is_defined_calendar_wrapper_month_lengths 
     107     
     108     
    12109    SUBROUTINE cxios_set_calendar_wrapper_start_date(calendar_wrapper_hdl, start_date, start_date_size) BIND(C) 
    13110      USE ISO_C_BINDING 
     
    94191     
    95192     
     193    SUBROUTINE cxios_set_calendar_wrapper_year_length(calendar_wrapper_hdl, year_length) BIND(C) 
     194      USE ISO_C_BINDING 
     195      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     196      INTEGER (KIND=C_INT)      , VALUE :: year_length 
     197    END SUBROUTINE cxios_set_calendar_wrapper_year_length 
     198     
     199    SUBROUTINE cxios_get_calendar_wrapper_year_length(calendar_wrapper_hdl, year_length) BIND(C) 
     200      USE ISO_C_BINDING 
     201      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     202      INTEGER (KIND=C_INT)             :: year_length 
     203    END SUBROUTINE cxios_get_calendar_wrapper_year_length 
     204     
     205    FUNCTION cxios_is_defined_calendar_wrapper_year_length(calendar_wrapper_hdl ) BIND(C) 
     206      USE ISO_C_BINDING 
     207      LOGICAL(kind=C_BOOL) :: cxios_is_defined_calendar_wrapper_year_length 
     208      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl 
     209    END FUNCTION cxios_is_defined_calendar_wrapper_year_length 
     210     
     211     
    96212    END INTERFACE 
    97213   
  • XIOS/trunk/src/interface/fortran_attr/icalendar_wrapper_attr.F90

    r549 r550  
    1212   
    1313  SUBROUTINE xios(set_calendar_wrapper_attr)  & 
    14     ( calendar_wrapper_id, start_date, time_origin, timestep, type ) 
     14    ( calendar_wrapper_id, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month  & 
     15    , month_lengths, start_date, time_origin, timestep, type, year_length ) 
    1516     
    1617    IMPLICIT NONE 
    1718      TYPE(txios(calendar_wrapper))  :: calendar_wrapper_hdl 
    1819      CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id 
     20      INTEGER  , OPTIONAL, INTENT(IN) :: day_length 
     21      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: leap_year_drift 
     22      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: leap_year_drift_offset 
     23      INTEGER  , OPTIONAL, INTENT(IN) :: leap_year_month 
     24      INTEGER  , OPTIONAL, INTENT(IN) :: month_lengths(:) 
    1925      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date 
    2026      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin 
    2127      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep 
    2228      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type 
     29      INTEGER  , OPTIONAL, INTENT(IN) :: year_length 
    2330       
    2431      CALL xios(get_calendar_wrapper_handle)(calendar_wrapper_id,calendar_wrapper_hdl) 
    2532      CALL xios(set_calendar_wrapper_attr_hdl_)   & 
    26       ( calendar_wrapper_hdl, start_date, time_origin, timestep, type ) 
     33      ( calendar_wrapper_hdl, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month  & 
     34      , month_lengths, start_date, time_origin, timestep, type, year_length ) 
    2735     
    2836  END SUBROUTINE xios(set_calendar_wrapper_attr) 
    2937   
    3038  SUBROUTINE xios(set_calendar_wrapper_attr_hdl)  & 
    31     ( calendar_wrapper_hdl, start_date, time_origin, timestep, type ) 
    32      
    33     IMPLICIT NONE 
    34       TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl 
     39    ( calendar_wrapper_hdl, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month  & 
     40    , month_lengths, start_date, time_origin, timestep, type, year_length ) 
     41     
     42    IMPLICIT NONE 
     43      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl 
     44      INTEGER  , OPTIONAL, INTENT(IN) :: day_length 
     45      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: leap_year_drift 
     46      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: leap_year_drift_offset 
     47      INTEGER  , OPTIONAL, INTENT(IN) :: leap_year_month 
     48      INTEGER  , OPTIONAL, INTENT(IN) :: month_lengths(:) 
    3549      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date 
    3650      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin 
    3751      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep 
    3852      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type 
     53      INTEGER  , OPTIONAL, INTENT(IN) :: year_length 
    3954       
    4055      CALL xios(set_calendar_wrapper_attr_hdl_)  & 
    41       ( calendar_wrapper_hdl, start_date, time_origin, timestep, type ) 
     56      ( calendar_wrapper_hdl, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month  & 
     57      , month_lengths, start_date, time_origin, timestep, type, year_length ) 
    4258     
    4359  END SUBROUTINE xios(set_calendar_wrapper_attr_hdl) 
    4460   
    4561  SUBROUTINE xios(set_calendar_wrapper_attr_hdl_)   & 
    46     ( calendar_wrapper_hdl, start_date_, time_origin_, timestep_, type_ ) 
    47      
    48     IMPLICIT NONE 
    49       TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl 
     62    ( calendar_wrapper_hdl, day_length_, leap_year_drift_, leap_year_drift_offset_, leap_year_month_  & 
     63    , month_lengths_, start_date_, time_origin_, timestep_, type_, year_length_ ) 
     64     
     65    IMPLICIT NONE 
     66      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl 
     67      INTEGER  , OPTIONAL, INTENT(IN) :: day_length_ 
     68      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: leap_year_drift_ 
     69      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: leap_year_drift_offset_ 
     70      INTEGER  , OPTIONAL, INTENT(IN) :: leap_year_month_ 
     71      INTEGER  , OPTIONAL, INTENT(IN) :: month_lengths_(:) 
    5072      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date_ 
    5173      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin_ 
    5274      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep_ 
    5375      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_ 
     76      INTEGER  , OPTIONAL, INTENT(IN) :: year_length_ 
     77       
     78      IF (PRESENT(day_length_)) THEN 
     79        CALL cxios_set_calendar_wrapper_day_length(calendar_wrapper_hdl%daddr, day_length_) 
     80      ENDIF 
     81       
     82      IF (PRESENT(leap_year_drift_)) THEN 
     83        CALL cxios_set_calendar_wrapper_leap_year_drift(calendar_wrapper_hdl%daddr, leap_year_drift_) 
     84      ENDIF 
     85       
     86      IF (PRESENT(leap_year_drift_offset_)) THEN 
     87        CALL cxios_set_calendar_wrapper_leap_year_drift_offset(calendar_wrapper_hdl%daddr, leap_year_drift_offset_) 
     88      ENDIF 
     89       
     90      IF (PRESENT(leap_year_month_)) THEN 
     91        CALL cxios_set_calendar_wrapper_leap_year_month(calendar_wrapper_hdl%daddr, leap_year_month_) 
     92      ENDIF 
     93       
     94      IF (PRESENT(month_lengths_)) THEN 
     95        CALL cxios_set_calendar_wrapper_month_lengths(calendar_wrapper_hdl%daddr, month_lengths_,size(month_lengths_,1)) 
     96      ENDIF 
    5497       
    5598      IF (PRESENT(start_date_)) THEN 
     
    69112      ENDIF 
    70113       
     114      IF (PRESENT(year_length_)) THEN 
     115        CALL cxios_set_calendar_wrapper_year_length(calendar_wrapper_hdl%daddr, year_length_) 
     116      ENDIF 
     117       
    71118       
    72119     
     
    74121   
    75122  SUBROUTINE xios(get_calendar_wrapper_attr)  & 
    76     ( calendar_wrapper_id, start_date, time_origin, timestep, type ) 
     123    ( calendar_wrapper_id, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month  & 
     124    , month_lengths, start_date, time_origin, timestep, type, year_length ) 
    77125     
    78126    IMPLICIT NONE 
    79127      TYPE(txios(calendar_wrapper))  :: calendar_wrapper_hdl 
    80128      CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id 
     129      INTEGER  , OPTIONAL, INTENT(OUT) :: day_length 
     130      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: leap_year_drift 
     131      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: leap_year_drift_offset 
     132      INTEGER  , OPTIONAL, INTENT(OUT) :: leap_year_month 
     133      INTEGER  , OPTIONAL, INTENT(OUT) :: month_lengths(:) 
    81134      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date 
    82135      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin 
    83136      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep 
    84137      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type 
     138      INTEGER  , OPTIONAL, INTENT(OUT) :: year_length 
    85139       
    86140      CALL xios(get_calendar_wrapper_handle)(calendar_wrapper_id,calendar_wrapper_hdl) 
    87141      CALL xios(get_calendar_wrapper_attr_hdl_)   & 
    88       ( calendar_wrapper_hdl, start_date, time_origin, timestep, type ) 
     142      ( calendar_wrapper_hdl, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month  & 
     143      , month_lengths, start_date, time_origin, timestep, type, year_length ) 
    89144     
    90145  END SUBROUTINE xios(get_calendar_wrapper_attr) 
    91146   
    92147  SUBROUTINE xios(get_calendar_wrapper_attr_hdl)  & 
    93     ( calendar_wrapper_hdl, start_date, time_origin, timestep, type ) 
    94      
    95     IMPLICIT NONE 
    96       TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl 
     148    ( calendar_wrapper_hdl, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month  & 
     149    , month_lengths, start_date, time_origin, timestep, type, year_length ) 
     150     
     151    IMPLICIT NONE 
     152      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl 
     153      INTEGER  , OPTIONAL, INTENT(OUT) :: day_length 
     154      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: leap_year_drift 
     155      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: leap_year_drift_offset 
     156      INTEGER  , OPTIONAL, INTENT(OUT) :: leap_year_month 
     157      INTEGER  , OPTIONAL, INTENT(OUT) :: month_lengths(:) 
    97158      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date 
    98159      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin 
    99160      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep 
    100161      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type 
     162      INTEGER  , OPTIONAL, INTENT(OUT) :: year_length 
    101163       
    102164      CALL xios(get_calendar_wrapper_attr_hdl_)  & 
    103       ( calendar_wrapper_hdl, start_date, time_origin, timestep, type ) 
     165      ( calendar_wrapper_hdl, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month  & 
     166      , month_lengths, start_date, time_origin, timestep, type, year_length ) 
    104167     
    105168  END SUBROUTINE xios(get_calendar_wrapper_attr_hdl) 
    106169   
    107170  SUBROUTINE xios(get_calendar_wrapper_attr_hdl_)   & 
    108     ( calendar_wrapper_hdl, start_date_, time_origin_, timestep_, type_ ) 
    109      
    110     IMPLICIT NONE 
    111       TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl 
     171    ( calendar_wrapper_hdl, day_length_, leap_year_drift_, leap_year_drift_offset_, leap_year_month_  & 
     172    , month_lengths_, start_date_, time_origin_, timestep_, type_, year_length_ ) 
     173     
     174    IMPLICIT NONE 
     175      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl 
     176      INTEGER  , OPTIONAL, INTENT(OUT) :: day_length_ 
     177      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: leap_year_drift_ 
     178      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: leap_year_drift_offset_ 
     179      INTEGER  , OPTIONAL, INTENT(OUT) :: leap_year_month_ 
     180      INTEGER  , OPTIONAL, INTENT(OUT) :: month_lengths_(:) 
    112181      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date_ 
    113182      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin_ 
    114183      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep_ 
    115184      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_ 
     185      INTEGER  , OPTIONAL, INTENT(OUT) :: year_length_ 
     186       
     187      IF (PRESENT(day_length_)) THEN 
     188        CALL cxios_get_calendar_wrapper_day_length(calendar_wrapper_hdl%daddr, day_length_) 
     189      ENDIF 
     190       
     191      IF (PRESENT(leap_year_drift_)) THEN 
     192        CALL cxios_get_calendar_wrapper_leap_year_drift(calendar_wrapper_hdl%daddr, leap_year_drift_) 
     193      ENDIF 
     194       
     195      IF (PRESENT(leap_year_drift_offset_)) THEN 
     196        CALL cxios_get_calendar_wrapper_leap_year_drift_offset(calendar_wrapper_hdl%daddr, leap_year_drift_offset_) 
     197      ENDIF 
     198       
     199      IF (PRESENT(leap_year_month_)) THEN 
     200        CALL cxios_get_calendar_wrapper_leap_year_month(calendar_wrapper_hdl%daddr, leap_year_month_) 
     201      ENDIF 
     202       
     203      IF (PRESENT(month_lengths_)) THEN 
     204        CALL cxios_get_calendar_wrapper_month_lengths(calendar_wrapper_hdl%daddr, month_lengths_,size(month_lengths_,1)) 
     205      ENDIF 
    116206       
    117207      IF (PRESENT(start_date_)) THEN 
     
    131221      ENDIF 
    132222       
     223      IF (PRESENT(year_length_)) THEN 
     224        CALL cxios_get_calendar_wrapper_year_length(calendar_wrapper_hdl%daddr, year_length_) 
     225      ENDIF 
     226       
    133227       
    134228     
     
    136230   
    137231  SUBROUTINE xios(is_defined_calendar_wrapper_attr)  & 
    138     ( calendar_wrapper_id, start_date, time_origin, timestep, type ) 
     232    ( calendar_wrapper_id, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month  & 
     233    , month_lengths, start_date, time_origin, timestep, type, year_length ) 
    139234     
    140235    IMPLICIT NONE 
    141236      TYPE(txios(calendar_wrapper))  :: calendar_wrapper_hdl 
    142237      CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id 
     238      LOGICAL, OPTIONAL, INTENT(OUT) :: day_length 
     239      LOGICAL(KIND=C_BOOL) :: day_length_tmp 
     240      LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_drift 
     241      LOGICAL(KIND=C_BOOL) :: leap_year_drift_tmp 
     242      LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_drift_offset 
     243      LOGICAL(KIND=C_BOOL) :: leap_year_drift_offset_tmp 
     244      LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_month 
     245      LOGICAL(KIND=C_BOOL) :: leap_year_month_tmp 
     246      LOGICAL, OPTIONAL, INTENT(OUT) :: month_lengths 
     247      LOGICAL(KIND=C_BOOL) :: month_lengths_tmp 
    143248      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date 
    144249      LOGICAL(KIND=C_BOOL) :: start_date_tmp 
     
    149254      LOGICAL, OPTIONAL, INTENT(OUT) :: type 
    150255      LOGICAL(KIND=C_BOOL) :: type_tmp 
     256      LOGICAL, OPTIONAL, INTENT(OUT) :: year_length 
     257      LOGICAL(KIND=C_BOOL) :: year_length_tmp 
    151258       
    152259      CALL xios(get_calendar_wrapper_handle)(calendar_wrapper_id,calendar_wrapper_hdl) 
    153260      CALL xios(is_defined_calendar_wrapper_attr_hdl_)   & 
    154       ( calendar_wrapper_hdl, start_date, time_origin, timestep, type ) 
     261      ( calendar_wrapper_hdl, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month  & 
     262      , month_lengths, start_date, time_origin, timestep, type, year_length ) 
    155263     
    156264  END SUBROUTINE xios(is_defined_calendar_wrapper_attr) 
    157265   
    158266  SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl)  & 
    159     ( calendar_wrapper_hdl, start_date, time_origin, timestep, type ) 
    160      
    161     IMPLICIT NONE 
    162       TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl 
     267    ( calendar_wrapper_hdl, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month  & 
     268    , month_lengths, start_date, time_origin, timestep, type, year_length ) 
     269     
     270    IMPLICIT NONE 
     271      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl 
     272      LOGICAL, OPTIONAL, INTENT(OUT) :: day_length 
     273      LOGICAL(KIND=C_BOOL) :: day_length_tmp 
     274      LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_drift 
     275      LOGICAL(KIND=C_BOOL) :: leap_year_drift_tmp 
     276      LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_drift_offset 
     277      LOGICAL(KIND=C_BOOL) :: leap_year_drift_offset_tmp 
     278      LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_month 
     279      LOGICAL(KIND=C_BOOL) :: leap_year_month_tmp 
     280      LOGICAL, OPTIONAL, INTENT(OUT) :: month_lengths 
     281      LOGICAL(KIND=C_BOOL) :: month_lengths_tmp 
    163282      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date 
    164283      LOGICAL(KIND=C_BOOL) :: start_date_tmp 
     
    169288      LOGICAL, OPTIONAL, INTENT(OUT) :: type 
    170289      LOGICAL(KIND=C_BOOL) :: type_tmp 
     290      LOGICAL, OPTIONAL, INTENT(OUT) :: year_length 
     291      LOGICAL(KIND=C_BOOL) :: year_length_tmp 
    171292       
    172293      CALL xios(is_defined_calendar_wrapper_attr_hdl_)  & 
    173       ( calendar_wrapper_hdl, start_date, time_origin, timestep, type ) 
     294      ( calendar_wrapper_hdl, day_length, leap_year_drift, leap_year_drift_offset, leap_year_month  & 
     295      , month_lengths, start_date, time_origin, timestep, type, year_length ) 
    174296     
    175297  END SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl) 
    176298   
    177299  SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl_)   & 
    178     ( calendar_wrapper_hdl, start_date_, time_origin_, timestep_, type_ ) 
    179      
    180     IMPLICIT NONE 
    181       TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl 
     300    ( calendar_wrapper_hdl, day_length_, leap_year_drift_, leap_year_drift_offset_, leap_year_month_  & 
     301    , month_lengths_, start_date_, time_origin_, timestep_, type_, year_length_ ) 
     302     
     303    IMPLICIT NONE 
     304      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl 
     305      LOGICAL, OPTIONAL, INTENT(OUT) :: day_length_ 
     306      LOGICAL(KIND=C_BOOL) :: day_length__tmp 
     307      LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_drift_ 
     308      LOGICAL(KIND=C_BOOL) :: leap_year_drift__tmp 
     309      LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_drift_offset_ 
     310      LOGICAL(KIND=C_BOOL) :: leap_year_drift_offset__tmp 
     311      LOGICAL, OPTIONAL, INTENT(OUT) :: leap_year_month_ 
     312      LOGICAL(KIND=C_BOOL) :: leap_year_month__tmp 
     313      LOGICAL, OPTIONAL, INTENT(OUT) :: month_lengths_ 
     314      LOGICAL(KIND=C_BOOL) :: month_lengths__tmp 
    182315      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date_ 
    183316      LOGICAL(KIND=C_BOOL) :: start_date__tmp 
     
    188321      LOGICAL, OPTIONAL, INTENT(OUT) :: type_ 
    189322      LOGICAL(KIND=C_BOOL) :: type__tmp 
     323      LOGICAL, OPTIONAL, INTENT(OUT) :: year_length_ 
     324      LOGICAL(KIND=C_BOOL) :: year_length__tmp 
     325       
     326      IF (PRESENT(day_length_)) THEN 
     327        day_length__tmp=cxios_is_defined_calendar_wrapper_day_length(calendar_wrapper_hdl%daddr) 
     328        day_length_=day_length__tmp 
     329      ENDIF 
     330       
     331      IF (PRESENT(leap_year_drift_)) THEN 
     332        leap_year_drift__tmp=cxios_is_defined_calendar_wrapper_leap_year_drift(calendar_wrapper_hdl%daddr) 
     333        leap_year_drift_=leap_year_drift__tmp 
     334      ENDIF 
     335       
     336      IF (PRESENT(leap_year_drift_offset_)) THEN 
     337        leap_year_drift_offset__tmp=cxios_is_defined_calendar_wrapper_leap_year_drift_offset(calendar_wrapper_hdl%daddr) 
     338        leap_year_drift_offset_=leap_year_drift_offset__tmp 
     339      ENDIF 
     340       
     341      IF (PRESENT(leap_year_month_)) THEN 
     342        leap_year_month__tmp=cxios_is_defined_calendar_wrapper_leap_year_month(calendar_wrapper_hdl%daddr) 
     343        leap_year_month_=leap_year_month__tmp 
     344      ENDIF 
     345       
     346      IF (PRESENT(month_lengths_)) THEN 
     347        month_lengths__tmp=cxios_is_defined_calendar_wrapper_month_lengths(calendar_wrapper_hdl%daddr) 
     348        month_lengths_=month_lengths__tmp 
     349      ENDIF 
    190350       
    191351      IF (PRESENT(start_date_)) THEN 
     
    209369      ENDIF 
    210370       
     371      IF (PRESENT(year_length_)) THEN 
     372        year_length__tmp=cxios_is_defined_calendar_wrapper_year_length(calendar_wrapper_hdl%daddr) 
     373        year_length_=year_length__tmp 
     374      ENDIF 
     375       
    211376       
    212377     
Note: See TracChangeset for help on using the changeset viewer.