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

Contents of /MITgcm/pkg/cal/cal_timeinterval.F

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


Revision 1.2 - (show annotations) (download)
Tue Oct 7 16:35:04 2003 UTC (20 years, 8 months ago) by dimitri
Branch: MAIN
CVS Tags: checkpoint51j_post, checkpoint51i_pre
Changes since 1.1: +3 -3 lines
fix for large model integration periods

1 C $Header: /usr/local/gcmpack/MITgcm/pkg/cal/cal_timeinterval.F,v 1.1 2001/05/14 22:07:27 heimbach Exp $
2
3 #include "CAL_CPPOPTIONS.h"
4
5 subroutine cal_TimeInterval(
6 I timeint,
7 I timeunit,
8 O date,
9 I mythid
10 & )
11
12 c ==================================================================
13 c SUBROUTINE cal_TimeInterval
14 c ==================================================================
15 c
16 c o Create an array in date format given a time interval measured in
17 c units of timeunit.
18 c
19 c Available time units: 'secs'
20 c 'model'
21 c
22 c Fractions of seconds are not resolved in this version.
23 c
24 c started: Christian Eckert eckert@mit.edu 30-Jun-1999
25 c
26 c changed: Christian Eckert eckert@mit.edu 29-Dec-1999
27 c
28 c - restructured the original version in order to have a
29 c better interface to the MITgcmUV.
30 c
31 c Christian Eckert eckert@mit.edu 03-Feb-2000
32 c
33 c - Introduced new routine and function names, cal_<NAME>,
34 c for verion 0.1.3.
35 c
36 c ==================================================================
37 c SUBROUTINE cal_TimeInterval
38 c ==================================================================
39
40 implicit none
41
42 c == global variables ==
43
44 #include "cal.h"
45
46 c == routine arguments ==
47
48 integer date(4)
49 _RL timeint
50 character*(*) timeunit
51 integer mythid
52
53 c == local variables ==
54
55 integer fac
56 integer nsecs
57 integer hhmmss
58 integer ierr
59
60 c == end of interface ==
61
62 fac = 1
63 if (timeint .lt. 0) fac = -1
64
65 date(4) = -1
66 date(3) = 0
67 if (timeunit .eq. 'secs') then
68
69 date(1) = int(timeint/float(secondsperday))
70 nsecs = int(timeint - float(date(1)) * float(secondsperday))
71
72 else if (timeunit .eq. 'model') then
73
74 date(1) = int(timeint*modelstep/float(secondsperday))
75 nsecs = int(timeint*modelstep -
76 & float(date(1)) * float(secondsperday))
77
78 else
79
80 ierr = 701
81 call cal_PrintError( ierr, mythid )
82 stop ' stopped in cal_TimeInterval.'
83
84 endif
85
86 hhmmss = nsecs/secondsperminute
87 date(2) = hhmmss/minutesperhour*10000 +
88 & (mod(fac*hhmmss,minutesperhour)*100 +
89 & mod(fac*nsecs,secondsperminute))*fac
90
91 return
92 end

  ViewVC Help
Powered by ViewVC 1.1.22