1 |
C $Header: /u/gcmpack/development/heimbach/ecco_env/pkg/cal/cal_printerror.F,v 1.4 2001/02/02 16:57:22 heimbach Exp $ |
2 |
|
3 |
#include "CAL_CPPOPTIONS.h" |
4 |
|
5 |
subroutine cal_PrintError( |
6 |
I calerr, |
7 |
I mythid |
8 |
& ) |
9 |
|
10 |
c ================================================================== |
11 |
c SUBROUTINE cal_PrintError |
12 |
c ================================================================== |
13 |
c |
14 |
c Purpose: Use the MITgcmuv's print routines to document errors that |
15 |
c occured during the execution of the calendar tool. |
16 |
c |
17 |
c o Calling this routine allows to print out an error message for |
18 |
c several errors that might occur. |
19 |
c |
20 |
c The error codes for the calendar tool are specified by a four |
21 |
c digit integer: |
22 |
c RRCC |
23 |
c |
24 |
c The RR digits identify the routine that detected the error. |
25 |
c The CC digits identify the specific error in the routine that |
26 |
c detected the error. |
27 |
c |
28 |
c RR translates to routines in the following way: |
29 |
c |
30 |
c cal_Init 0 |
31 |
c cal_Set 1 |
32 |
c cal_GetDate 2 |
33 |
c cal_FullDate 3 |
34 |
c cal_IsLeap 4 |
35 |
c cal_TimePassed 5 |
36 |
c cal_AddTime 6 |
37 |
c cal_TimeInterval 7 |
38 |
c cal_SubDates 8 |
39 |
c cal_ConvDate 9 |
40 |
c cal_ToSeconds 10 |
41 |
c cal_StepsPerDay 11 |
42 |
c cal_DaysPerMonth 12 |
43 |
c cal_MonthsPerYear 13 |
44 |
c cal_IntYears 14 |
45 |
c cal_IntMonths 15 |
46 |
c cal_IntDays 16 |
47 |
c cal_nStepDay 17 |
48 |
c cal_CheckDate 18 |
49 |
c cal_PrintError 19 |
50 |
c cal_PrintDate 20 |
51 |
c cal_NumInts 25 |
52 |
c |
53 |
c |
54 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
55 |
c |
56 |
c changed: Christian Eckert eckert@mit.edu 29-Dec-1999 |
57 |
c |
58 |
c Christian Eckert eckert@mit.edu 10-Jan-2000 |
59 |
c |
60 |
c - Corrected the print statement for error code 104. |
61 |
c It contained more than 72 characters in one line. |
62 |
c |
63 |
c Christian Eckert eckert@mit.edu 03-Feb-2000 |
64 |
c |
65 |
c - Introduced new routine and function names, cal_<NAME>, |
66 |
c for verion 0.1.3. |
67 |
c |
68 |
c Christian Eckert eckert@mit.edu 24-Feb-2000 |
69 |
c |
70 |
c - Included cal_NumInts error code. |
71 |
c |
72 |
c ================================================================== |
73 |
c SUBROUTINE cal_PrintError |
74 |
c ================================================================== |
75 |
|
76 |
implicit none |
77 |
|
78 |
c == global variables == |
79 |
|
80 |
#include "EEPARAMS.h" |
81 |
|
82 |
c == routine arguments == |
83 |
|
84 |
c mythid - thread number for this instance of the routine. |
85 |
c calerr - error code |
86 |
|
87 |
integer mythid |
88 |
integer calerr |
89 |
|
90 |
c == local variables == |
91 |
|
92 |
integer nroutine |
93 |
integer nerrcode |
94 |
logical missingerrcode |
95 |
|
96 |
c == end of interface == |
97 |
|
98 |
nerrcode = mod(calerr,100) |
99 |
nroutine = (calerr - nerrcode)/100 |
100 |
missingerrcode = .false. |
101 |
|
102 |
if (nroutine .eq. 0) then |
103 |
c Error in cal_Init |
104 |
|
105 |
if (nerrcode .eq. 1) then |
106 |
print*, |
107 |
& ' cal_Init: Unable to open calendar parameter file' |
108 |
print*, |
109 |
& ' file "data.calendar".' |
110 |
endif |
111 |
|
112 |
else if (nroutine .eq. 1) then |
113 |
c Error in cal_Set |
114 |
|
115 |
if (nerrcode .eq. 1) then |
116 |
print*, |
117 |
& ' cal_Set: No appropriate calendar has been specified.' |
118 |
else if (nerrcode .eq. 2) then |
119 |
print*, |
120 |
& ' cal_Set: The time step specified is not valid.' |
121 |
else if (nerrcode .eq. 3) then |
122 |
print*, |
123 |
& ' cal_Set: The time step is less than a second.' |
124 |
else if (nerrcode .eq. 4) then |
125 |
print*, |
126 |
& ' cal_Set: The time step contains fractions of a', |
127 |
& ' second.' |
128 |
else if (nerrcode .eq. 5) then |
129 |
print*, |
130 |
& ' cal_Set: Less than one time step per calendar day.' |
131 |
else if (nerrcode .eq. 6) then |
132 |
print*, |
133 |
& ' cal_Set: The specifications are incomplete. Please' |
134 |
print*, |
135 |
& ' refer to the documentation.' |
136 |
else if (nerrcode .eq. 7) then |
137 |
print*, |
138 |
& ' cal_Set: The final date of integration is before its' |
139 |
print*, |
140 |
& ' start date.' |
141 |
else if (nerrcode .eq. 10) then |
142 |
print*, |
143 |
& ' cal_Set: The Julian Calendar is not implemented yet.' |
144 |
else if (nerrcode .eq. 11) then |
145 |
print*, |
146 |
& ' cal_Set: The No Calendar case is not implemented yet.' |
147 |
else if ( nerrcode .eq. 12) then |
148 |
print*, |
149 |
& ' cal_Set: modelstart .ne. startTime ... please check.' |
150 |
else if ( nerrcode .eq. 13 ) then |
151 |
print*, |
152 |
& ' cal_Set: modelend .ne. endTime ... please check.' |
153 |
else if ( nerrcode .eq. 14 ) then |
154 |
print*, |
155 |
& ' cal_Set: modelstep .ne. deltaTclock ... please check.' |
156 |
else if ( nerrcode .eq. 15 ) then |
157 |
print*, |
158 |
& ' cal_Set: modeliter0 .ne. nIter0 ... please check.' |
159 |
else if ( nerrcode .eq. 16 ) then |
160 |
print*, |
161 |
& ' cal_Set: modeliterend .ne. nEndIter ... please check.' |
162 |
else if ( nerrcode .eq. 17 ) then |
163 |
print*, |
164 |
& ' cal_Set: modelintsteps .ne. nTimeSteps', |
165 |
& ' ... please check.' |
166 |
else |
167 |
missingerrcode = .true. |
168 |
endif |
169 |
|
170 |
else if (nroutine .eq. 2) then |
171 |
c Error in cal_GetDate |
172 |
|
173 |
missingerrcode = .true. |
174 |
|
175 |
else if (nroutine .eq. 3) then |
176 |
c Error in cal_FullDate |
177 |
|
178 |
missingerrcode = .true. |
179 |
|
180 |
else if (nroutine .eq. 4) then |
181 |
c Error in cal_IsLeap |
182 |
|
183 |
missingerrcode = .true. |
184 |
|
185 |
else if (nroutine .eq. 5) then |
186 |
c Error in cal_TimePassed |
187 |
|
188 |
if (nerrcode .eq. 1) then |
189 |
print*, |
190 |
& ' cal_TimePassed: calendar and timeinterval cannot', |
191 |
& ' be compared.' |
192 |
else |
193 |
missingerrcode = .true. |
194 |
endif |
195 |
|
196 |
else if (nroutine .eq. 6) then |
197 |
c Error in cal_AddTime |
198 |
|
199 |
if (nerrcode .eq. 1) then |
200 |
print*, |
201 |
& ' cal_AddTime: not a valid time interval.' |
202 |
else |
203 |
missingerrcode = .true. |
204 |
endif |
205 |
|
206 |
else if (nroutine .eq. 7) then |
207 |
c Error in cal_TimeInterval |
208 |
|
209 |
if (nerrcode .eq. 1) then |
210 |
print*, |
211 |
& ' cal_TimeInterval: not a valid time unit.' |
212 |
else |
213 |
missingerrcode = .true. |
214 |
endif |
215 |
|
216 |
else if (nroutine .eq. 8) then |
217 |
c Error in cal_SubDates |
218 |
|
219 |
if (nerrcode .eq. 1) then |
220 |
print*, |
221 |
& ' cal_SubDates: Not a valid combination of calendar dates' |
222 |
print*, |
223 |
& ' or time intervals.' |
224 |
else |
225 |
missingerrcode = .true. |
226 |
endif |
227 |
|
228 |
else if (nroutine .eq. 9) then |
229 |
c Error in cal_ConvDate |
230 |
|
231 |
if (nerrcode .eq. 1) then |
232 |
print*, |
233 |
& ' cal_ConvDate: date specification has mixed signs.' |
234 |
else |
235 |
missingerrcode = .true. |
236 |
endif |
237 |
|
238 |
else if (nroutine .eq. 10) then |
239 |
c Error in cal_ToSeconds |
240 |
|
241 |
if (nerrcode .eq. 1) then |
242 |
print*, |
243 |
& ' cal_ToSeconds: input not a time interval array.' |
244 |
else |
245 |
missingerrcode = .true. |
246 |
endif |
247 |
|
248 |
else if (nroutine .eq. 11) then |
249 |
c Error in cal_StepsPerDay |
250 |
|
251 |
if (nerrcode .eq. 1) then |
252 |
print*, |
253 |
& ' cal_StepsPerDay: nothing else to do.' |
254 |
else |
255 |
missingerrcode = .true. |
256 |
endif |
257 |
|
258 |
else if (nroutine .eq. 12) then |
259 |
c Error in cal_DaysPerMonth |
260 |
|
261 |
if (nerrcode .eq. 1) then |
262 |
print*, |
263 |
& ' cal_DaysPerMonth: current year after final year.' |
264 |
else |
265 |
missingerrcode = .true. |
266 |
endif |
267 |
|
268 |
else if (nroutine .eq. 13) then |
269 |
c Error in cal_MonthsPerYear |
270 |
|
271 |
missingerrcode = .true. |
272 |
|
273 |
else if (nroutine .eq. 14) then |
274 |
c Error in cal_IntYears |
275 |
|
276 |
missingerrcode = .true. |
277 |
|
278 |
else if (nroutine .eq. 15) then |
279 |
c Error in cal_IntMonths |
280 |
|
281 |
missingerrcode = .true. |
282 |
|
283 |
else if (nroutine .eq. 16) then |
284 |
c Error in cal_IntDays |
285 |
|
286 |
missingerrcode = .true. |
287 |
|
288 |
else if (nroutine .eq. 17) then |
289 |
c Error in cal_nStepDay |
290 |
|
291 |
missingerrcode = .true. |
292 |
|
293 |
else if (nroutine .eq. 18) then |
294 |
c Error in cal_CheckDate |
295 |
|
296 |
if (nerrcode .eq. 0) then |
297 |
print*, |
298 |
& ' cal_CheckDate: A valid date specification!' |
299 |
print*, |
300 |
& ' --> This only means that the format is ok!' |
301 |
else if (nerrcode .eq. 1) then |
302 |
print*, |
303 |
& ' cal_CheckDate: Last component of array not valid!' |
304 |
else if (nerrcode .eq. 2) then |
305 |
print*, |
306 |
& ' cal_CheckDate: Third component of interval array', |
307 |
& ' not zero!' |
308 |
else if (nerrcode .eq. 3) then |
309 |
print*, |
310 |
& ' cal_CheckDate: Signs of first two components unequal!' |
311 |
else if (nerrcode .eq. 4) then |
312 |
print*, |
313 |
& ' cal_CheckDate: Second component not in hhmmss format!' |
314 |
else if (nerrcode .eq. 5) then |
315 |
print*, |
316 |
& ' cal_CheckDate: Weekday indentifier not correct!' |
317 |
else if (nerrcode .eq. 6) then |
318 |
print*, |
319 |
& ' cal_CheckDate: Leap year identifier not correct!' |
320 |
else if (nerrcode .eq. 7) then |
321 |
print*, |
322 |
& ' cal_CheckDate: Calendar date before predefined reference', |
323 |
& ' date!' |
324 |
else if (nerrcode .eq. 8) then |
325 |
print*, |
326 |
& ' cal_CheckDate: First component not in yymmdd format!' |
327 |
else |
328 |
missingerrcode = .true. |
329 |
endif |
330 |
|
331 |
else if (nroutine .eq. 19) then |
332 |
c Error in cal_PrintError |
333 |
|
334 |
missingerrcode = .true. |
335 |
|
336 |
else if (nroutine .eq. 20) then |
337 |
c Error in cal_PrintDate |
338 |
|
339 |
if (nerrcode .eq. 1) then |
340 |
print*, |
341 |
& ' cal_PrintDate: date not a legal calendar array.' |
342 |
else |
343 |
missingerrcode = .true. |
344 |
endif |
345 |
|
346 |
else if (nroutine .eq. 21) then |
347 |
c Error in cal_PrintError |
348 |
|
349 |
missingerrcode = .true. |
350 |
|
351 |
else if (nroutine .eq. 25) then |
352 |
c Error in cal_NumInts |
353 |
|
354 |
if (nerrcode .eq. 1) then |
355 |
print*, |
356 |
& ' cal_NumInts: Expected a time interval as third argument.' |
357 |
else |
358 |
missingerrcode = .true. |
359 |
endif |
360 |
|
361 |
else |
362 |
missingerrcode = .true. |
363 |
endif |
364 |
|
365 |
if (missingerrcode) then |
366 |
print*,' cal_PrintError: routine called by an undefined' |
367 |
print*,' error code.' |
368 |
print*,' cal_PrintError: error code = ',calerr |
369 |
stop ' stopped in cal_PrintError.' |
370 |
endif |
371 |
|
372 |
return |
373 |
end |
374 |
|