1 |
C $Header: /u/gcmpack/MITgcm/pkg/cal/cal_fulldate.F,v 1.3 2004/04/19 23:25:15 mlosch Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CAL_OPTIONS.h" |
5 |
|
6 |
SUBROUTINE CAL_FULLDATE( |
7 |
I yymmdd, |
8 |
I hhmmss, |
9 |
O date, |
10 |
I myThid ) |
11 |
|
12 |
C ================================================================== |
13 |
C SUBROUTINE cal_FullDate |
14 |
C ================================================================== |
15 |
C |
16 |
C o Set a date array given the year, month, day, hour, minute, |
17 |
C and second. Check the input for errors. |
18 |
C |
19 |
C started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
20 |
C changed: Christian Eckert eckert@mit.edu 29-Dec-1999 |
21 |
C - restructured the original version in order to have a |
22 |
C better interface to the MITgcmUV. |
23 |
C Christian Eckert eckert@mit.edu 03-Feb-2000 |
24 |
C - Introduced new routine and function names, cal_<NAME>, |
25 |
C for verion 0.1.3. |
26 |
C |
27 |
C ================================================================== |
28 |
C SUBROUTINE cal_FullDate |
29 |
C ================================================================== |
30 |
|
31 |
IMPLICIT NONE |
32 |
|
33 |
C == global variables == |
34 |
#include "EEPARAMS.h" |
35 |
#include "cal.h" |
36 |
|
37 |
C == routine arguments == |
38 |
C myThid - thread number for this instance of the routine. |
39 |
INTEGER yymmdd |
40 |
INTEGER hhmmss |
41 |
INTEGER date(4) |
42 |
INTEGER myThid |
43 |
|
44 |
C == functions == |
45 |
INTEGER cal_IsLeap |
46 |
EXTERNAL cal_IsLeap |
47 |
|
48 |
C == local variables == |
49 |
INTEGER theyear |
50 |
INTEGER numberofdays(4) |
51 |
INTEGER calerr |
52 |
LOGICAL valid |
53 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
54 |
C == end of interface == |
55 |
|
56 |
date(1) = yymmdd |
57 |
date(2) = hhmmss |
58 |
date(3) = 1 |
59 |
date(4) = 1 |
60 |
|
61 |
IF ( cal_setStatus .LT. 1 ) THEN |
62 |
WRITE( msgBuf,'(A,2(A,I9))') 'CAL_FULLDATE: ', |
63 |
& 'yymmdd=',yymmdd,' , hhmmss=',hhmmss |
64 |
CALL PRINT_ERROR( msgBuf, myThid ) |
65 |
WRITE( msgBuf,'(2A,I2,A)') 'CAL_FULLDATE: ', |
66 |
& 'called too early (cal_setStatus=',cal_setStatus,' )' |
67 |
CALL PRINT_ERROR( msgBuf, myThid ) |
68 |
STOP 'ABNORMAL END: S/R CAL_FULLDATE' |
69 |
ENDIF |
70 |
|
71 |
C Check the input for obvious errors. |
72 |
call cal_CheckDate( date, valid, calerr, myThid ) |
73 |
|
74 |
if (valid) then |
75 |
C Determine whether we are in a leap year or not. |
76 |
theyear = yymmdd/10000 |
77 |
date(3) = cal_IsLeap( theyear, myThid ) |
78 |
|
79 |
C Determine the day of the week. |
80 |
call cal_TimePassed( refdate, date, numberofdays, myThid ) |
81 |
date(4) = mod(numberofdays(1),7)+1 |
82 |
else |
83 |
call cal_PrintError( calerr, myThid ) |
84 |
cml if you want the CheckDate error to stop the model uncomment |
85 |
cml the following line, otherwise there is just going to be a |
86 |
cml warning. |
87 |
cml stop ' stopped in cal_FullDate' |
88 |
endif |
89 |
|
90 |
RETURN |
91 |
END |