1 |
module ioconf_calendar_m |
module ioconf_calendar_m |
2 |
|
|
3 |
|
! From IOIPSL/src/calendar.f90, version 2.0 2004/04/05 14:47:47 |
4 |
|
|
5 |
|
! This is the calendar used to do all calculations on time. Three |
6 |
|
! types of calendars are possible: |
7 |
|
|
8 |
|
! - Gregorian: |
9 |
|
! The normal calendar. The time origin for the julian day in this |
10 |
|
! case is 24 Nov -4713. |
11 |
|
|
12 |
|
! - No leap: |
13 |
|
! A 365 day year without leap years. The origin for the julian days |
14 |
|
! is in this case 1 Jan 0. |
15 |
|
|
16 |
|
! - xxxd: |
17 |
|
! Year of xxx days with months of equal length. The origin for the |
18 |
|
! julian days is then also 1 Jan 0. |
19 |
|
|
20 |
|
! As one can see it is difficult to go from one calendar to the |
21 |
|
! other. All operations involving julian days will be wrong. This |
22 |
|
! calendar will lock as soon as possible the length of the year and |
23 |
|
! forbid any further modification. |
24 |
|
|
25 |
|
! For the non leap-year calendar the method is still brute force. |
26 |
|
! We need to find an integer series which takes care of the length |
27 |
|
! of the various month. (Jan) |
28 |
|
|
29 |
implicit none |
implicit none |
30 |
|
|
31 |
|
INTEGER:: mon_len(12) = (/31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31/) |
32 |
|
CHARACTER(LEN=20):: calendar_used = "gregorian" |
33 |
|
REAL:: un_an = 365.2425 ! one year in days |
34 |
|
|
35 |
contains |
contains |
36 |
|
|
37 |
SUBROUTINE ioconf_calendar (str) |
SUBROUTINE ioconf_calendar (str) |
45 |
! - xxxd: A calendar of xxx days (has to be a modulo of 12) |
! - xxxd: A calendar of xxx days (has to be a modulo of 12) |
46 |
! with 12 month of equal length |
! with 12 month of equal length |
47 |
|
|
48 |
use calendar, only: mon_len, calendar_used, lock_unan, un_an |
use calendar, only: lock_unan |
49 |
use strlowercase_m |
use strlowercase_m |
50 |
use errioipsl |
use errioipsl |
51 |
|
|
110 |
mon_len(:) = leng |
mon_len(:) = leng |
111 |
ELSE |
ELSE |
112 |
CALL histerr (3, 'ioconf_calendar', & |
CALL histerr (3, 'ioconf_calendar', & |
113 |
& 'The length of the year as to be a modulo of 12', & |
'The length of the year has to be a modulo of 12', & |
114 |
& 'so that it can be divided into 12 month of equal length', & |
'so that it can be divided into 12 month of equal ' & |
115 |
& str) |
// 'length', str) |
116 |
ENDIF |
ENDIF |
117 |
ELSE |
ELSE |
118 |
CALL histerr (3, 'ioconf_calendar', & |
CALL histerr (3, 'ioconf_calendar', & |
119 |
& 'Unrecognized input, please ceck the man pages.', str, ' ') |
'Unrecognized input, please ceck the man pages.', str, ' ') |
120 |
ENDIF |
ENDIF |
121 |
END SELECT |
END SELECT |
122 |
ELSE |
ELSE |
123 |
WRITE(str10, '(f10.4)') un_an |
WRITE(str10, '(f10.4)') un_an |
124 |
CALL histerr (2, 'ioconf_calendar', & |
CALL histerr (2, 'ioconf_calendar', & |
125 |
& 'The calendar was already used or configured. You are not', & |
'The calendar was already used or configured. You are not', & |
126 |
& 'allowed to change it again. '// & |
'allowed to change it again. '// & |
127 |
& 'The following length of year is used:', str10) |
'The following length of year is used:', str10) |
128 |
ENDIF |
ENDIF |
129 |
|
|
130 |
END SUBROUTINE ioconf_calendar |
END SUBROUTINE ioconf_calendar |