16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
73 use dc_message, only: messagenotify
74 use dc_string, only: lchar
75 use dc_trace, only: beginsub, endsub
78 implicit none
79 character(*), intent(in):: cal_type
80
81
82
83 type(DC_CAL), intent(out), optional, target:: cal
84
85
86
87
88 logical, intent(out), optional:: err
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107 type(DC_CAL), pointer:: calp =>null()
108 integer:: stat
109 character(STRING):: cause_c
110 character(*), parameter:: version = &
111 & '$Name: $' // &
112 & '$Id: dccalcreate.f90,v 1.4 2009-10-18 12:02:32 morikawa Exp $'
113 character(*), parameter:: subname = 'DCCalCreate1'
114continue
115 call beginsub( subname, version )
117 cause_c = ''
118
119
120
121
122 if ( present( cal ) ) then
123 calp => cal
124 else
126 end if
127
128
129
130
131
132
133
134
135
136
137
138
139
140 select case( lchar(trim(cal_type)) )
141 case('cyclic')
143 case('noleap')
145 case('julian')
147 case('gregorian')
149 case('360day')
151 case default
153 call messagenotify('W', subname, &
154 & 'cal_type=<%c> is invalid calender type.', &
155 & c1 = trim(cal_type) )
156 goto 999
157 end select
158
159
160
161
162 allocate( calp % day_in_month(1:12) )
163 calp % month_in_year = 12
164 calp % hour_in_day = 24
165 calp % min_in_hour = 60
166 calp % sec_in_min = 60.0_dp
167
168 select case( calp % cal_type )
170 calp % day_in_month(1:12) = &
171 & (/ 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 30 /)
173 calp % day_in_month(1:12) = &
174 & (/ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 /)
176 calp % day_in_month(1:12) = &
177 & (/ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 /)
179 calp % day_in_month(1:12) = &
180 & (/ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 /)
182 calp % day_in_month(1:12) = &
183 & (/ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 /)
184 case default
185 end select
186
187
188
189
190 calp % initialized = .true.
191999 continue
192 nullify( calp )
193 call storeerror( stat, subname, err, cause_c )
194 call endsub( subname )
type(dc_cal), target, save, public default_cal
integer, parameter, public cal_julian
integer, parameter, public cal_gregorian
integer, parameter, public cal_360day
integer, parameter, public cal_noleap
integer, parameter, public cal_cyclic
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_ealreadyinit
integer, parameter, public dc_noerr
integer, parameter, public dc_ebadcaltype
Provides kind type parameter values.
integer, parameter, public dp
Double Precision Real number
integer, parameter, public string
Character length for string