/[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.3 - (hide annotations) (download)
Tue Sep 23 04:34:25 2003 UTC (20 years, 8 months ago) by dimitri
Branch: MAIN
Changes since 1.2: +8 -7 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.3 C $Header: /u/gcmpack/MITgcm/pkg/cal/cal_toseconds.F,v 1.2 2002/12/19 13:12:42 cheisey 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.3 _RL 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.3 check_sign = sign(1,dble(date(1))*dble(date(2)))
70 cheisey 1.2 if (((date(4) .eq. -1) .and.
71 heimbach 1.1 & (date(3) .eq. 0) .and.
72 dimitri 1.3 & (check_sign .ge. 0)) .or.
73 cheisey 1.2 & usingModelCalendar) then
74 heimbach 1.1 if ((date(1) .lt. 0) .or.
75     & (date(2) .lt. 0)) then
76     ndays = -date(1)
77     hhmmss = -date(2)
78     fac = -1
79     else
80     ndays = date(1)
81     hhmmss = date(2)
82     fac = 1
83     endif
84     nsecs = ndays*secondsperday +
85     & (hhmmss/10000)*secondsperhour +
86     & mod(hhmmss/100,100)*secondsperminute +
87     & mod(hhmmss,100)
88     timeint = fac*nsecs
89     else
90    
91     ierr = 1001
92     call cal_PrintError( ierr, mythid )
93     stop ' stopped in cal_ToSeconds.'
94    
95     endif
96    
97     return
98     end

  ViewVC Help
Powered by ViewVC 1.1.22