/[MITgcm]/MITgcm/pkg/cal/cal_printerror.F
ViewVC logotype

Contents of /MITgcm/pkg/cal/cal_printerror.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.7 - (show annotations) (download)
Thu Apr 5 22:01:47 2012 UTC (12 years ago) by jmc
Branch: MAIN
CVS Tags: checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65t, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint64, checkpoint65, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint65o, checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f
Changes since 1.6: +43 -43 lines
update list of errors (comment out the retired ones)

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

  ViewVC Help
Powered by ViewVC 1.1.22