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

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

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


Revision 1.6 - (hide annotations) (download)
Sun Apr 8 19:22:34 2012 UTC (12 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint64, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, 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, HEAD
Changes since 1.5: +15 -35 lines
minor changes (change check_sign to logical wrong_sign; move output
 arguments previously in "local variables" section).

1 jmc 1.6 C $Header: /u/gcmpack/MITgcm/pkg/cal/cal_convdate.F,v 1.5 2012/04/07 16:21:05 jmc Exp $
2 edhill 1.4 C $Name: $
3 heimbach 1.1
4 edhill 1.4 #include "CAL_OPTIONS.h"
5 heimbach 1.1
6 jmc 1.5 SUBROUTINE CAL_CONVDATE(
7 heimbach 1.1 I date,
8     O yy, mm, dd, ss,
9     O lp, wd,
10 jmc 1.5 I myThid )
11 heimbach 1.1
12 jmc 1.5 C ==================================================================
13     C SUBROUTINE cal_ConvDate
14     C ==================================================================
15     C
16     C o Decompose the first part of a date array.
17     C
18     C started: Christian Eckert eckert@mit.edu 30-Jun-1999
19     C changed: Christian Eckert eckert@mit.edu 29-Dec-1999
20     C - restructured the original version in order to have a
21     C better interface to the MITgcmUV.
22     C Christian Eckert eckert@mit.edu 03-Feb-2000
23     C - Introduced new routine and function names, cal_<NAME>,
24     C for verion 0.1.3.
25     C 21-Sep-2003: fixed check_sign logic to work with
26     C negative intervals (menemenlis@jpl.nasa.gov)
27     C
28     C ==================================================================
29     C SUBROUTINE cal_ConvDate
30     C ==================================================================
31 heimbach 1.1
32 jmc 1.5 IMPLICIT NONE
33 heimbach 1.1
34 jmc 1.5 C == global variables ==
35     #include "EEPARAMS.h"
36 heimbach 1.1 #include "cal.h"
37    
38 jmc 1.5 C == routine arguments ==
39     INTEGER date(4)
40 jmc 1.6 INTEGER yy, mm, dd
41     INTEGER ss, lp, wd
42 jmc 1.5 INTEGER myThid
43    
44     C == local variables ==
45     INTEGER fac
46     INTEGER date_1
47     INTEGER date_2
48     INTEGER ierr
49 jmc 1.6 LOGICAL wrong_sign
50 jmc 1.5 CHARACTER*(MAX_LEN_MBUF) msgBuf
51     C == end of interface ==
52    
53     IF ( cal_setStatus .LT. 1 ) THEN
54     WRITE( msgBuf,'(2A,4I9)') 'CAL_CONVDATE: ',
55     & 'date=',date(1),date(2),date(3),date(4)
56     CALL PRINT_ERROR( msgBuf, myThid )
57     WRITE( msgBuf,'(2A,I2,A)') 'CAL_CONVDATE: ',
58     & 'called too early (cal_setStatus=',cal_setStatus,' )'
59     CALL PRINT_ERROR( msgBuf, myThid )
60     STOP 'ABNORMAL END: S/R CAL_CONVDATE'
61     ENDIF
62 heimbach 1.1
63 jmc 1.6 C Check the sign of the date.
64 heimbach 1.1 fac = 1
65 jmc 1.6 wrong_sign = ( (date(1).lt.0) .and. date(2).gt.0 )
66     & .OR. ( (date(1).gt.0) .and. date(2).lt.0 )
67 heimbach 1.1
68 jmc 1.6 if ( wrong_sign ) then
69     ierr = 901
70     call cal_PrintError( ierr, myThid )
71     stop ' stopped in cal_ConvDate.'
72     else
73     if ( date(1).lt.0 .OR. date(2).lt.0 ) then
74 heimbach 1.1 date_1 = -date(1)
75     date_2 = -date(2)
76     fac = -1
77     else
78     date_1 = date(1)
79     date_2 = date(2)
80     fac = 1
81     endif
82     endif
83    
84 jmc 1.5 C Decompose the entries.
85 heimbach 1.1 if (date(4) .ne. -1) then
86     yy = date_1/10000
87     mm = mod(date_1/100,100)
88     dd = mod(date_1,100)
89     else
90     yy = 0
91     mm = 0
92     dd = date_1
93     endif
94     ss = mod(date_2,100) +
95 jmc 1.6 & mod(date_2/100,100)*secondsPerMinute +
96     & date_2/10000*secondsPerHour
97 heimbach 1.1
98 jmc 1.5 C Include the sign.
99 heimbach 1.1 yy = fac*yy
100     mm = fac*mm
101     dd = fac*dd
102     ss = fac*ss
103    
104     lp = date(3)
105     wd = date(4)
106    
107 jmc 1.5 RETURN
108     END

  ViewVC Help
Powered by ViewVC 1.1.22