| 17 | - Calendar related attributes (`calendar_type`, `timestep`, `start_date`, `time_origin`) have been moved from the `context` object to a new child object `calendar`. |
| 18 | |
| 19 | The following excerpt from a configuration file: |
| 20 | {{{ |
| 21 | <context id="test" calendar_type="Gregorian" start_date="2012-03-01 15:00:00" time_origin="2012-02-29 15:00:00"> |
| 22 | ... |
| 23 | </context> |
| 24 | }}} |
| 25 | will become: |
| 26 | {{{ |
| 27 | <context id="test"> |
| 28 | <calendar type="Gregorian" start_date="2012-03-01 15:00:00" time_origin="2012-02-29 15:00:00" /> |
| 29 | ... |
| 30 | </context> |
| 31 | }}} |
| 32 | |
| 33 | - Be careful to the following changes related to the calendar initialization: |
| 34 | - XIOS now requires that the calendar type is decided once and for all, either in the configuration file or the Fortran interface. |
| 35 | - the start date and time origin cannot be defined before the calendar type has been decided. |
| 36 | - by default the start date and the time origin are defined as `0000-01-01 00:00:00`. If the start date is set but the time origin is not, the time origin is not automatically set to be equal to the start date. |
| 37 | |
| 38 | - The Fortran interface has been modified to reflect the changes made to the calendar definition in the configuration file and a new type `xios_date` must now be used to manipulate the attributes corresponding to dates (`start_date`, `time_origin`). |
| 39 | |
| 40 | The following code: |
| 41 | {{{ |
| 42 | PROGRAM test |
| 43 | USE xios |
| 44 | ... |
| 45 | CALL xios_set_context_attr("test",calendar_type="Gregorian") |
| 46 | CALL xios_set_context_attr("test",start_date="2000-01-01 00:00:00") |
| 47 | CALL xios_set_context_attr("test",time_origin="1999-01-01 15:00:00") |
| 48 | ... |
| 49 | END PROGRAM test |
| 50 | }}} |
| 51 | will become: |
| 52 | {{{ |
| 53 | PROGRAM test |
| 54 | USE xios |
| 55 | ... |
| 56 | TYPE(xios_date) :: start_date, time_origin |
| 57 | ... |
| 58 | CALL xios_get_handle("test",ctx_hdl) |
| 59 | CALL xios_set_current_context(ctx_hdl) |
| 60 | ... |
| 61 | CALL xios_define_calendar("Gregorian") |
| 62 | start_date = xios_date(2000, 01, 01, 00, 00, 00) |
| 63 | CALL xios_set_start_date(start_date) |
| 64 | time_origin = xios_date(1999, 01, 01, 15, 00, 00) |
| 65 | CALL xios_set_time_origin(time_origin) |
| 66 | ... |
| 67 | END PROGRAM test |
| 68 | }}} |
| 69 | or |
| 70 | {{{ |
| 71 | PROGRAM test |
| 72 | USE xios |
| 73 | ... |
| 74 | TYPE(xios_date) :: start_date, time_origin |
| 75 | ... |
| 76 | CALL xios_get_handle("test",ctx_hdl) |
| 77 | CALL xios_set_current_context(ctx_hdl) |
| 78 | ... |
| 79 | start_date = xios_date(2000, 01, 01, 00, 00, 00) |
| 80 | time_origin = xios_date(1999, 01, 01, 15, 00, 00) |
| 81 | CALL xios_define_calendar("Gregorian", start_date=start_date, time_origin=time_origin) |
| 82 | ... |
| 83 | END PROGRAM test |
| 84 | }}} |
| 85 | |
54 | | or |
55 | | {{{ |
56 | | PROGRAM test |
57 | | USE xios |
58 | | ... |
59 | | TYPE(xios_duration) :: dtime |
60 | | ... |
61 | | CALL xios_get_handle("test",ctx_hdl) |
62 | | CALL xios_set_current_context(ctx_hdl) |
63 | | ... |
64 | | dtime%second=3600 |
65 | | CALL xios_set_context_attr("test", timestep=dtime) |
66 | | ... |
67 | | END PROGRAM test |
68 | | }}} |
69 | | - attributes corresponding to a date should now be manipulated using the `xios_date` type when using the Fortran interface. Affected attributes are `start_date` and `time_origin` in `context` objects. |
70 | | |
71 | | The following code: |
72 | | {{{ |
73 | | PROGRAM test |
74 | | USE xios |
75 | | ... |
76 | | CALL xios_set_context_attr("test",calendar_type="Gregorian") |
77 | | CALL xios_set_context_attr("test",start_date="2000-01-01 00:00:00") |
78 | | CALL xios_set_context_attr("test",time_origin="1999-01-01 15:00:00") |
79 | | ... |
80 | | END PROGRAM test |
81 | | }}} |
82 | | will become: |
83 | | {{{ |
84 | | PROGRAM test |
85 | | USE xios |
86 | | ... |
87 | | TYPE(xios_date) :: start_date, time_origin |
88 | | ... |
89 | | CALL xios_set_context_attr("test",calendar_type="Gregorian") |
90 | | start_date = xios_date(2000, 01, 01, 00, 00, 00) |
91 | | CALL xios_set_context_attr("test",start_date=start_date) |
92 | | time_origin = xios_date(1999, 01, 01, 15, 00, 00) |
93 | | CALL xios_set_context_attr("test",time_origin=time_origin) |
94 | | ... |
95 | | END PROGRAM test |
96 | | }}} |