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

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

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


Revision 1.4 - (hide annotations) (download)
Tue Sep 23 06:33:45 2003 UTC (20 years, 8 months ago) by dimitri
Branch: MAIN
CVS Tags: checkpoint51f_post, checkpoint51j_post, checkpoint51h_pre, branchpoint-genmake2, checkpoint51i_pre, checkpoint51g_post
Branch point for: branch-genmake2
Changes since 1.3: +7 -3 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.4 C $Header: /usr/local/gcmpack/MITgcm/pkg/cal/cal_toseconds.F,v 1.3 2003/09/23 04:34:25 dimitri Exp $
2 heimbach 1.1
3     #include "CAL_CPPOPTIONS.h"
4    
5     subroutine cal_ToSeconds(
6     I date,
7     O timeint,
8     I mythid
9     & )
10    
11     c ==================================================================
12     c SUBROUTINE cal_ToSeconds
13     c ==================================================================
14     c
15     c o Given a time interval as a date array return the number of
16     c seconds in that time interval.
17     c
18     c If one wanted to use calendar dates in this routine, then
19     c the date should be after the calendar's refdate and timeint
20     c would be the number of seconds that have elapsed since the
21     c refdate. Of course this can also be done by first calling
22 dimitri 1.3 c sub cal_TimePassed and then calling this routine with the
23 heimbach 1.1 c resulting time interval array.
24     c
25     c started: Christian Eckert eckert@mit.edu 30-Jun-1999
26     c
27     c changed: Christian Eckert eckert@mit.edu 29-Dec-1999
28     c
29     c - restructured the original version in order to have a
30     c better interface to the MITgcmUV.
31     c
32     c Christian Eckert eckert@mit.edu 03-Feb-2000
33     c
34     c - Introduced new routine and function names, cal_<NAME>,
35     c for verion 0.1.3.
36     c
37 dimitri 1.3 c 21-Sep-2003: fixed check_sign logic to work with
38     c negative intervals (menemenlis@jpl.nasa.gov)
39     c
40 heimbach 1.1 c ==================================================================
41     c SUBROUTINE cal_ToSeconds
42     c ==================================================================
43    
44     implicit none
45    
46     c == global variables ==
47    
48     #include "cal.h"
49    
50     c == routine arguments ==
51    
52     integer date(4)
53     _RL timeint
54     integer mythid
55    
56     c == local variables ==
57    
58     integer fac
59     integer ndays
60     integer nsecs
61     integer hhmmss
62     integer ierr
63 dimitri 1.4 integer check_sign
64 heimbach 1.1
65     c == end of interface ==
66 cheisey 1.2 c print *,'cal_toseconds: date',date
67     c print *,'cal_toseconds: timeint',timeint
68 heimbach 1.1
69 dimitri 1.4 check_sign = 1
70     if ( ( (date(1).lt.0) .and. date(2).gt.0 ) .or.
71     & ( (date(1).gt.0) .and. date(2).lt.0 ) )
72     & check_sign = -1
73    
74 cheisey 1.2 if (((date(4) .eq. -1) .and.
75 heimbach 1.1 & (date(3) .eq. 0) .and.
76 dimitri 1.3 & (check_sign .ge. 0)) .or.
77 cheisey 1.2 & usingModelCalendar) then
78 heimbach 1.1 if ((date(1) .lt. 0) .or.
79     & (date(2) .lt. 0)) then
80     ndays = -date(1)
81     hhmmss = -date(2)
82     fac = -1
83     else
84     ndays = date(1)
85     hhmmss = date(2)
86     fac = 1
87     endif
88     nsecs = ndays*secondsperday +
89     & (hhmmss/10000)*secondsperhour +
90     & mod(hhmmss/100,100)*secondsperminute +
91     & mod(hhmmss,100)
92     timeint = fac*nsecs
93     else
94    
95     ierr = 1001
96     call cal_PrintError( ierr, mythid )
97     stop ' stopped in cal_ToSeconds.'
98    
99     endif
100    
101     return
102     end

  ViewVC Help
Powered by ViewVC 1.1.22