17 |
! Year of xxx days with months of equal length. The origin for the |
! Year of xxx days with months of equal length. The origin for the |
18 |
! julian days is then also 1 Jan 0. |
! julian days is then also 1 Jan 0. |
19 |
|
|
20 |
! As one can see it is difficult to go from one calendar to the |
! It is difficult to go from one calendar to the other. All |
21 |
! other. All operations involving julian days will be wrong. This |
! operations involving julian days will be wrong. This calendar will |
22 |
! calendar will lock as soon as possible the length of the year and |
! lock the length of the year as soon as possible and forbid any |
23 |
! forbid any further modification. |
! further modification. |
24 |
|
|
25 |
! For the non leap-year calendar the method is still brute force. |
! For the no-leap calendar, the method is still brute force. We |
26 |
! We need to find an integer series which takes care of the length |
! need to find an integer series which takes care of the length of |
27 |
! of the various month. (Jan) |
! the various month. (Jan) |
28 |
|
|
29 |
implicit none |
implicit none |
30 |
|
|
40 |
! This operation is only allowed once and the first call to |
! This operation is only allowed once and the first call to |
41 |
! ymds2ju or ju2ymsd will lock the current configuration. |
! ymds2ju or ju2ymsd will lock the current configuration. |
42 |
! the argument to ioconf_calendar can be any of the following: |
! the argument to ioconf_calendar can be any of the following: |
43 |
! - gregorian: This is the gregorian calendar (default here) |
|
44 |
! - noleap: A calendar without leap years = 365 days |
! - gregorian: this is the gregorian calendar (default here) |
45 |
! - xxxd: A calendar of xxx days (has to be a modulo of 12) |
|
46 |
! with 12 month of equal length |
! - noleap: A calendar without leap years = 365 days |
47 |
|
|
48 |
|
! - xxxd: A calendar of xxx days (has to be a modulo of 12) with |
49 |
|
! 12 month of equal length |
50 |
|
|
51 |
use calendar, only: lock_unan |
use calendar, only: lock_unan |
52 |
use strlowercase_m |
use strlowercase_m, only: strlowercase |
53 |
use errioipsl |
use errioipsl, only: histerr |
54 |
|
|
55 |
CHARACTER(LEN=*), INTENT(IN):: str |
CHARACTER(LEN=*), INTENT(IN):: str |
56 |
|
|
57 |
INTEGER:: leng, ipos |
! Local: |
58 |
CHARACTER(LEN=10):: str10 |
INTEGER leng, ipos |
59 |
|
CHARACTER(LEN=10) str10 |
60 |
!-------------------------------------------------------------------- |
!-------------------------------------------------------------------- |
61 |
|
|
62 |
! 1.0 Clean up the sring ! |
CALL strlowercase(str) |
|
|
|
|
CALL strlowercase (str) |
|
63 |
|
|
64 |
IF (.NOT.lock_unan) THEN |
IF (.NOT.lock_unan) THEN |
|
|
|
65 |
lock_unan=.TRUE. |
lock_unan=.TRUE. |
66 |
|
|
67 |
SELECT CASE(str) |
SELECT CASE(str) |
105 |
ipos = INDEX(str, 'd') |
ipos = INDEX(str, 'd') |
106 |
IF (ipos == 4) THEN |
IF (ipos == 4) THEN |
107 |
READ(str(1:3), '(I3)') leng |
READ(str(1:3), '(I3)') leng |
108 |
IF ( (MOD(leng, 12) == 0).AND.(leng > 1) ) THEN |
IF ((MOD(leng, 12) == 0).AND.(leng > 1)) THEN |
109 |
calendar_used = str |
calendar_used = str |
110 |
un_an = leng |
un_an = leng |
111 |
mon_len(:) = leng |
mon_len(:) = leng |