1 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_sla_read_yd.F,v 1.4 2013/02/05 14:51:09 gforget Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "ECCO_OPTIONS.h" |
5 |
|
6 |
|
7 |
subroutine cost_sla_read_yd( sla_file, sla_startdate, |
8 |
c I sla_startdate, sla_period, |
9 |
c I sla_intercept, sla_slope, |
10 |
O sla_obs, sla_mask, |
11 |
I year,day, mythid ) |
12 |
|
13 |
c ================================================================== |
14 |
c SUBROUTINE cost_sla_read_yd |
15 |
c ================================================================== |
16 |
c |
17 |
c o Read a given record of the SLA data. |
18 |
c |
19 |
c started: Gael Forget 20-Oct-2009 |
20 |
c |
21 |
c ================================================================== |
22 |
c SUBROUTINE cost_sla_read_yd |
23 |
c ================================================================== |
24 |
|
25 |
implicit none |
26 |
|
27 |
c == global variables == |
28 |
|
29 |
#include "EEPARAMS.h" |
30 |
#include "SIZE.h" |
31 |
#include "PARAMS.h" |
32 |
#include "GRID.h" |
33 |
|
34 |
#include "cal.h" |
35 |
#include "ecco_cost.h" |
36 |
|
37 |
c == routine arguments == |
38 |
|
39 |
integer year,day |
40 |
integer mythid |
41 |
|
42 |
integer sla_startdate(4) |
43 |
_RL sla_period |
44 |
_RL sla_intercept |
45 |
_RL sla_slope |
46 |
_RL sla_obs (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
47 |
_RL sla_mask (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
48 |
character*(MAX_LEN_FNAM) sla_file |
49 |
|
50 |
c == local variables == |
51 |
|
52 |
integer bi,bj |
53 |
integer i,j,k |
54 |
integer itlo,ithi |
55 |
integer jtlo,jthi |
56 |
integer jmin,jmax |
57 |
integer imin,imax |
58 |
integer sshrec |
59 |
integer difftime(4) |
60 |
integer middate(4) |
61 |
integer noffset |
62 |
_RL diffsecs |
63 |
_RL spval |
64 |
_RL factor |
65 |
|
66 |
cnew( |
67 |
integer il |
68 |
_RL daytime |
69 |
integer dayiter |
70 |
integer daydate(4) |
71 |
integer yday, ymod |
72 |
integer md, dd, sd, ld, wd |
73 |
character*(80) fnametmp |
74 |
logical exst |
75 |
cnew) |
76 |
|
77 |
c == external functions == |
78 |
|
79 |
integer ilnblnk |
80 |
external ilnblnk |
81 |
|
82 |
integer cal_IsLeap |
83 |
external cal_IsLeap |
84 |
|
85 |
c == end of interface == |
86 |
|
87 |
jtlo = mybylo(mythid) |
88 |
jthi = mybyhi(mythid) |
89 |
itlo = mybxlo(mythid) |
90 |
ithi = mybxhi(mythid) |
91 |
jmin = 1 |
92 |
jmax = sny |
93 |
imin = 1 |
94 |
imax = snx |
95 |
|
96 |
factor = 0.01 |
97 |
spval = -9990. |
98 |
|
99 |
if ( (day.GE.1).AND.( ( |
100 |
& (cal_IsLeap(year,mythid).eq.2).AND.(day.LE.366) |
101 |
& ).OR.(day.LE.365) ) ) then |
102 |
|
103 |
il=ilnblnk(sla_file) |
104 |
|
105 |
write(fnametmp(1:80),'(2a,i4)') |
106 |
& sla_file(1:il), '_', year |
107 |
inquire( file=fnametmp, exist=exst ) |
108 |
if (.NOT. exst) then |
109 |
stop |
110 |
endif |
111 |
|
112 |
call mdsreadfield( fnametmp, cost_iprec, cost_yftype, 1, sla_obs, |
113 |
& day, mythid ) |
114 |
|
115 |
do bj = jtlo,jthi |
116 |
do bi = itlo,ithi |
117 |
k = 1 |
118 |
do j = jmin,jmax |
119 |
do i = imin,imax |
120 |
|
121 |
if (_hFacC(i,j,k,bi,bj) .eq. 0.) then |
122 |
sla_mask(i,j,bi,bj) = 0. _d 0 |
123 |
else |
124 |
sla_mask(i,j,bi,bj) = 1. _d 0 |
125 |
endif |
126 |
if (sla_obs(i,j,bi,bj) .le. spval) then |
127 |
sla_mask(i,j,bi,bj) = 0. _d 0 |
128 |
endif |
129 |
if (abs(sla_obs(i,j,bi,bj)) .lt. 1.d-8 ) then |
130 |
sla_mask(i,j,bi,bj) = 0. _d 0 |
131 |
endif |
132 |
|
133 |
#ifndef ALLOW_SHALLOW_ALTIMETRY |
134 |
if ( R_low(i,j,bi,bj) .GT. -200. ) then |
135 |
sla_mask(i,j,bi,bj) = 0. _d 0 |
136 |
endif |
137 |
#endif |
138 |
#ifndef ALLOW_HIGHLAT_ALTIMETRY |
139 |
if ( abs(YC(i,j,bi,bj)) .GT. 66. ) then |
140 |
sla_mask(i,j,bi,bj) = 0. _d 0 |
141 |
endif |
142 |
#endif |
143 |
|
144 |
sla_mask(i,j,bi,bj) = sla_mask(i,j,bi,bj)*frame(i,j) |
145 |
sla_obs(i,j,bi,bj) = sla_mask(i,j,bi,bj)*factor* |
146 |
& sla_obs(i,j,bi,bj) |
147 |
|
148 |
enddo |
149 |
enddo |
150 |
enddo |
151 |
enddo |
152 |
|
153 |
else !if ( (day.GE.1).AND... |
154 |
|
155 |
do bj = jtlo,jthi |
156 |
do bi = itlo,ithi |
157 |
do j = jmin,jmax |
158 |
do i = imin,imax |
159 |
sla_obs(i,j,bi,bj) = 0. _d 0 |
160 |
sla_mask(i,j,bi,bj) = 0. _d 0 |
161 |
enddo |
162 |
enddo |
163 |
enddo |
164 |
enddo |
165 |
|
166 |
endif !if ( (day.GE.1).AND... |
167 |
|
168 |
return |
169 |
end |
170 |
|