/[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.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: +7 -6 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_convdate.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_ConvDate(
6     I date,
7     O yy, mm, dd, ss,
8     O lp, wd,
9     I mythid
10     & )
11    
12     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
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_ConvDate
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     integer mythid
47    
48     c == local variables ==
49    
50     integer yy
51     integer mm
52     integer dd
53     integer ss
54     integer lp
55     integer wd
56     integer fac
57     integer date_1
58     integer date_2
59     integer ierr
60 dimitri 1.2 _RL check_sign
61 heimbach 1.1
62     c == end of interface ==
63    
64     fac = 1
65    
66     c Check the sign of the date.
67    
68 dimitri 1.2 check_sign = sign(1,dble(date(1))*dble(date(2)))
69 heimbach 1.1
70 dimitri 1.2 if ( check_sign .ge. 0 ) then
71 heimbach 1.1 if (date(1) .eq. 0) then
72     date_1 = date(1)
73     if (date(2) .lt. 0) then
74     date_2 = -date(2)
75     fac = -1
76     else
77     date_2 = date(2)
78     fac = 1
79     endif
80     else if (date(1) .lt. 0) then
81     date_1 = -date(1)
82     date_2 = -date(2)
83     fac = -1
84     else
85     date_1 = date(1)
86     date_2 = date(2)
87     fac = 1
88     endif
89     else
90    
91     ierr = 901
92     call cal_PrintError( ierr, mythid )
93     stop ' stopped in cal_ConvDate.'
94    
95     endif
96    
97     c Decompose the entries.
98     if (date(4) .ne. -1) then
99     yy = date_1/10000
100     mm = mod(date_1/100,100)
101     dd = mod(date_1,100)
102     else
103     yy = 0
104     mm = 0
105     dd = date_1
106     endif
107     ss = mod(date_2,100) +
108     & mod(date_2/100,100)*secondsperminute +
109     & date_2/10000*secondsperhour
110    
111     c Include the sign.
112     yy = fac*yy
113     mm = fac*mm
114     dd = fac*dd
115     ss = fac*ss
116    
117     lp = date(3)
118     wd = date(4)
119    
120     return
121     end
122    

  ViewVC Help
Powered by ViewVC 1.1.22