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

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

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


Revision 1.7 - (hide annotations) (download)
Thu Apr 5 22:01:47 2012 UTC (12 years, 1 month 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 jmc 1.7 C $Header: /u/gcmpack/MITgcm/pkg/cal/cal_printerror.F,v 1.6 2012/04/03 15:26:00 jmc Exp $
2 edhill 1.2 C $Name: $
3 heimbach 1.1
4 edhill 1.2 #include "CAL_OPTIONS.h"
5 heimbach 1.1
6     subroutine cal_PrintError(
7     I calerr,
8     I mythid
9     & )
10    
11     c ==================================================================
12     c SUBROUTINE cal_PrintError
13     c ==================================================================
14     c
15 heimbach 1.3 c Purpose: Use the MITgcmuvs print routines to document errors that
16 heimbach 1.1 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 jmc 1.7 C == global variables ==
80 heimbach 1.1
81     #include "EEPARAMS.h"
82 heimbach 1.5 #include "SIZE.h"
83     #include "PARAMS.h"
84 heimbach 1.1
85 jmc 1.7 C == routine arguments ==
86 heimbach 1.1
87 jmc 1.7 C mythid - thread number for this instance of the routine.
88     C calerr - error code
89 heimbach 1.1
90     integer mythid
91     integer calerr
92    
93 jmc 1.7 C == local variables ==
94 heimbach 1.1
95     integer nroutine
96     integer nerrcode
97     logical missingerrcode
98 heimbach 1.5 CHARACTER*(MAX_LEN_MBUF) msgBuf
99 heimbach 1.1
100 jmc 1.7 C == end of interface ==
101 heimbach 1.1
102     nerrcode = mod(calerr,100)
103     nroutine = (calerr - nerrcode)/100
104     missingerrcode = .false.
105    
106 jmc 1.7 c if (nroutine .eq. 0) then
107     C Error in cal_Init
108 heimbach 1.1
109 jmc 1.7 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 heimbach 1.1
120 jmc 1.7 c else if (nroutine .eq. 1) then
121     if (nroutine .eq. 1) then
122     C Error in cal_Set
123 heimbach 1.1
124     if (nerrcode .eq. 1) then
125 jmc 1.6 WRITE(msgBuf,'(A)')
126 heimbach 1.1 & ' cal_Set: No appropriate calendar has been specified.'
127 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
128     CALL PRINT_ERROR( msgBuf , 1)
129 heimbach 1.1 else if (nerrcode .eq. 2) then
130 jmc 1.6 WRITE(msgBuf,'(A)')
131 heimbach 1.1 & ' cal_Set: The time step specified is not valid.'
132 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
133     CALL PRINT_ERROR( msgBuf , 1)
134 heimbach 1.1 else if (nerrcode .eq. 3) then
135 jmc 1.6 WRITE(msgBuf,'(A)')
136 heimbach 1.1 & ' cal_Set: The time step is less than a second.'
137 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
138     CALL PRINT_ERROR( msgBuf , 1)
139 heimbach 1.1 else if (nerrcode .eq. 4) then
140 jmc 1.6 WRITE(msgBuf,'(A)')
141 heimbach 1.5 & ' 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 jmc 1.6 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 heimbach 1.1 else
206     missingerrcode = .true.
207     endif
208    
209     else if (nroutine .eq. 2) then
210 jmc 1.7 C Error in cal_GetDate
211 heimbach 1.1
212     missingerrcode = .true.
213    
214     else if (nroutine .eq. 3) then
215 jmc 1.7 C Error in cal_FullDate
216 heimbach 1.1
217     missingerrcode = .true.
218    
219     else if (nroutine .eq. 4) then
220 jmc 1.7 C Error in cal_IsLeap
221 heimbach 1.1
222     missingerrcode = .true.
223    
224     else if (nroutine .eq. 5) then
225 jmc 1.7 C Error in cal_TimePassed
226 heimbach 1.1
227     if (nerrcode .eq. 1) then
228 jmc 1.6 WRITE(msgBuf,'(A)')
229 heimbach 1.5 & 'cal_TimePassed: cal and timeinterval cannot be compared'
230     CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
231     CALL PRINT_ERROR( msgBuf , 1)
232 heimbach 1.1 else
233     missingerrcode = .true.
234     endif
235    
236     else if (nroutine .eq. 6) then
237 jmc 1.7 C Error in cal_AddTime
238 heimbach 1.1
239     if (nerrcode .eq. 1) then
240 jmc 1.6 WRITE(msgBuf,'(A)')
241 heimbach 1.1 & ' cal_AddTime: not a valid time interval.'
242 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
243     CALL PRINT_ERROR( msgBuf , 1)
244 heimbach 1.1 else
245     missingerrcode = .true.
246     endif
247    
248     else if (nroutine .eq. 7) then
249 jmc 1.7 C Error in cal_TimeInterval
250 heimbach 1.1
251     if (nerrcode .eq. 1) then
252 jmc 1.6 WRITE(msgBuf,'(A)')
253 heimbach 1.1 & ' cal_TimeInterval: not a valid time unit.'
254 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
255     CALL PRINT_ERROR( msgBuf , 1)
256 heimbach 1.1 else
257     missingerrcode = .true.
258     endif
259    
260     else if (nroutine .eq. 8) then
261 jmc 1.7 C Error in cal_SubDates
262 heimbach 1.1
263     if (nerrcode .eq. 1) then
264 jmc 1.6 WRITE(msgBuf,'(A)')
265 heimbach 1.1 & ' cal_SubDates: Not a valid combination of calendar dates'
266 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
267     CALL PRINT_ERROR( msgBuf , 1)
268 jmc 1.6 WRITE(msgBuf,'(A)')
269 heimbach 1.1 & ' or time intervals.'
270 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
271     CALL PRINT_ERROR( msgBuf , 1)
272 heimbach 1.1 else
273     missingerrcode = .true.
274     endif
275    
276     else if (nroutine .eq. 9) then
277 jmc 1.7 C Error in cal_ConvDate
278 heimbach 1.1
279     if (nerrcode .eq. 1) then
280 jmc 1.6 WRITE(msgBuf,'(A)')
281 heimbach 1.1 & ' cal_ConvDate: date specification has mixed signs.'
282 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
283     CALL PRINT_ERROR( msgBuf , 1)
284 heimbach 1.1 else
285     missingerrcode = .true.
286     endif
287    
288     else if (nroutine .eq. 10) then
289 jmc 1.7 C Error in cal_ToSeconds
290 heimbach 1.1
291     if (nerrcode .eq. 1) then
292 jmc 1.6 WRITE(msgBuf,'(A)')
293 heimbach 1.1 & ' cal_ToSeconds: input not a time interval array.'
294 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
295     CALL PRINT_ERROR( msgBuf , 1)
296 heimbach 1.1 else
297     missingerrcode = .true.
298     endif
299    
300     else if (nroutine .eq. 11) then
301 jmc 1.7 C Error in cal_StepsPerDay
302 heimbach 1.1
303     if (nerrcode .eq. 1) then
304 jmc 1.6 WRITE(msgBuf,'(A)')
305 heimbach 1.1 & ' cal_StepsPerDay: nothing else to do.'
306 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
307     CALL PRINT_ERROR( msgBuf , 1)
308 heimbach 1.1 else
309     missingerrcode = .true.
310     endif
311    
312     else if (nroutine .eq. 12) then
313 jmc 1.7 C Error in cal_DaysPerMonth
314 heimbach 1.1
315     if (nerrcode .eq. 1) then
316 jmc 1.6 WRITE(msgBuf,'(A)')
317 heimbach 1.1 & ' cal_DaysPerMonth: current year after final year.'
318 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
319     CALL PRINT_ERROR( msgBuf , 1)
320 heimbach 1.1 else
321     missingerrcode = .true.
322     endif
323    
324     else if (nroutine .eq. 13) then
325 jmc 1.7 C Error in cal_MonthsPerYear
326 heimbach 1.1
327     missingerrcode = .true.
328    
329     else if (nroutine .eq. 14) then
330 jmc 1.7 C Error in cal_IntYears
331 heimbach 1.1
332     missingerrcode = .true.
333    
334     else if (nroutine .eq. 15) then
335 jmc 1.7 C Error in cal_IntMonths
336 heimbach 1.1
337     missingerrcode = .true.
338    
339     else if (nroutine .eq. 16) then
340 jmc 1.7 C Error in cal_IntDays
341 heimbach 1.1
342     missingerrcode = .true.
343    
344     else if (nroutine .eq. 17) then
345 jmc 1.7 C Error in cal_nStepDay
346 heimbach 1.1
347     missingerrcode = .true.
348    
349     else if (nroutine .eq. 18) then
350 jmc 1.7 C Error in cal_CheckDate
351 heimbach 1.1
352     if (nerrcode .eq. 0) then
353 jmc 1.6 WRITE(msgBuf,'(A)')
354 heimbach 1.1 & ' cal_CheckDate: A valid date specification!'
355 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
356     CALL PRINT_ERROR( msgBuf , 1)
357 jmc 1.6 WRITE(msgBuf,'(A)')
358 heimbach 1.1 & ' --> This only means that the format is ok!'
359 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
360     CALL PRINT_ERROR( msgBuf , 1)
361 heimbach 1.1 else if (nerrcode .eq. 1) then
362 jmc 1.6 WRITE(msgBuf,'(A)')
363 heimbach 1.1 & ' cal_CheckDate: Last component of array not valid!'
364 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
365     CALL PRINT_ERROR( msgBuf , 1)
366 heimbach 1.1 else if (nerrcode .eq. 2) then
367 jmc 1.6 WRITE(msgBuf,'(A)')
368 heimbach 1.5 & ' 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 heimbach 1.1 else if (nerrcode .eq. 3) then
372 jmc 1.6 WRITE(msgBuf,'(A)')
373 heimbach 1.1 & ' cal_CheckDate: Signs of first two components unequal!'
374 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
375     CALL PRINT_ERROR( msgBuf , 1)
376 heimbach 1.1 else if (nerrcode .eq. 4) then
377 jmc 1.6 WRITE(msgBuf,'(A)')
378 heimbach 1.1 & ' cal_CheckDate: Second component not in hhmmss format!'
379 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
380     CALL PRINT_ERROR( msgBuf , 1)
381 heimbach 1.1 else if (nerrcode .eq. 5) then
382 jmc 1.6 WRITE(msgBuf,'(A)')
383 heimbach 1.1 & ' cal_CheckDate: Weekday indentifier not correct!'
384 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
385     CALL PRINT_ERROR( msgBuf , 1)
386 heimbach 1.1 else if (nerrcode .eq. 6) then
387 jmc 1.6 WRITE(msgBuf,'(A)')
388 heimbach 1.1 & ' cal_CheckDate: Leap year identifier not correct!'
389 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
390     CALL PRINT_ERROR( msgBuf , 1)
391 heimbach 1.1 else if (nerrcode .eq. 7) then
392 jmc 1.6 WRITE(msgBuf,'(A)')
393 heimbach 1.5 & 'cal_CheckDate: Calendar date before predef. reference date'
394     CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
395     CALL PRINT_ERROR( msgBuf , 1)
396 heimbach 1.1 else if (nerrcode .eq. 8) then
397 jmc 1.6 WRITE(msgBuf,'(A)')
398 heimbach 1.1 & ' cal_CheckDate: First component not in yymmdd format!'
399 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
400     CALL PRINT_ERROR( msgBuf , 1)
401 heimbach 1.1 else
402     missingerrcode = .true.
403     endif
404    
405     else if (nroutine .eq. 19) then
406 jmc 1.7 C Error in cal_PrintError
407 heimbach 1.1
408     missingerrcode = .true.
409    
410     else if (nroutine .eq. 20) then
411 jmc 1.7 C Error in cal_PrintDate
412 heimbach 1.1
413     if (nerrcode .eq. 1) then
414 jmc 1.6 WRITE(msgBuf,'(A)')
415 heimbach 1.1 & ' cal_PrintDate: date not a legal calendar array.'
416 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
417     CALL PRINT_ERROR( msgBuf , 1)
418 heimbach 1.1 else
419     missingerrcode = .true.
420     endif
421    
422     else if (nroutine .eq. 21) then
423 jmc 1.7 C Error in cal_PrintError
424 heimbach 1.1
425     missingerrcode = .true.
426    
427     else if (nroutine .eq. 25) then
428 jmc 1.7 C Error in cal_NumInts
429 heimbach 1.1
430     if (nerrcode .eq. 1) then
431 jmc 1.6 WRITE(msgBuf,'(A)')
432 heimbach 1.1 & ' cal_NumInts: Expected a time interval as third argument.'
433 heimbach 1.5 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
434     CALL PRINT_ERROR( msgBuf , 1)
435 heimbach 1.1 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