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

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

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


Revision 1.4 - (hide annotations) (download)
Sat Apr 7 16:21:05 2012 UTC (12 years, 1 month ago) by jmc
Branch: MAIN
Changes since 1.3: +61 -60 lines
stop if called before pkg/cal parameters were set.

1 jmc 1.4 C $Header: /u/gcmpack/MITgcm/pkg/cal/cal_fulldate.F,v 1.3 2004/04/19 23:25:15 mlosch Exp $
2 edhill 1.2 C $Name: $
3 heimbach 1.1
4 edhill 1.2 #include "CAL_OPTIONS.h"
5 heimbach 1.1
6 jmc 1.4 SUBROUTINE CAL_FULLDATE(
7 heimbach 1.1 I yymmdd,
8     I hhmmss,
9     O date,
10 jmc 1.4 I myThid )
11 heimbach 1.1
12 jmc 1.4 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 heimbach 1.1
31 jmc 1.4 IMPLICIT NONE
32 heimbach 1.1
33 jmc 1.4 C == global variables ==
34     #include "EEPARAMS.h"
35 heimbach 1.1 #include "cal.h"
36    
37 jmc 1.4 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 heimbach 1.1
56     date(1) = yymmdd
57     date(2) = hhmmss
58     date(3) = 1
59     date(4) = 1
60    
61 jmc 1.4 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 heimbach 1.1
74     if (valid) then
75 jmc 1.4 C Determine whether we are in a leap year or not.
76 heimbach 1.1 theyear = yymmdd/10000
77 jmc 1.4 date(3) = cal_IsLeap( theyear, myThid )
78 heimbach 1.1
79 jmc 1.4 C Determine the day of the week.
80     call cal_TimePassed( refdate, date, numberofdays, myThid )
81 heimbach 1.1 date(4) = mod(numberofdays(1),7)+1
82 mlosch 1.3 else
83 jmc 1.4 call cal_PrintError( calerr, myThid )
84 mlosch 1.3 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 heimbach 1.1 endif
89    
90 jmc 1.4 RETURN
91     END

  ViewVC Help
Powered by ViewVC 1.1.22