1 |
C $Header: /u/gcmpack/development/heimbach/ecco_env/pkg/cal/cal_monthsperyear.F,v 1.4 2001/02/02 16:57:22 heimbach Exp $ |
2 |
|
3 |
#include "CAL_CPPOPTIONS.h" |
4 |
|
5 |
subroutine cal_MonthsPerYear( |
6 |
I myiter, |
7 |
I mytime, |
8 |
O nmonths, |
9 |
I mythid |
10 |
& ) |
11 |
|
12 |
c ================================================================== |
13 |
c SUBROUTINE cal_MonthsPerYear |
14 |
c ================================================================== |
15 |
c |
16 |
c o Given the iteration number during the integration and/or the |
17 |
c currenttime of integration return the number of months left in |
18 |
c the current calendar year including the one containing |
19 |
c currenttime/iter. |
20 |
c |
21 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
22 |
c |
23 |
c changed: Christian Eckert eckert@mit.edu 29-Dec-1999 |
24 |
c |
25 |
c - restructured the original version in order to have a |
26 |
c better interface to the MITgcmUV. |
27 |
c |
28 |
c Christian Eckert eckert@mit.edu 03-Feb-2000 |
29 |
c |
30 |
c - Introduced new routine and function names, cal_<NAME>, |
31 |
c for verion 0.1.3. |
32 |
c |
33 |
c ================================================================== |
34 |
c SUBROUTINE cal_MonthsPerYear |
35 |
c ================================================================== |
36 |
|
37 |
implicit none |
38 |
|
39 |
c == global variables == |
40 |
|
41 |
#include "cal.h" |
42 |
|
43 |
c == routine arguments == |
44 |
|
45 |
integer myiter |
46 |
_RL mytime |
47 |
integer nmonths |
48 |
integer mythid |
49 |
|
50 |
c == local variables == |
51 |
|
52 |
integer mydate(4) |
53 |
integer present |
54 |
integer final |
55 |
|
56 |
c == end of interface == |
57 |
|
58 |
call cal_GetDate( myiter, mytime, mydate, mythid ) |
59 |
|
60 |
present = mydate(1)/10000 |
61 |
final = modelenddate(1)/10000 |
62 |
|
63 |
if (present .eq. final) then |
64 |
present = mod(mydate(1)/100,100) |
65 |
final = mod(modelenddate(1)/100,100) |
66 |
ce nmonths = final - present + 1 |
67 |
else |
68 |
present = mod(mydate(1)/100,100) |
69 |
final = nmonthyear |
70 |
ce nmonths = nmonthyear - mod(mydate(1)/100,100) + 1 |
71 |
endif |
72 |
nmonths = final - present + 1 |
73 |
|
74 |
return |
75 |
end |