/[MITgcm]/MITgcm/pkg/ecco/cost_readers.F
ViewVC logotype

Contents of /MITgcm/pkg/ecco/cost_readers.F

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


Revision 1.16 - (show annotations) (download)
Sat Oct 18 18:15:44 2014 UTC (9 years, 7 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65p, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65g
Changes since 1.15: +3 -1 lines
- add CPP brackets around includes, to omit
  them altogether when they are not used.

1 C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_readers.F,v 1.15 2014/06/09 17:47:57 gforget Exp $
2 C $Name: $
3
4 #include "ECCO_OPTIONS.h"
5
6
7 subroutine cost_readers( irec, mythid )
8
9 c ==================================================================
10 c SUBROUTINE cost_readers
11 c ==================================================================
12 c
13 c o Read a given record of the ERS SSH data.
14 c
15 c started: Christian Eckert eckert@mit.edu 25-May-1999
16 c
17 c changed: Christian Eckert eckert@mit.edu 25-Feb-2000
18 c
19 c - Restructured the code in order to create a package
20 c for the MITgcmUV.
21 c
22 c ==================================================================
23 c SUBROUTINE cost_readers
24 c ==================================================================
25
26 implicit none
27
28 c == global variables ==
29
30 #ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION
31 #include "EEPARAMS.h"
32 #include "SIZE.h"
33 #include "PARAMS.h"
34 #include "GRID.h"
35
36 #include "cal.h"
37 #include "ecco_cost.h"
38 #endif
39
40 c == routine arguments ==
41
42 integer irec
43 integer mythid
44
45 #ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION
46 c == local variables ==
47
48 integer bi,bj
49 integer i,j,k
50 integer itlo,ithi
51 integer jtlo,jthi
52 integer jmin,jmax
53 integer imin,imax
54 integer sshrec
55 integer difftime(4)
56 integer tempDate_1
57 integer middate(4)
58 integer noffset
59 _RL diffsecs
60 _RL spval
61 _RL factor
62
63 cnew(
64 integer il
65 _RL daytime
66 integer dayiter
67 integer daydate(4)
68 integer yday, ymod
69 integer md, dd, sd, ld, wd
70 character*(80) fnametmp
71 logical exst
72 cnew)
73
74 c == external functions ==
75
76 integer ilnblnk
77 external ilnblnk
78
79 c == end of interface ==
80
81 jtlo = mybylo(mythid)
82 jthi = mybyhi(mythid)
83 itlo = mybxlo(mythid)
84 ithi = mybxhi(mythid)
85 jmin = 1
86 jmax = sny
87 imin = 1
88 imax = snx
89
90 factor = 0.01 _d 0
91 spval = -9990. _d 0
92
93 cnew(
94 daytime = FLOAT(secondsperday*(irec-1)) + modelstart
95 dayiter = hoursperday*(irec-1)+modeliter0
96 call cal_getdate( dayiter, daytime, daydate, mythid )
97 call cal_convdate( daydate,yday,md,dd,sd,ld,wd,mythid )
98 ymod = ersstartdate(1)/10000
99
100 if ( ymod .GE. yday ) then
101 call cal_FullDate( ersstartdate(1), 0, middate, mythid)
102 else
103 tempDate_1 = yday*10000+100+1
104 call cal_FullDate( tempDate_1, 0, middate, mythid)
105 endif
106
107 call cal_TimePassed( middate, daydate, difftime, mythid )
108 call cal_ToSeconds( difftime, diffsecs, mythid )
109 c sshrec = floor(diffsecs/ersperiod) + 1
110 sshrec = int(diffsecs/ersperiod) + 1
111
112 il=ilnblnk(ersfile)
113 write(fnametmp(1:80),'(2a,i4)')
114 & ersfile(1:il), '_', yday
115 inquire( file=fnametmp, exist=exst )
116 if (.NOT. exst) then
117 write(fnametmp(1:80),'(a)') ersfile(1:il)
118 call cal_TimePassed(ersstartdate,daydate,difftime,mythid)
119 call cal_ToSeconds( difftime, diffsecs, mythid )
120 c sshrec = floor(diffsecs/ersperiod) + 1
121 sshrec = int(diffsecs/ersperiod) + 1
122 inquire( file=fnametmp, exist=exst )
123 endif
124
125 cnew)
126
127 c read data:
128 if ( (sshrec .GT. 0).AND.(exst) ) then
129 call mdsreadfield( fnametmp, cost_iprec, cost_yftype, 1, ersobs,
130 & sshrec, mythid )
131 else
132 do bj = jtlo,jthi
133 do bi = itlo,ithi
134 do j = jmin,jmax
135 do i = imin,imax
136 ersobs(i,j,bi,bj) = spval
137 enddo
138 enddo
139 enddo
140 enddo
141 endif
142
143 do bj = jtlo,jthi
144 do bi = itlo,ithi
145 k = 1
146 do j = jmin,jmax
147 do i = imin,imax
148 if (_hFacC(i,j,k,bi,bj) .eq. 0.) then
149 ersmask(i,j,bi,bj) = 0. _d 0
150 else
151 ersmask(i,j,bi,bj) = 1. _d 0
152 endif
153 if (ersobs(i,j,bi,bj) .le. spval) then
154 ersmask(i,j,bi,bj) = 0. _d 0
155 endif
156 if (abs(ersobs(i,j,bi,bj)) .lt. 1.d-8 ) then
157 ersmask(i,j,bi,bj) = 0. _d 0
158 endif
159
160 #ifndef ALLOW_SHALLOW_ALTIMETRY
161 if ( R_low(i,j,bi,bj) .GT. -200. ) then
162 ersmask(i,j,bi,bj) = 0. _d 0
163 endif
164 #endif
165 #ifndef ALLOW_HIGHLAT_ALTIMETRY
166 if ( abs(YC(i,j,bi,bj)) .GT. 66. ) then
167 ersmask(i,j,bi,bj) = 0. _d 0
168 endif
169 #endif
170
171 ersmask(i,j,bi,bj) = ersmask(i,j,bi,bj)*frame(i,j)
172 ersobs(i,j,bi,bj) = ersmask(i,j,bi,bj)*factor*
173 & ( ersobs(i,j,bi,bj) -
174 & ( ersintercept + ersslope*irec*hoursperday ) )
175 enddo
176 enddo
177 enddo
178 enddo
179
180 #endif
181
182 return
183 end

  ViewVC Help
Powered by ViewVC 1.1.22