source: XIOS/trunk/src/interface/fortran_attr/icalendar_wrapper_attr.F90 @ 549

Last change on this file since 549 was 549, checked in by rlacroix, 9 years ago

Revised calendar functionalities:

  • the calendar is now configured from a specific calendar child node of the context in the XML configuration file. Example: <calendar type="Gregorian" start_date="2012-03-01 15:00:00" time_origin="2012-02-29 15:00:00" timestep="1h" />
  • the calendar type should now be configured when defining the start time and/or the time origin.
  • the start time and the time origin are now optional, 0000-01-01 00:00:00 will be used by default. It is also possible to define them partially. For example, 2015 and 2014-12 are valid dates corresponding respectively to 2015-01-01 00:00:00 and 2014-12-01 00:00:00.
  • an optional duration offset can be added to the start date and time origin. For example, it's possible to define the date 2015-01-12 12:00:00 as 2015-01-11 + 36h or 2015-01-11 12:00:00 + 1d. The duration format is the same as the time step. Being that the date is optional, it is possible to only use a duration (for example + 42s is the same as 0000-01-01 00:00:00 + 42s). An error will be raised if a duration based on the time step is used before the time step was configured. For example, the following would cause an error: <calendar type="Gregorian" start_date="+ 1ts" /> but <calendar type="Gregorian" start_date="+ 1ts" timestep="0.5h" /> would not.
  • new Fortran interface to define the calendar:
    • xios_define_calendar(type[, timestep, start_date, time_origin]) will create a calendar when none had previously been defined. Only the type argument is mandatory, the rest is optional. Calendar operations on dates and durations are possible as soon as the calendar is created (either using this procedure or directly from the XML configuration file).
    • the following getter and setter procedures are available: xios_set_timestep, xios_set_start_date, xios_set_time_origin, xios_get_calendar_type, xios_get_timestep, xios_get_start_date, xios_get_time_origin.
  • new Fortran interface to interact with the calendar: xios_update_calendar, xios_get_current_date, xios_get_year_length_in_seconds, xios_get_day_length_in_seconds.
  • new Fortran interface for date conversion: xios_date_get_second_of_year, xios_date_get_day_of_year, xios_date_get_fraction_of_year, xios_date_get_second_of_day, xios_date_get_fraction_of_day.
  • two new placeholders are available to format the file name when splitting the output (split_freq_format attribute):
    • %S the number of seconds since the time origin
    • %D the integral number of days since the time origin
File size: 8.6 KB
RevLine 
[549]1! * ************************************************************************** *
2! *               Interface auto generated - do not modify                     *
3! * ************************************************************************** *
4#include "xios_fortran_prefix.hpp"
5
6MODULE icalendar_wrapper_attr
7  USE, INTRINSIC :: ISO_C_BINDING
8  USE icalendar_wrapper
9  USE calendar_wrapper_interface_attr
10 
11CONTAINS
12 
13  SUBROUTINE xios(set_calendar_wrapper_attr)  &
14    ( calendar_wrapper_id, start_date, time_origin, timestep, type )
15   
16    IMPLICIT NONE
17      TYPE(txios(calendar_wrapper))  :: calendar_wrapper_hdl
18      CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id
19      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date
20      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin
21      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep
22      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type
23     
24      CALL xios(get_calendar_wrapper_handle)(calendar_wrapper_id,calendar_wrapper_hdl)
25      CALL xios(set_calendar_wrapper_attr_hdl_)   &
26      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
27   
28  END SUBROUTINE xios(set_calendar_wrapper_attr)
29 
30  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
35      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date
36      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin
37      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep
38      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type
39     
40      CALL xios(set_calendar_wrapper_attr_hdl_)  &
41      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
42   
43  END SUBROUTINE xios(set_calendar_wrapper_attr_hdl)
44 
45  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
50      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date_
51      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin_
52      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep_
53      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_
54     
55      IF (PRESENT(start_date_)) THEN
56        CALL cxios_set_calendar_wrapper_start_date(calendar_wrapper_hdl%daddr, start_date_, len(start_date_))
57      ENDIF
58     
59      IF (PRESENT(time_origin_)) THEN
60        CALL cxios_set_calendar_wrapper_time_origin(calendar_wrapper_hdl%daddr, time_origin_, len(time_origin_))
61      ENDIF
62     
63      IF (PRESENT(timestep_)) THEN
64        CALL cxios_set_calendar_wrapper_timestep(calendar_wrapper_hdl%daddr, timestep_)
65      ENDIF
66     
67      IF (PRESENT(type_)) THEN
68        CALL cxios_set_calendar_wrapper_type(calendar_wrapper_hdl%daddr, type_, len(type_))
69      ENDIF
70     
71     
72   
73  END SUBROUTINE xios(set_calendar_wrapper_attr_hdl_)
74 
75  SUBROUTINE xios(get_calendar_wrapper_attr)  &
76    ( calendar_wrapper_id, start_date, time_origin, timestep, type )
77   
78    IMPLICIT NONE
79      TYPE(txios(calendar_wrapper))  :: calendar_wrapper_hdl
80      CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id
81      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date
82      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin
83      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep
84      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type
85     
86      CALL xios(get_calendar_wrapper_handle)(calendar_wrapper_id,calendar_wrapper_hdl)
87      CALL xios(get_calendar_wrapper_attr_hdl_)   &
88      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
89   
90  END SUBROUTINE xios(get_calendar_wrapper_attr)
91 
92  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
97      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date
98      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin
99      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep
100      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type
101     
102      CALL xios(get_calendar_wrapper_attr_hdl_)  &
103      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
104   
105  END SUBROUTINE xios(get_calendar_wrapper_attr_hdl)
106 
107  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
112      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date_
113      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin_
114      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep_
115      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_
116     
117      IF (PRESENT(start_date_)) THEN
118        CALL cxios_get_calendar_wrapper_start_date(calendar_wrapper_hdl%daddr, start_date_, len(start_date_))
119      ENDIF
120     
121      IF (PRESENT(time_origin_)) THEN
122        CALL cxios_get_calendar_wrapper_time_origin(calendar_wrapper_hdl%daddr, time_origin_, len(time_origin_))
123      ENDIF
124     
125      IF (PRESENT(timestep_)) THEN
126        CALL cxios_get_calendar_wrapper_timestep(calendar_wrapper_hdl%daddr, timestep_)
127      ENDIF
128     
129      IF (PRESENT(type_)) THEN
130        CALL cxios_get_calendar_wrapper_type(calendar_wrapper_hdl%daddr, type_, len(type_))
131      ENDIF
132     
133     
134   
135  END SUBROUTINE xios(get_calendar_wrapper_attr_hdl_)
136 
137  SUBROUTINE xios(is_defined_calendar_wrapper_attr)  &
138    ( calendar_wrapper_id, start_date, time_origin, timestep, type )
139   
140    IMPLICIT NONE
141      TYPE(txios(calendar_wrapper))  :: calendar_wrapper_hdl
142      CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id
143      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date
144      LOGICAL(KIND=C_BOOL) :: start_date_tmp
145      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin
146      LOGICAL(KIND=C_BOOL) :: time_origin_tmp
147      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep
148      LOGICAL(KIND=C_BOOL) :: timestep_tmp
149      LOGICAL, OPTIONAL, INTENT(OUT) :: type
150      LOGICAL(KIND=C_BOOL) :: type_tmp
151     
152      CALL xios(get_calendar_wrapper_handle)(calendar_wrapper_id,calendar_wrapper_hdl)
153      CALL xios(is_defined_calendar_wrapper_attr_hdl_)   &
154      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
155   
156  END SUBROUTINE xios(is_defined_calendar_wrapper_attr)
157 
158  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
163      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date
164      LOGICAL(KIND=C_BOOL) :: start_date_tmp
165      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin
166      LOGICAL(KIND=C_BOOL) :: time_origin_tmp
167      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep
168      LOGICAL(KIND=C_BOOL) :: timestep_tmp
169      LOGICAL, OPTIONAL, INTENT(OUT) :: type
170      LOGICAL(KIND=C_BOOL) :: type_tmp
171     
172      CALL xios(is_defined_calendar_wrapper_attr_hdl_)  &
173      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
174   
175  END SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl)
176 
177  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
182      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date_
183      LOGICAL(KIND=C_BOOL) :: start_date__tmp
184      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin_
185      LOGICAL(KIND=C_BOOL) :: time_origin__tmp
186      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep_
187      LOGICAL(KIND=C_BOOL) :: timestep__tmp
188      LOGICAL, OPTIONAL, INTENT(OUT) :: type_
189      LOGICAL(KIND=C_BOOL) :: type__tmp
190     
191      IF (PRESENT(start_date_)) THEN
192        start_date__tmp=cxios_is_defined_calendar_wrapper_start_date(calendar_wrapper_hdl%daddr)
193        start_date_=start_date__tmp
194      ENDIF
195     
196      IF (PRESENT(time_origin_)) THEN
197        time_origin__tmp=cxios_is_defined_calendar_wrapper_time_origin(calendar_wrapper_hdl%daddr)
198        time_origin_=time_origin__tmp
199      ENDIF
200     
201      IF (PRESENT(timestep_)) THEN
202        timestep__tmp=cxios_is_defined_calendar_wrapper_timestep(calendar_wrapper_hdl%daddr)
203        timestep_=timestep__tmp
204      ENDIF
205     
206      IF (PRESENT(type_)) THEN
207        type__tmp=cxios_is_defined_calendar_wrapper_type(calendar_wrapper_hdl%daddr)
208        type_=type__tmp
209      ENDIF
210     
211     
212   
213  END SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl_)
214 
215END MODULE icalendar_wrapper_attr
Note: See TracBrowser for help on using the repository browser.