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

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

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


Revision 1.2 - (hide annotations) (download)
Tue Sep 23 04:34:24 2003 UTC (20 years, 8 months ago) by dimitri
Branch: MAIN
Changes since 1.1: +9 -9 lines
o Mods and bug fixes to pkg/cal and pkg/exf needed for computation
  of tracer Green's fucntions for ocean inversion project.

1 dimitri 1.2 C $Header: /u/gcmpack/MITgcm/pkg/cal/cal_checkdate.F,v 1.1 2001/05/14 22:07:26 heimbach Exp $
2 heimbach 1.1
3     #include "CAL_CPPOPTIONS.h"
4    
5     subroutine cal_CheckDate(
6     I date,
7     O valid,
8     O calerr,
9     I mythid
10     & )
11    
12     c ==================================================================
13     c SUBROUTINE cal_CheckDate
14     c ==================================================================
15     c
16     c o Check whether the array date conforms with the required format.
17     c
18     c started: Christian Eckert eckert@mit.edu 30-Jun-1999
19     c
20     c changed: Christian Eckert eckert@mit.edu 29-Dec-1999
21     c
22     c - restructured the original version in order to have a
23     c better interface to the MITgcmUV.
24     c
25     c Christian Eckert eckert@mit.edu 03-Feb-2000
26     c
27     c - Introduced new routine and function names, cal_<NAME>,
28     c for verion 0.1.3.
29     c
30 dimitri 1.2 c 21-Sep-2003: fixed check_sign logic to work with
31     c negative intervals (menemenlis@jpl.nasa.gov)
32     c
33 heimbach 1.1 c ==================================================================
34     c SUBROUTINE cal_CheckDate
35     c ==================================================================
36    
37     implicit none
38    
39     c == global variables ==
40    
41     #include "cal.h"
42    
43     c == routine arguments ==
44    
45     integer date(4)
46     logical valid
47     integer calerr
48     integer mythid
49    
50     c == local variables ==
51    
52     integer yy,mm,dd
53     integer nsecs
54     integer lp,wd
55     integer hhmmss
56     integer yymmdd
57     integer fac
58 dimitri 1.2 _RL check_sign
59 heimbach 1.1
60     c == end of interface ==
61    
62     valid = .true.
63     hhmmss = 0
64     calerr = 0
65     fac = 1
66    
67     if (date(4) .le. 0) then
68     if (date(4) .ne. -1) then
69     calerr = 1801
70     else
71     if (date(3) .ne. 0) then
72     calerr = 1802
73     else
74 dimitri 1.2 check_sign = sign(1,dble(date(1))*dble(date(2)))
75     if (check_sign .lt. 0) then
76 heimbach 1.1 calerr = 1803
77     else
78     call cal_ConvDate(date,yy,mm,dd,nsecs,lp,wd,mythid)
79     if (nsecs .lt. 0) fac = -1
80     hhmmss = fac*nsecs/secondsperminute
81     hhmmss = hhmmss/minutesperhour*10000 +
82     & mod(hhmmss,minutesperhour)*100 +
83     & mod(fac*nsecs,secondsperminute)
84     hhmmss = fac*hhmmss
85     if (date(2) .ne. hhmmss) then
86     calerr = 1804
87     endif
88     endif
89     endif
90     endif
91     else
92     if (date(4) .gt. 8) then
93     calerr = 1805
94     else
95     if ((date(3) .ne. 1) .and.
96     & (date(3) .ne. 2)) then
97     calerr = 1806
98     else
99 dimitri 1.2 check_sign = sign(1,dble(date(1))*dble(date(2)))
100     if (check_sign .lt. 0) then
101 heimbach 1.1 calerr = 1803
102     else
103     call cal_ConvDate( date,yy,mm,dd,nsecs,lp,wd,mythid )
104     if (date(1) .lt. refdate(1)) then
105     calerr = 1807
106     else
107     hhmmss = nsecs/secondsperminute
108     hhmmss = hhmmss/minutesperhour*10000 +
109     & mod(hhmmss,minutesperhour)*100 +
110     & mod(nsecs,secondsperminute)
111     endif
112     if (date(2) .ne. hhmmss) then
113     calerr = 1804
114     endif
115     yymmdd = yy*10000 + mm*100 + dd
116     if (date(1) .ne. yymmdd) then
117     calerr = 1808
118     endif
119     endif
120     endif
121     endif
122     endif
123    
124     if (calerr .ne. 0) valid = .not. valid
125    
126     return
127     end
128    

  ViewVC Help
Powered by ViewVC 1.1.22