/[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.7 - (show annotations) (download)
Mon Jun 3 22:27:03 2013 UTC (10 years, 11 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65o, checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, HEAD
Changes since 1.6: +2 -2 lines
More fixes.

1 C $Header: /u/gcmpack/MITgcm/pkg/cal/cal_timeinterval.F,v 1.6 2013/06/03 22:07:58 heimbach Exp $
2 C $Name: $
3
4 #include "CAL_OPTIONS.h"
5
6 SUBROUTINE CAL_TIMEINTERVAL(
7 I timeint,
8 I timeunit,
9 O date,
10 I myThid )
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 Available time units: 'secs'
19 C 'model'
20 C Fractions of seconds are not resolved in this version.
21 C
22 C started: Christian Eckert eckert@mit.edu 30-Jun-1999
23 C changed: Christian Eckert eckert@mit.edu 29-Dec-1999
24 C - restructured the original version in order to have a
25 C better interface to the MITgcmUV.
26 C Christian Eckert eckert@mit.edu 03-Feb-2000
27 C - Introduced new routine and function names, cal_<NAME>,
28 C for verion 0.1.3.
29 C
30 C ==================================================================
31 C SUBROUTINE cal_TimeInterval
32 C ==================================================================
33
34 IMPLICIT NONE
35
36 C == global variables ==
37 #include "EEPARAMS.h"
38 #include "cal.h"
39
40 C == routine arguments ==
41 INTEGER date(4)
42 _RL timeint
43 CHARACTER*(*) timeunit
44 INTEGER myThid
45
46 C == local variables ==
47 INTEGER fac
48 INTEGER nsecs
49 INTEGER hhmmss
50 INTEGER ierr
51 _RL tmp1, tmp2
52 CHARACTER*(MAX_LEN_MBUF) msgBuf
53 C == end of interface ==
54
55 fac = 1
56 if (timeint .lt. 0) fac = -1
57
58 date(4) = -1
59 date(3) = 0
60 if (timeunit .eq. 'secs') then
61
62 IF ( cal_setStatus .LT. 1 ) THEN
63 WRITE( msgBuf,'(2A,F19.2,2A)') 'CAL_TIMEINTERVAL: ',
64 & 'timeint=',timeint,' , timeunit=',timeunit
65 CALL PRINT_ERROR( msgBuf, myThid )
66 WRITE( msgBuf,'(2A,I2,A)') 'CAL_TIMEINTERVAL: ',
67 & 'called too early (cal_setStatus=',cal_setStatus,' )'
68 CALL PRINT_ERROR( msgBuf, myThid )
69 STOP 'ABNORMAL END: S/R CAL_TIMEINTERVAL'
70 ENDIF
71 date(1) = int(timeint/float(secondsperday))
72 tmp1 = date(1)
73 tmp2 = secondsperday
74 nsecs = int(timeint - tmp1 * tmp2 )
75
76 else if (timeunit .eq. 'model') then
77
78 IF ( cal_setStatus .LT. 2 ) THEN
79 WRITE( msgBuf,'(2A,F15.2,2A)') 'CAL_TIMEINTERVAL: ',
80 & 'timeint=',timeint,' , timeunit=',timeunit
81 CALL PRINT_ERROR( msgBuf, myThid )
82 WRITE( msgBuf,'(2A,I2,A)') 'CAL_TIMEINTERVAL: ',
83 & 'called too early (cal_setStatus=',cal_setStatus,' )'
84 CALL PRINT_ERROR( msgBuf, myThid )
85 STOP 'ABNORMAL END: S/R CAL_TIMEINTERVAL'
86 ENDIF
87 date(1) = int(timeint*modelstep/float(secondsperday))
88 nsecs = int(timeint*modelstep -
89 & float(date(1)) * float(secondsperday))
90
91 else
92
93 ierr = 701
94 call cal_PrintError( ierr, myThid )
95 stop ' stopped in cal_TimeInterval.'
96
97 endif
98
99 hhmmss = nsecs/secondsperminute
100 date(2) = hhmmss/minutesperhour*10000 +
101 & (mod(fac*hhmmss,minutesperhour)*100 +
102 & mod(fac*nsecs,secondsperminute))*fac
103
104 RETURN
105 END

  ViewVC Help
Powered by ViewVC 1.1.22