1 |
C $Header$ |
C $Header$ |
2 |
C $Name$ |
C $Name$ |
3 |
|
|
4 |
#include "COST_CPPOPTIONS.h" |
#include "ECCO_OPTIONS.h" |
5 |
|
|
6 |
|
|
7 |
subroutine cost_gencost_sshv4( |
subroutine cost_gencost_sshv4( |
44 |
#include "GRID.h" |
#include "GRID.h" |
45 |
|
|
46 |
#include "ecco_cost.h" |
#include "ecco_cost.h" |
47 |
|
#include "CTRL_SIZE.h" |
48 |
#include "ctrl.h" |
#include "ctrl.h" |
49 |
#include "ctrl_dummy.h" |
#include "ctrl_dummy.h" |
50 |
#include "optim.h" |
#include "optim.h" |
52 |
#ifdef ALLOW_PROFILES |
#ifdef ALLOW_PROFILES |
53 |
#include "profiles.h" |
#include "profiles.h" |
54 |
#endif |
#endif |
55 |
|
#include "cal.h" |
56 |
|
#ifdef ALLOW_SMOOTH |
57 |
|
#include "SMOOTH.h" |
58 |
|
#endif |
59 |
|
|
60 |
c == routine arguments == |
c == routine arguments == |
61 |
|
|
64 |
integer mythid |
integer mythid |
65 |
|
|
66 |
#ifdef ALLOW_SSH_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_COST_CONTRIBUTION |
|
#ifdef ALLOW_SMOOTH |
|
67 |
#ifdef ALLOW_GENCOST_CONTRIBUTION |
#ifdef ALLOW_GENCOST_CONTRIBUTION |
|
#ifdef ALLOW_GENCOST_FREEFORM |
|
68 |
c == local variables == |
c == local variables == |
69 |
|
|
70 |
integer bi,bj |
integer bi,bj |
82 |
|
|
83 |
c mapping to gencost |
c mapping to gencost |
84 |
integer igen_mdt, igen_lsc |
integer igen_mdt, igen_lsc |
85 |
integer igen_tp, igen_ers, igen_gfo |
integer igen_tp, igen_ers, igen_gfo |
86 |
|
|
87 |
_RL offset,fac |
_RL offset |
88 |
_RL offset_sum |
_RL offset_sum |
89 |
_RL psmean ( 1-olx:snx+olx, 1-oly:sny+oly, nsx, nsy ) |
_RL slaoffset |
90 |
|
_RL slaoffset_sum |
91 |
|
|
92 |
_RL diagnosfld ( 1-olx:snx+olx, 1-oly:sny+oly, nsx, nsy ) |
_RL diagnosfld ( 1-olx:snx+olx, 1-oly:sny+oly, nsx, nsy ) |
93 |
|
|
94 |
c for PART 1: re-reference MDT (tpmean) to the inferred SLA reference field |
c for PART 1: re-reference MDT (mdt) to the inferred SLA reference field |
95 |
_RL mean_slaobs(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL psmean ( 1-olx:snx+olx, 1-oly:sny+oly, nsx, nsy ) |
96 |
|
_RL mean_slaobs_mdt(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
97 |
_RL mean_slaobs_NUM(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL mean_slaobs_NUM(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
98 |
|
|
99 |
c for PART 2: compute time mean differences over the model period |
c for PART 2: compute time mean differences over the model period |
100 |
_RL mean_slaobs2(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL mean_slaobs_model(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
101 |
_RL mean_psMssh_all(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL mean_psMssh_all(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
102 |
_RL mean_psMssh_all_NUM(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL mean_psMssh_all_NUM(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
103 |
_RL mean_psMssh_all_MSK(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL mean_psMssh_all_MSK(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
104 |
|
|
105 |
|
_RL mean_psMslaobs(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
106 |
|
_RL mean_psMslaobs_MSK(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
107 |
|
|
108 |
_RL mean_psMtpobs(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL mean_psMtpobs(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
109 |
_RL mean_psMtpobs_NUM(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL mean_psMtpobs_NUM(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
|
_RL mean_psMtpobs_MSK(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
|
110 |
|
|
111 |
_RL mean_psMersobs(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL mean_psMersobs(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
112 |
_RL mean_psMersobs_NUM(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL mean_psMersobs_NUM(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
|
_RL mean_psMersobs_MSK(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
|
113 |
|
|
114 |
_RL mean_psMgfoobs(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL mean_psMgfoobs(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
115 |
_RL mean_psMgfoobs_NUM(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL mean_psMgfoobs_NUM(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
|
_RL mean_psMgfoobs_MSK(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
|
116 |
|
|
117 |
c for PART 4/5: compute smooth/raw anomalies |
c for PART 4/5: compute smooth/raw anomalies |
118 |
_RL anom_psMslaobs(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL anom_psMslaobs(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
|
_RL anom_slaobs (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
|
119 |
_RL anom_psMslaobs_NUM (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL anom_psMslaobs_NUM (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
120 |
|
_RL anom_psMslaobs_MSK (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
121 |
|
_RL anom_psMslaobs_SUB (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
122 |
|
_RL anom_slaobs (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
123 |
|
_RL anom_slaobs_SUB (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
124 |
|
|
125 |
_RL anom_psMtpobs(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL anom_psMtpobs(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
126 |
_RL anom_psMtpobs_NUM (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL anom_psMtpobs_NUM (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
134 |
_RL anom_psMgfoobs_NUM(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL anom_psMgfoobs_NUM(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
135 |
_RL anom_gfoobs(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL anom_gfoobs(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
136 |
|
|
137 |
integer tpmean_y0,tpmean_y1,year,day |
integer mdt_y0,mdt_y1,year,day |
138 |
integer num_var |
integer num_var, num0 |
139 |
|
|
140 |
_RL junk,junkweight |
_RL junk,junkweight |
141 |
|
|
146 |
character*(80) fname4test |
character*(80) fname4test |
147 |
character*(MAX_LEN_MBUF) msgbuf |
character*(MAX_LEN_MBUF) msgbuf |
148 |
|
|
149 |
|
LOGICAL doReference |
150 |
|
|
151 |
c == external functions == |
c == external functions == |
152 |
|
|
153 |
integer ilnblnk |
integer ilnblnk |
190 |
|
|
191 |
cgf ======================================================= |
cgf ======================================================= |
192 |
cgf PART 1: |
cgf PART 1: |
193 |
cgf x Get the MDT (tpmean) ... compute the sample mean |
cgf x Get the MDT (mdt) ... compute the sample mean |
194 |
cgf (mean_slaobs) of the SLA data (i.e. RADS for tp, ers, and gfo |
cgf (mean_slaobs_mdt) of the SLA data (i.e. RADS for tp, ers, and gfo |
195 |
cgf together) over the time interval of the MDT ... subtract |
cgf together) over the time interval of the MDT ... subtract |
196 |
cgf mean_slaobs from tpmean. |
cgf mean_slaobs_mdt from mdt. |
197 |
cgf x At this point, tpmean is the inferred SLA reference field. |
cgf x At this point, mdt is the inferred SLA reference field. |
198 |
cgf x From there on, tpmean+sla will be directly comparable to |
cgf x From there on, mdt+sla will be directly comparable to |
199 |
cgf the model SSH (psbar). |
cgf the model SSH (psbar). |
200 |
cgf ======================================================= |
cgf ======================================================= |
201 |
|
|
202 |
c-- Read mean field and mask |
c-- Read mean field and mask |
203 |
call cost_ReadTopexMean( mythid ) |
call cost_ReadTopexMean( mythid ) |
204 |
|
|
205 |
c-- Compute mean_slaobs: sample mean SLA over the time period of tpmean. |
c-- Compute mean_slaobs_mdt: sample mean SLA over the time period of mdt. |
206 |
|
|
207 |
c pavlis and ecco/rio |
c pavlis and ecco/rio |
208 |
tpmean_y0=1993 |
c mdt_y0=1993 |
209 |
tpmean_y1=2004 |
c mdt_y1=2004 |
210 |
c maximenko |
c maximenko |
211 |
c tpmean_y0=1992 |
c mdt_y0=1992 |
212 |
c tpmean_y1=2002 |
c mdt_y1=2002 |
213 |
c rio |
c rio |
214 |
c tpmean_y0=1993 |
c mdt_y0=1993 |
215 |
c tpmean_y1=1999 |
c mdt_y1=1999 |
216 |
|
c generalized: |
217 |
|
mdt_y0=mdtstartdate(1)/10000 |
218 |
|
mdt_y1=mdtenddate(1)/10000 |
219 |
|
|
220 |
|
write(msgbuf,'(a,i8,a,i8)') |
221 |
|
& 'mdt[start,end]date(1): ',mdtstartdate(1), |
222 |
|
& ',',mdtenddate(1) |
223 |
|
call print_message( msgbuf, standardmessageunit, |
224 |
|
& SQUEEZE_RIGHT , mythid) |
225 |
|
|
226 |
|
write(msgbuf,'(a,i4,a,i4)') |
227 |
|
& ' TP MDT yrrange: ', |
228 |
|
& mdt_y0,',', |
229 |
|
& mdt_y1 |
230 |
|
call print_message( msgbuf, standardmessageunit, |
231 |
|
& SQUEEZE_RIGHT , mythid) |
232 |
|
|
233 |
|
c minimum number of observations to consider re-referenced MDT |
234 |
|
num0=100 |
235 |
|
|
236 |
|
doReference=.FALSE. |
237 |
|
if ((modelstartdate(1).GT.1992*10000).AND. |
238 |
|
& (modelstartdate(1).LT.2011*10000).AND. |
239 |
|
& (ndaysrec.GE.365)) doReference=.TRUE. |
240 |
|
|
241 |
|
write(msgbuf,'(a,l)') ' sshv4:re-reference MDT=',doReference |
242 |
|
call print_message( msgbuf, standardmessageunit, |
243 |
|
& SQUEEZE_RIGHT , mythid) |
244 |
|
|
245 |
do bj = jtlo,jthi |
do bj = jtlo,jthi |
246 |
do bi = itlo,ithi |
do bi = itlo,ithi |
247 |
do j = jmin,jmax |
do j = jmin,jmax |
248 |
do i = imin,imax |
do i = imin,imax |
249 |
mean_slaobs(i,j,bi,bj) = 0. _d 0 |
mean_slaobs_mdt(i,j,bi,bj) = 0. _d 0 |
250 |
mean_slaobs_NUM(i,j,bi,bj) = 0. _d 0 |
mean_slaobs_NUM(i,j,bi,bj) = 0. _d 0 |
251 |
enddo |
enddo |
252 |
enddo |
enddo |
253 |
enddo |
enddo |
254 |
enddo |
enddo |
255 |
|
|
256 |
do year=tpmean_y0,tpmean_y1 |
do year=mdt_y0,mdt_y1 |
257 |
do day=1,366 |
do day=1,366 |
258 |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
259 |
call cost_sla_read_yd( topexfile, |
call cost_sla_read_yd( topexfile, topexstartdate, |
260 |
& tpobs, tpmask, |
& tpobs, tpmask, |
261 |
& year, day, mythid ) |
& year, day, mythid ) |
262 |
#endif |
#endif |
263 |
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
264 |
call cost_sla_read_yd( ersfile, |
call cost_sla_read_yd( ersfile, ersstartdate, |
265 |
& ersobs, ersmask, |
& ersobs, ersmask, |
266 |
& year, day, mythid ) |
& year, day, mythid ) |
267 |
#endif |
#endif |
268 |
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
269 |
call cost_sla_read_yd( gfofile, |
call cost_sla_read_yd( gfofile, gfostartdate, |
270 |
& gfoobs, gfomask, |
& gfoobs, gfomask, |
271 |
& year, day, mythid ) |
& year, day, mythid ) |
272 |
#endif |
#endif |
275 |
do j = jmin,jmax |
do j = jmin,jmax |
276 |
do i = imin,imax |
do i = imin,imax |
277 |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
278 |
if ( tpmask(i,j,bi,bj)*tpmeanmask(i,j,bi,bj)* |
if ( tpmask(i,j,bi,bj)*mdtmask(i,j,bi,bj)* |
279 |
& gencost_weight(i,j,bi,bj,igen_tp) .NE. 0. ) then |
& gencost_weight(i,j,bi,bj,igen_tp) .NE. 0. ) then |
280 |
mean_slaobs(i,j,bi,bj)= mean_slaobs(i,j,bi,bj)+ |
mean_slaobs_mdt(i,j,bi,bj)= mean_slaobs_mdt(i,j,bi,bj)+ |
281 |
& tpobs(i,j,bi,bj) |
& tpobs(i,j,bi,bj) |
282 |
mean_slaobs_NUM(i,j,bi,bj)= mean_slaobs_NUM(i,j,bi,bj)+1. _d 0 |
mean_slaobs_NUM(i,j,bi,bj)= mean_slaobs_NUM(i,j,bi,bj)+1. _d 0 |
283 |
endif |
endif |
284 |
#endif |
#endif |
285 |
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
286 |
if ( ersmask(i,j,bi,bj)*tpmeanmask(i,j,bi,bj)* |
if ( ersmask(i,j,bi,bj)*mdtmask(i,j,bi,bj)* |
287 |
& gencost_weight(i,j,bi,bj,igen_ers) .NE. 0. ) then |
& gencost_weight(i,j,bi,bj,igen_ers) .NE. 0. ) then |
288 |
mean_slaobs(i,j,bi,bj)= mean_slaobs(i,j,bi,bj)+ |
mean_slaobs_mdt(i,j,bi,bj)= mean_slaobs_mdt(i,j,bi,bj)+ |
289 |
& ersobs(i,j,bi,bj) |
& ersobs(i,j,bi,bj) |
290 |
mean_slaobs_NUM(i,j,bi,bj)= mean_slaobs_NUM(i,j,bi,bj)+1. _d 0 |
mean_slaobs_NUM(i,j,bi,bj)= mean_slaobs_NUM(i,j,bi,bj)+1. _d 0 |
291 |
endif |
endif |
292 |
#endif |
#endif |
293 |
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
294 |
if ( gfomask(i,j,bi,bj)*tpmeanmask(i,j,bi,bj)* |
if ( gfomask(i,j,bi,bj)*mdtmask(i,j,bi,bj)* |
295 |
& gencost_weight(i,j,bi,bj,igen_gfo) .NE. 0. ) then |
& gencost_weight(i,j,bi,bj,igen_gfo) .NE. 0. ) then |
296 |
mean_slaobs(i,j,bi,bj)= mean_slaobs(i,j,bi,bj)+ |
mean_slaobs_mdt(i,j,bi,bj)= mean_slaobs_mdt(i,j,bi,bj)+ |
297 |
& gfoobs(i,j,bi,bj) |
& gfoobs(i,j,bi,bj) |
298 |
mean_slaobs_NUM(i,j,bi,bj)= mean_slaobs_NUM(i,j,bi,bj)+1. _d 0 |
mean_slaobs_NUM(i,j,bi,bj)= mean_slaobs_NUM(i,j,bi,bj)+1. _d 0 |
299 |
endif |
endif |
304 |
enddo |
enddo |
305 |
|
|
306 |
enddo !do day=1,366 |
enddo !do day=1,366 |
307 |
enddo !do year=tpmean_y0,tpmean_y1 |
enddo !do year=mdt_y0,mdt_y1 |
308 |
|
|
309 |
do bj = jtlo,jthi |
do bj = jtlo,jthi |
310 |
do bi = itlo,ithi |
do bi = itlo,ithi |
312 |
do i = imin,imax |
do i = imin,imax |
313 |
if ( ( mean_slaobs_NUM(i,j,bi,bj) .NE. 0. ).AND. |
if ( ( mean_slaobs_NUM(i,j,bi,bj) .NE. 0. ).AND. |
314 |
& ( maskc(i,j,1,bi,bj) .NE. 0. ).AND. |
& ( maskc(i,j,1,bi,bj) .NE. 0. ).AND. |
315 |
|
#ifndef ALLOW_HIGHLAT_ALTIMETRY |
316 |
& ( abs(YC(i,j,bi,bj)) .LE. 66. ).AND. |
& ( abs(YC(i,j,bi,bj)) .LE. 66. ).AND. |
317 |
& ( tpmeanmask(i,j,bi,bj) .NE. 0. ) ) then |
#endif |
318 |
mean_slaobs(i,j,bi,bj) = mean_slaobs(i,j,bi,bj) / |
& ( mdtmask(i,j,bi,bj) .NE. 0. ) ) then |
319 |
|
mean_slaobs_mdt(i,j,bi,bj) = |
320 |
|
& mean_slaobs_mdt(i,j,bi,bj) / |
321 |
& mean_slaobs_NUM(i,j,bi,bj) |
& mean_slaobs_NUM(i,j,bi,bj) |
322 |
else |
else |
323 |
mean_slaobs(i,j,bi,bj) = 0. _d 0 |
mean_slaobs_mdt(i,j,bi,bj) = 0. _d 0 |
324 |
endif |
endif |
325 |
enddo |
enddo |
326 |
enddo |
enddo |
328 |
enddo |
enddo |
329 |
|
|
330 |
|
|
331 |
c-- smooth mean_slaobs: |
c-- smooth mean_slaobs_mdt: |
332 |
|
|
333 |
write(fname4test(1:80),'(1a)') 'sla2mdt_raw' |
write(fname4test(1:80),'(1a)') 'sla2mdt_raw' |
334 |
call mdswritefield(fname4test,32,.false.,'RL', |
call mdswritefield(fname4test,32,.false.,'RL', |
335 |
& 1,mean_slaobs,1,1,mythid) |
& 1,mean_slaobs_mdt,1,1,mythid) |
336 |
|
|
337 |
call smooth_hetero2d(mean_slaobs,maskc, |
#ifdef ALLOW_SMOOTH |
338 |
& gencost_scalefile(igen_mdt),300,mythid) |
if ( useSMOOTH ) |
339 |
|
& call smooth_hetero2d(mean_slaobs_mdt,maskc, |
340 |
|
& gencost_scalefile(igen_mdt), |
341 |
|
& gencost_smooth2Ddiffnbt(igen_mdt),mythid) |
342 |
|
#endif |
343 |
|
|
344 |
write(fname4test(1:80),'(1a)') 'sla2mdt_smooth' |
write(fname4test(1:80),'(1a)') 'sla2mdt_smooth' |
345 |
call mdswritefield(fname4test,32,.false.,'RL', |
call mdswritefield(fname4test,32,.false.,'RL', |
346 |
& 1,mean_slaobs,1,1,mythid) |
& 1,mean_slaobs_mdt,1,1,mythid) |
347 |
|
|
348 |
c-- re-reference tpmean: |
c-- re-reference mdt: |
349 |
do bj = jtlo,jthi |
do bj = jtlo,jthi |
350 |
do bi = itlo,ithi |
do bi = itlo,ithi |
351 |
do j = jmin,jmax |
do j = jmin,jmax |
352 |
do i = imin,imax |
do i = imin,imax |
353 |
if ( ( tpmeanmask(i,j,bi,bj) .NE. 0. ).AND. |
if ( ( mdtmask(i,j,bi,bj) .NE. 0. ).AND. |
354 |
& ( maskc(i,j,1,bi,bj) .NE. 0. ) ) then |
& ( maskc(i,j,1,bi,bj) .NE. 0. ).AND. |
355 |
tpmean(i,j,bi,bj) = tpmean(i,j,bi,bj) |
& ( doReference ) ) then |
356 |
& -mean_slaobs(i,j,bi,bj) |
mdt(i,j,bi,bj) = mdt(i,j,bi,bj) |
357 |
|
& -mean_slaobs_mdt(i,j,bi,bj) |
358 |
endif |
endif |
359 |
enddo |
enddo |
360 |
enddo |
enddo |
377 |
do i = imin,imax |
do i = imin,imax |
378 |
|
|
379 |
psmean(i,j,bi,bj) = 0. _d 0 |
psmean(i,j,bi,bj) = 0. _d 0 |
380 |
|
mean_psMslaobs(i,j,bi,bj) = 0. _d 0 |
381 |
mean_psMtpobs(i,j,bi,bj) = 0. _d 0 |
mean_psMtpobs(i,j,bi,bj) = 0. _d 0 |
382 |
mean_psMersobs(i,j,bi,bj) = 0. _d 0 |
mean_psMersobs(i,j,bi,bj) = 0. _d 0 |
383 |
mean_psMgfoobs(i,j,bi,bj) = 0. _d 0 |
mean_psMgfoobs(i,j,bi,bj) = 0. _d 0 |
384 |
mean_psMssh_all(i,j,bi,bj) = 0. _d 0 |
mean_psMssh_all(i,j,bi,bj) = 0. _d 0 |
385 |
mean_slaobs2(i,j,bi,bj) = 0. _d 0 |
mean_slaobs_model(i,j,bi,bj) = 0. _d 0 |
386 |
|
|
387 |
mean_psMtpobs_NUM(i,j,bi,bj) = 0. _d 0 |
mean_psMtpobs_NUM(i,j,bi,bj) = 0. _d 0 |
388 |
mean_psMersobs_NUM(i,j,bi,bj) = 0. _d 0 |
mean_psMersobs_NUM(i,j,bi,bj) = 0. _d 0 |
389 |
mean_psMgfoobs_NUM(i,j,bi,bj) = 0. _d 0 |
mean_psMgfoobs_NUM(i,j,bi,bj) = 0. _d 0 |
390 |
mean_psMssh_all_NUM(i,j,bi,bj) = 0. _d 0 |
mean_psMssh_all_NUM(i,j,bi,bj) = 0. _d 0 |
391 |
|
mean_psMslaobs_MSK(i,j,bi,bj) = 0. _d 0 |
|
mean_psMtpobs_MSK(i,j,bi,bj) = 0. _d 0 |
|
|
mean_psMersobs_MSK(i,j,bi,bj) = 0. _d 0 |
|
|
mean_psMgfoobs_MSK(i,j,bi,bj) = 0. _d 0 |
|
392 |
|
|
393 |
enddo |
enddo |
394 |
enddo |
enddo |
404 |
& ladinit, optimcycle, mythid, |
& ladinit, optimcycle, mythid, |
405 |
& xx_psbar_mean_dummy ) |
& xx_psbar_mean_dummy ) |
406 |
|
|
407 |
|
#ifndef ALLOW_PSBAR_MEAN |
408 |
|
CALL REMOVE_MEAN_RL( 1, psbar, maskInC, maskInC, rA, drF, |
409 |
|
& 'psbar', myTime, myThid ) |
410 |
|
#endif |
411 |
|
|
412 |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
413 |
call cost_sla_read( topexfile, topexstartdate, topexperiod, |
call cost_sla_read( topexfile, topexstartdate, topexperiod, |
414 |
& topexintercept, topexslope, |
& topexintercept, topexslope, |
437 |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
438 |
if ( tpmask(i,j,bi,bj)* |
if ( tpmask(i,j,bi,bj)* |
439 |
& gencost_weight(i,j,bi,bj,igen_tp) .NE. 0. ) then |
& gencost_weight(i,j,bi,bj,igen_tp) .NE. 0. ) then |
440 |
mean_slaobs2(i,j,bi,bj)= |
mean_slaobs_model(i,j,bi,bj)= |
441 |
& mean_slaobs2(i,j,bi,bj)+tpobs(i,j,bi,bj) |
& mean_slaobs_model(i,j,bi,bj)+tpobs(i,j,bi,bj) |
442 |
mean_psMtpobs(i,j,bi,bj) = |
mean_psMtpobs(i,j,bi,bj) = |
443 |
& mean_psMtpobs(i,j,bi,bj) + |
& mean_psMtpobs(i,j,bi,bj) + |
444 |
& psbar(i,j,bi,bj)-tpobs(i,j,bi,bj) |
& psbar(i,j,bi,bj)-tpobs(i,j,bi,bj) |
449 |
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
450 |
if ( ersmask(i,j,bi,bj)* |
if ( ersmask(i,j,bi,bj)* |
451 |
& gencost_weight(i,j,bi,bj,igen_ers) .NE. 0. ) then |
& gencost_weight(i,j,bi,bj,igen_ers) .NE. 0. ) then |
452 |
mean_slaobs2(i,j,bi,bj)= |
mean_slaobs_model(i,j,bi,bj)= |
453 |
& mean_slaobs2(i,j,bi,bj)+ersobs(i,j,bi,bj) |
& mean_slaobs_model(i,j,bi,bj)+ersobs(i,j,bi,bj) |
454 |
mean_psMersobs(i,j,bi,bj) = |
mean_psMersobs(i,j,bi,bj) = |
455 |
& mean_psMersobs(i,j,bi,bj) + |
& mean_psMersobs(i,j,bi,bj) + |
456 |
& psbar(i,j,bi,bj)-ersobs(i,j,bi,bj) |
& psbar(i,j,bi,bj)-ersobs(i,j,bi,bj) |
461 |
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
462 |
if ( gfomask(i,j,bi,bj)* |
if ( gfomask(i,j,bi,bj)* |
463 |
& gencost_weight(i,j,bi,bj,igen_gfo) .NE. 0. ) then |
& gencost_weight(i,j,bi,bj,igen_gfo) .NE. 0. ) then |
464 |
mean_slaobs2(i,j,bi,bj)= |
mean_slaobs_model(i,j,bi,bj)= |
465 |
& mean_slaobs2(i,j,bi,bj)+gfoobs(i,j,bi,bj) |
& mean_slaobs_model(i,j,bi,bj)+gfoobs(i,j,bi,bj) |
466 |
mean_psMgfoobs(i,j,bi,bj) = |
mean_psMgfoobs(i,j,bi,bj) = |
467 |
& mean_psMgfoobs(i,j,bi,bj) + |
& mean_psMgfoobs(i,j,bi,bj) + |
468 |
& psbar(i,j,bi,bj)-gfoobs(i,j,bi,bj) |
& psbar(i,j,bi,bj)-gfoobs(i,j,bi,bj) |
483 |
do j = jmin,jmax |
do j = jmin,jmax |
484 |
do i = imin,imax |
do i = imin,imax |
485 |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
486 |
if ( mean_psMtpobs_NUM(i,j,bi,bj) .NE. 0. ) then |
if ( ( mean_psMtpobs_NUM(i,j,bi,bj) .NE. 0. ) |
487 |
|
#ifndef ALLOW_HIGHLAT_ALTIMETRY |
488 |
|
& .AND.( abs(YC(i,j,bi,bj)) .LE. 66. ) |
489 |
|
#endif |
490 |
|
& ) then |
491 |
mean_psMssh_all(i,j,bi,bj) = |
mean_psMssh_all(i,j,bi,bj) = |
492 |
& mean_psMssh_all(i,j,bi,bj) + |
& mean_psMssh_all(i,j,bi,bj) + |
493 |
& mean_psMtpobs(i,j,bi,bj) |
& mean_psMtpobs(i,j,bi,bj) |
497 |
mean_psMtpobs(i,j,bi,bj) = |
mean_psMtpobs(i,j,bi,bj) = |
498 |
& mean_psMtpobs(i,j,bi,bj) / |
& mean_psMtpobs(i,j,bi,bj) / |
499 |
& mean_psMtpobs_NUM(i,j,bi,bj) |
& mean_psMtpobs_NUM(i,j,bi,bj) |
|
mean_psMtpobs_MSK(i,j,bi,bj) = 1. _d 0 |
|
500 |
endif |
endif |
501 |
#endif |
#endif |
502 |
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
503 |
if ( mean_psMersobs_NUM(i,j,bi,bj) .NE. 0. ) then |
if ( ( mean_psMersobs_NUM(i,j,bi,bj) .NE. 0. ) |
504 |
|
#ifndef ALLOW_HIGHLAT_ALTIMETRY |
505 |
|
& .AND.( abs(YC(i,j,bi,bj)) .LE. 66. ) |
506 |
|
#endif |
507 |
|
& ) then |
508 |
mean_psMssh_all(i,j,bi,bj) = |
mean_psMssh_all(i,j,bi,bj) = |
509 |
& mean_psMssh_all(i,j,bi,bj) + |
& mean_psMssh_all(i,j,bi,bj) + |
510 |
& mean_psMersobs(i,j,bi,bj) |
& mean_psMersobs(i,j,bi,bj) |
514 |
mean_psMersobs(i,j,bi,bj) = |
mean_psMersobs(i,j,bi,bj) = |
515 |
& mean_psMersobs(i,j,bi,bj) / |
& mean_psMersobs(i,j,bi,bj) / |
516 |
& mean_psMersobs_NUM(i,j,bi,bj) |
& mean_psMersobs_NUM(i,j,bi,bj) |
|
mean_psMersobs_MSK(i,j,bi,bj) = 1. _d 0 |
|
517 |
endif |
endif |
518 |
#endif |
#endif |
519 |
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
520 |
if ( mean_psMgfoobs_NUM(i,j,bi,bj) .NE. 0. ) then |
if ( ( mean_psMgfoobs_NUM(i,j,bi,bj) .NE. 0. ) |
521 |
|
#ifndef ALLOW_HIGHLAT_ALTIMETRY |
522 |
|
& .AND.( abs(YC(i,j,bi,bj)) .LE. 66. ) |
523 |
|
#endif |
524 |
|
& ) then |
525 |
mean_psMssh_all(i,j,bi,bj) = |
mean_psMssh_all(i,j,bi,bj) = |
526 |
& mean_psMssh_all(i,j,bi,bj) + |
& mean_psMssh_all(i,j,bi,bj) + |
527 |
& mean_psMgfoobs(i,j,bi,bj) |
& mean_psMgfoobs(i,j,bi,bj) |
531 |
mean_psMgfoobs(i,j,bi,bj) = |
mean_psMgfoobs(i,j,bi,bj) = |
532 |
& mean_psMgfoobs(i,j,bi,bj) / |
& mean_psMgfoobs(i,j,bi,bj) / |
533 |
& mean_psMgfoobs_NUM(i,j,bi,bj) |
& mean_psMgfoobs_NUM(i,j,bi,bj) |
|
mean_psMgfoobs_MSK(i,j,bi,bj) = 1. _d 0 |
|
534 |
endif |
endif |
535 |
#endif |
#endif |
536 |
if ( ( mean_psMssh_all_NUM(i,j,bi,bj) .NE. 0. ).AND. |
|
537 |
|
if ( ( mean_psMssh_all_NUM(i,j,bi,bj) .GT. 0 ).AND. |
538 |
& ( maskc(i,j,1,bi,bj) .NE. 0. ) .AND. |
& ( maskc(i,j,1,bi,bj) .NE. 0. ) .AND. |
539 |
|
#ifndef ALLOW_HIGHLAT_ALTIMETRY |
540 |
|
& ( abs(YC(i,j,bi,bj)) .LE. 66. ) |
541 |
|
#endif |
542 |
|
& ) then |
543 |
|
mean_psMslaobs(i,j,bi,bj) = |
544 |
|
& mean_psMssh_all(i,j,bi,bj) / |
545 |
|
& mean_psMssh_all_NUM(i,j,bi,bj) |
546 |
|
mean_psMslaobs_MSK(i,j,bi,bj) = 1. _d 0 |
547 |
|
else |
548 |
|
mean_psMslaobs(i,j,bi,bj) = 0. _d 0 |
549 |
|
mean_psMslaobs_MSK(i,j,bi,bj) = 0. _d 0 |
550 |
|
endif |
551 |
|
|
552 |
|
if ( ( mean_psMssh_all_NUM(i,j,bi,bj) .GT. num0 ).AND. |
553 |
|
& ( maskc(i,j,1,bi,bj) .NE. 0. ) .AND. |
554 |
|
#ifndef ALLOW_HIGHLAT_ALTIMETRY |
555 |
& ( abs(YC(i,j,bi,bj)) .LE. 66. ).AND. |
& ( abs(YC(i,j,bi,bj)) .LE. 66. ).AND. |
556 |
& ( tpmeanmask(i,j,bi,bj) .NE. 0. ) ) then |
#endif |
557 |
mean_slaobs2(i,j,bi,bj) = |
& ( mdtmask(i,j,bi,bj) .NE. 0. ).AND. |
558 |
& mean_slaobs2(i,j,bi,bj) / |
& ( doReference ) ) then |
559 |
|
mean_slaobs_model(i,j,bi,bj) = |
560 |
|
& mean_slaobs_model(i,j,bi,bj) / |
561 |
& mean_psMssh_all_NUM(i,j,bi,bj) |
& mean_psMssh_all_NUM(i,j,bi,bj) |
562 |
mean_psMssh_all(i,j,bi,bj) = |
mean_psMssh_all(i,j,bi,bj) = |
563 |
& mean_psMssh_all(i,j,bi,bj) / |
& mean_psMssh_all(i,j,bi,bj) / |
564 |
& mean_psMssh_all_NUM(i,j,bi,bj)-tpmean(i,j,bi,bj) |
& mean_psMssh_all_NUM(i,j,bi,bj)-mdt(i,j,bi,bj) |
565 |
mean_psMssh_all_MSK(i,j,bi,bj) = 1. _d 0 |
mean_psMssh_all_MSK(i,j,bi,bj) = 1. _d 0 |
566 |
offset=offset+mean_psMssh_all(i,j,bi,bj)* |
offset=offset+RA(i,j,bi,bj)*mean_psMssh_all(i,j,bi,bj) |
567 |
& mean_psMssh_all_NUM(i,j,bi,bj) |
offset_sum=offset_sum+RA(i,j,bi,bj) |
568 |
offset_sum=offset_sum+mean_psMssh_all_NUM(i,j,bi,bj) |
elseif ( ( mdtmask(i,j,bi,bj) .NE. 0. ) .AND. |
569 |
|
& ( maskc(i,j,1,bi,bj) .NE. 0. ).AND. |
570 |
|
#ifndef ALLOW_HIGHLAT_ALTIMETRY |
571 |
|
& ( abs(YC(i,j,bi,bj)) .LE. 66. ).AND. |
572 |
|
#endif |
573 |
|
& ( .NOT.doReference ) ) then |
574 |
|
mean_slaobs_model(i,j,bi,bj) = 0.d0 |
575 |
|
mean_psMssh_all(i,j,bi,bj) = 0. _d 0 |
576 |
|
mean_psMssh_all_MSK(i,j,bi,bj) = 1. _d 0 |
577 |
|
offset=offset+RA(i,j,bi,bj) |
578 |
|
& *( psmean(i,j,bi,bj) -mdt(i,j,bi,bj) ) |
579 |
|
offset_sum=offset_sum+RA(i,j,bi,bj) |
580 |
else |
else |
581 |
mean_slaobs2(i,j,bi,bj) = 0.d0 |
mean_slaobs_model(i,j,bi,bj) = 0.d0 |
582 |
mean_psMssh_all(i,j,bi,bj) = 0. _d 0 |
mean_psMssh_all(i,j,bi,bj) = 0. _d 0 |
583 |
mean_psMssh_all_MSK(i,j,bi,bj) = 0. _d 0 |
mean_psMssh_all_MSK(i,j,bi,bj) = 0. _d 0 |
584 |
endif |
endif |
587 |
enddo |
enddo |
588 |
enddo |
enddo |
589 |
|
|
590 |
|
|
591 |
c-- Do a global summation. |
c-- Do a global summation. |
592 |
_GLOBAL_SUM_RL( offset , mythid ) |
_GLOBAL_SUM_RL( offset , mythid ) |
593 |
_GLOBAL_SUM_RL( offset_sum , mythid ) |
_GLOBAL_SUM_RL( offset_sum , mythid ) |
594 |
|
|
595 |
|
write(msgbuf,'(a,2d22.15)') ' sshv4:offset=',offset,offset_sum |
596 |
|
call print_message( msgbuf, standardmessageunit, |
597 |
|
& SQUEEZE_RIGHT , mythid) |
598 |
|
|
599 |
if (offset_sum .eq. 0.0) then |
if (offset_sum .eq. 0.0) then |
600 |
_BEGIN_MASTER( mythid ) |
_BEGIN_MASTER( mythid ) |
601 |
write(msgbuf,'(a)') ' cost_ssh: offset_sum = zero!' |
write(msgbuf,'(a)') ' sshv4: offset_sum = zero!' |
602 |
call print_message( msgbuf, standardmessageunit, |
call print_message( msgbuf, standardmessageunit, |
603 |
& SQUEEZE_RIGHT , mythid) |
& SQUEEZE_RIGHT , mythid) |
604 |
_END_MASTER( mythid ) |
_END_MASTER( mythid ) |
606 |
else |
else |
607 |
_BEGIN_MASTER( mythid ) |
_BEGIN_MASTER( mythid ) |
608 |
write(msgbuf,'(a,d22.15)') |
write(msgbuf,'(a,d22.15)') |
609 |
& ' cost_ssh: offset_sum = ',offset_sum |
& ' sshv4: offset_sum = ',offset_sum |
610 |
call print_message( msgbuf, standardmessageunit, |
call print_message( msgbuf, standardmessageunit, |
611 |
& SQUEEZE_RIGHT , mythid) |
& SQUEEZE_RIGHT , mythid) |
612 |
_END_MASTER( mythid ) |
_END_MASTER( mythid ) |
621 |
do j = jmin,jmax |
do j = jmin,jmax |
622 |
do i = imin,imax |
do i = imin,imax |
623 |
|
|
624 |
if ( (mean_psMssh_all_MSK(i,j,bi,bj) .NE. 0.) .AND. |
if ( (mean_psMssh_all_NUM(i,j,bi,bj) .GT. num0) .AND. |
625 |
& ( maskc(i,j,1,bi,bj) .NE. 0. ) .AND. |
& ( mdtmask(i,j,bi,bj) .NE. 0. ) .AND. |
626 |
& ( abs(YC(i,j,bi,bj)) .LE. 66. ) ) then |
& ( maskc(i,j,1,bi,bj) .NE. 0. ) .AND. |
627 |
|
#ifndef ALLOW_HIGHLAT_ALTIMETRY |
628 |
|
& ( abs(YC(i,j,bi,bj)) .LE. 66. ) .AND. |
629 |
|
#endif |
630 |
|
& ( doReference ) ) then |
631 |
c use the re-referencing approach |
c use the re-referencing approach |
632 |
mean_psMssh_all(i,j,bi,bj) = |
mean_psMssh_all(i,j,bi,bj) = |
633 |
& mean_psMssh_all(i,j,bi,bj) - offset |
& mean_psMssh_all(i,j,bi,bj) - offset |
634 |
elseif ( ( tpmeanmask(i,j,bi,bj) .NE. 0. ) .AND. |
mean_psMssh_all_MSK(i,j,bi,bj) = 1. _d 0 |
635 |
|
|
636 |
|
elseif ( ( mdtmask(i,j,bi,bj) .NE. 0. ) .AND. |
637 |
& ( maskc(i,j,1,bi,bj) .NE. 0. ) .AND. |
& ( maskc(i,j,1,bi,bj) .NE. 0. ) .AND. |
638 |
& ( abs(YC(i,j,bi,bj)) .GT. 66. ) ) then |
#ifndef ALLOW_HIGHLAT_ALTIMETRY |
639 |
|
& ( abs(YC(i,j,bi,bj)) .LE. 66. ) .AND. |
640 |
|
#endif |
641 |
|
& ( .NOT.doReference ) ) then |
642 |
c use the simpler approach |
c use the simpler approach |
643 |
mean_psMssh_all(i,j,bi,bj) = |
mean_psMssh_all(i,j,bi,bj) = |
644 |
& psmean(i,j,bi,bj) -tpmean(i,j,bi,bj) - offset |
& psmean(i,j,bi,bj) -mdt(i,j,bi,bj) - offset |
645 |
|
mean_psMssh_all_MSK(i,j,bi,bj) = 1. _d 0 |
646 |
|
|
647 |
else |
else |
648 |
mean_psMssh_all(i,j,bi,bj) = 0. _d 0 |
mean_psMssh_all(i,j,bi,bj) = 0. _d 0 |
649 |
|
mean_psMssh_all_MSK(i,j,bi,bj) = 0. _d 0 |
650 |
endif |
endif |
651 |
|
|
652 |
if ( maskc(i,j,1,bi,bj) .NE. 0. ) |
if ( maskc(i,j,1,bi,bj) .NE. 0. ) |
653 |
& psmean(i,j,bi,bj)=psmean(i,j,bi,bj)-offset |
& psmean(i,j,bi,bj)=psmean(i,j,bi,bj)-offset |
654 |
|
|
655 |
enddo |
enddo |
656 |
enddo |
enddo |
657 |
enddo |
enddo |
662 |
call mdswritefield(fname4test,32,.false.,'RL', |
call mdswritefield(fname4test,32,.false.,'RL', |
663 |
& 1,mean_psMssh_all,1,1,mythid) |
& 1,mean_psMssh_all,1,1,mythid) |
664 |
|
|
665 |
call smooth_hetero2d(mean_psMssh_all,maskc, |
#ifdef ALLOW_SMOOTH |
666 |
& gencost_scalefile(igen_mdt),300,mythid) |
if ( useSMOOTH ) |
667 |
|
& call smooth_hetero2d(mean_psMssh_all,maskc, |
668 |
|
& gencost_scalefile(igen_mdt), |
669 |
|
& gencost_smooth2Ddiffnbt(igen_mdt),mythid) |
670 |
|
#endif |
671 |
|
|
672 |
write(fname4test(1:80),'(1a)') 'mdtdiff_smooth' |
write(fname4test(1:80),'(1a)') 'mdtdiff_smooth' |
673 |
call mdswritefield(fname4test,32,.false.,'RL', |
call mdswritefield(fname4test,32,.false.,'RL', |
675 |
|
|
676 |
write(fname4test(1:80),'(1a)') 'sla2model_raw' |
write(fname4test(1:80),'(1a)') 'sla2model_raw' |
677 |
call mdswritefield(fname4test,32,.false.,'RL', |
call mdswritefield(fname4test,32,.false.,'RL', |
678 |
& 1,mean_slaobs2,1,1,mythid) |
& 1,mean_slaobs_model,1,1,mythid) |
679 |
|
|
680 |
call smooth_hetero2d(mean_slaobs2,maskc, |
#ifdef ALLOW_SMOOTH |
681 |
& gencost_scalefile(igen_mdt),300,mythid) |
if ( useSMOOTH ) |
682 |
|
& call smooth_hetero2d(mean_slaobs_model,maskc, |
683 |
|
& gencost_scalefile(igen_mdt), |
684 |
|
& gencost_smooth2Ddiffnbt(igen_mdt),mythid) |
685 |
|
#endif |
686 |
|
|
687 |
write(fname4test(1:80),'(1a)') 'sla2model_smooth' |
write(fname4test(1:80),'(1a)') 'sla2model_smooth' |
688 |
call mdswritefield(fname4test,32,.false.,'RL', |
call mdswritefield(fname4test,32,.false.,'RL', |
689 |
& 1,mean_slaobs2,1,1,mythid) |
& 1,mean_slaobs_model,1,1,mythid) |
690 |
|
|
691 |
cgf at this point: |
cgf at this point: |
692 |
cgf 1) mean_psMssh_all is the sample mean <psbar-slaobs-tpmean-offset>, |
cgf 1) mean_psMssh_all is the sample mean <psbar-slaobs-mdt-offset>, |
693 |
cgf to which a smoothing filter has been applied. |
cgf to which a smoothing filter has been applied. |
694 |
cgf 2) mean_psMtpobs is the (unsmoothed) sample mean <psbar-tpobs>. |
cgf 2) mean_psMtpobs is the (unsmoothed) sample mean <psbar-tpobs>. |
695 |
cgf And similarly for ers and gfo, each treated separately. |
cgf And similarly for ers and gfo, each treated separately. |
696 |
|
|
697 |
#ifdef ALLOW_PROFILES |
#ifdef ALLOW_PROFILES |
698 |
|
if ( usePROFILES ) then |
699 |
do bj = jtlo,jthi |
do bj = jtlo,jthi |
700 |
do bi = itlo,ithi |
do bi = itlo,ithi |
701 |
do j = 1,sny |
do j = 1,sny |
702 |
do i = 1,snx |
do i = 1,snx |
703 |
|
cgf this has not been tested recently |
704 |
prof_etan_mean(i,j,bi,bj)=psmean(i,j,bi,bj) |
prof_etan_mean(i,j,bi,bj)=psmean(i,j,bi,bj) |
705 |
enddo |
enddo |
706 |
enddo |
enddo |
707 |
enddo |
enddo |
708 |
enddo |
enddo |
709 |
_EXCH_XY_RL( prof_etan_mean, mythid ) |
_EXCH_XY_RL( prof_etan_mean, mythid ) |
710 |
|
endif |
711 |
#endif |
#endif |
712 |
|
|
713 |
|
|
722 |
do bi = itlo,ithi |
do bi = itlo,ithi |
723 |
do j = jmin,jmax |
do j = jmin,jmax |
724 |
do i = imin,imax |
do i = imin,imax |
725 |
junk = mean_psMssh_all(i,j,bi,bj) |
if (mean_psMssh_all_MSK(i,j,bi,bj).NE.0. _d 0) then |
726 |
junkweight = gencost_weight(i,j,bi,bj,igen_mdt) |
junk = mean_psMssh_all(i,j,bi,bj) |
727 |
& *tpmeanmask(i,j,bi,bj) |
junkweight = gencost_weight(i,j,bi,bj,igen_mdt) |
728 |
objf_gencost(igen_mdt,bi,bj) = objf_gencost(igen_mdt,bi,bj) |
& * mdtmask(i,j,bi,bj) |
729 |
|
else |
730 |
|
junk = 0. _d 0 |
731 |
|
junkweight = 0. _d 0 |
732 |
|
endif |
733 |
|
objf_gencost(bi,bj,igen_mdt) = objf_gencost(bi,bj,igen_mdt) |
734 |
& + junk*junk*junkweight |
& + junk*junk*junkweight |
735 |
if ( junkweight .ne. 0. ) num_gencost(igen_mdt,bi,bj) = |
if ( junkweight .ne. 0. ) num_gencost(bi,bj,igen_mdt) = |
736 |
& num_gencost(igen_mdt,bi,bj) + 1. _d 0 |
& num_gencost(bi,bj,igen_mdt) + 1. _d 0 |
737 |
diagnosfld(i,j,bi,bj) = junk*junk*junkweight |
diagnosfld(i,j,bi,bj) = junk*junk*junkweight |
738 |
enddo |
enddo |
739 |
enddo |
enddo |
740 |
enddo |
enddo |
741 |
enddo |
enddo |
742 |
|
|
743 |
CALL WRITE_FLD_XY_RL( 'DiagnosSSHmean', ' ', diagnosfld, |
CALL WRITE_FLD_XY_RL( 'DiagnosMDT', ' ', diagnosfld, |
744 |
& optimcycle, mythid ) |
& optimcycle, mythid ) |
745 |
|
|
746 |
#endif /* ALLOW_SSH_MEAN_COST_CONTRIBUTION */ |
#endif /* ALLOW_SSH_MEAN_COST_CONTRIBUTION */ |
755 |
ndaysave=35 |
ndaysave=35 |
756 |
ndaysaveRL=ndaysave |
ndaysaveRL=ndaysave |
757 |
|
|
758 |
do irec = 1, ndaysrec-ndaysave+1, 7 |
do irec = 1, ndaysrec-ndaysave+1 |
759 |
|
|
760 |
do bj = jtlo,jthi |
do bj = jtlo,jthi |
761 |
do bi = itlo,ithi |
do bi = itlo,ithi |
762 |
do j = jmin,jmax |
do j = jmin,jmax |
763 |
do i = imin,imax |
do i = imin,imax |
764 |
anom_psMslaobs(i,j,bi,bj) = 0. _d 0 |
anom_psMslaobs(i,j,bi,bj) = 0. _d 0 |
765 |
|
anom_psMslaobs_MSK(i,j,bi,bj) = 0. _d 0 |
766 |
|
anom_psMslaobs_SUB(i,j,bi,bj) = 0. _d 0 |
767 |
anom_slaobs(i,j,bi,bj) = 0. _d 0 |
anom_slaobs(i,j,bi,bj) = 0. _d 0 |
768 |
|
anom_slaobs_SUB(i,j,bi,bj) = 0. _d 0 |
769 |
|
cgf this is not currently used in PART 4 |
770 |
anom_psMtpobs(i,j,bi,bj) = 0. _d 0 |
anom_psMtpobs(i,j,bi,bj) = 0. _d 0 |
771 |
anom_psMersobs(i,j,bi,bj) = 0. _d 0 |
anom_psMersobs(i,j,bi,bj) = 0. _d 0 |
772 |
anom_psMgfoobs(i,j,bi,bj) = 0. _d 0 |
anom_psMgfoobs(i,j,bi,bj) = 0. _d 0 |
790 |
& ladinit, optimcycle, mythid, |
& ladinit, optimcycle, mythid, |
791 |
& xx_psbar_mean_dummy ) |
& xx_psbar_mean_dummy ) |
792 |
|
|
793 |
|
#ifndef ALLOW_PSBAR_MEAN |
794 |
|
CALL REMOVE_MEAN_RL( 1, psbar, maskInC, maskInC, rA, drF, |
795 |
|
& 'psbar', myTime, myThid ) |
796 |
|
#endif |
797 |
|
|
798 |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
799 |
call cost_sla_read( topexfile, topexstartdate, topexperiod, |
call cost_sla_read( topexfile, topexstartdate, topexperiod, |
800 |
& topexintercept, topexslope, |
& topexintercept, topexslope, |
819 |
do j = jmin,jmax |
do j = jmin,jmax |
820 |
do i = imin,imax |
do i = imin,imax |
821 |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
822 |
if ( tpmask(i,j,bi,bj)*mean_psMtpobs_MSK(i,j,bi,bj) |
if ( tpmask(i,j,bi,bj)*mean_psMslaobs_MSK(i,j,bi,bj) |
823 |
& .NE.0. ) then |
& .NE.0. ) then |
|
anom_psMtpobs(i,j,bi,bj)= anom_psMtpobs(i,j,bi,bj)+ |
|
|
& psbar(i,j,bi,bj)-tpobs(i,j,bi,bj) |
|
|
& -mean_psMtpobs(i,j,bi,bj) |
|
824 |
anom_psMslaobs(i,j,bi,bj)= anom_psMslaobs(i,j,bi,bj)+ |
anom_psMslaobs(i,j,bi,bj)= anom_psMslaobs(i,j,bi,bj)+ |
825 |
& psbar(i,j,bi,bj)-tpobs(i,j,bi,bj) |
& psbar(i,j,bi,bj)-tpobs(i,j,bi,bj) |
826 |
& -mean_psMtpobs(i,j,bi,bj) |
& -mean_psMslaobs(i,j,bi,bj) |
827 |
anom_slaobs(i,j,bi,bj)= anom_slaobs(i,j,bi,bj)+ |
anom_slaobs(i,j,bi,bj)= anom_slaobs(i,j,bi,bj)+ |
828 |
& tpobs(i,j,bi,bj) |
& tpobs(i,j,bi,bj) |
|
anom_psMtpobs_NUM(i,j,bi,bj)= |
|
|
& anom_psMtpobs_NUM(i,j,bi,bj)+1. _d 0 |
|
829 |
anom_psMslaobs_NUM(i,j,bi,bj)= |
anom_psMslaobs_NUM(i,j,bi,bj)= |
830 |
& anom_psMslaobs_NUM(i,j,bi,bj)+1. _d 0 |
& anom_psMslaobs_NUM(i,j,bi,bj)+1. _d 0 |
831 |
|
if ( (2*jrec.EQ.ndaysave).OR.(2*jrec+1.EQ.ndaysave) ) |
832 |
|
& anom_psMslaobs_MSK(i,j,bi,bj) = 1. _d 0 |
833 |
endif |
endif |
834 |
#endif |
#endif |
835 |
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
836 |
if ( ersmask(i,j,bi,bj)*mean_psMersobs_MSK(i,j,bi,bj) |
if ( ersmask(i,j,bi,bj)*mean_psMslaobs_MSK(i,j,bi,bj) |
837 |
& .NE.0. ) then |
& .NE.0. ) then |
|
anom_psMersobs(i,j,bi,bj)= anom_psMersobs(i,j,bi,bj)+ |
|
|
& psbar(i,j,bi,bj)-ersobs(i,j,bi,bj) |
|
|
& -mean_psMersobs(i,j,bi,bj) |
|
|
anom_psMersobs_NUM(i,j,bi,bj)= |
|
|
& anom_psMersobs_NUM(i,j,bi,bj)+1. _d 0 |
|
838 |
anom_psMslaobs(i,j,bi,bj)= anom_psMslaobs(i,j,bi,bj)+ |
anom_psMslaobs(i,j,bi,bj)= anom_psMslaobs(i,j,bi,bj)+ |
839 |
& psbar(i,j,bi,bj)-ersobs(i,j,bi,bj) |
& psbar(i,j,bi,bj)-ersobs(i,j,bi,bj) |
840 |
& -mean_psMersobs(i,j,bi,bj) |
& -mean_psMslaobs(i,j,bi,bj) |
841 |
anom_slaobs(i,j,bi,bj)= anom_slaobs(i,j,bi,bj)+ |
anom_slaobs(i,j,bi,bj)= anom_slaobs(i,j,bi,bj)+ |
842 |
& ersobs(i,j,bi,bj) |
& ersobs(i,j,bi,bj) |
843 |
anom_psMslaobs_NUM(i,j,bi,bj)= |
anom_psMslaobs_NUM(i,j,bi,bj)= |
844 |
& anom_psMslaobs_NUM(i,j,bi,bj)+1. _d 0 |
& anom_psMslaobs_NUM(i,j,bi,bj)+1. _d 0 |
845 |
|
if ( (2*jrec.EQ.ndaysave).OR.(2*jrec+1.EQ.ndaysave) ) |
846 |
|
& anom_psMslaobs_MSK(i,j,bi,bj) = 1. _d 0 |
847 |
endif |
endif |
848 |
#endif |
#endif |
849 |
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
850 |
if ( gfomask(i,j,bi,bj)*mean_psMgfoobs_MSK(i,j,bi,bj) |
if ( gfomask(i,j,bi,bj)*mean_psMslaobs_MSK(i,j,bi,bj) |
851 |
& .NE.0. ) then |
& .NE.0. ) then |
|
anom_psMgfoobs(i,j,bi,bj)= anom_psMgfoobs(i,j,bi,bj)+ |
|
|
& psbar(i,j,bi,bj)-gfoobs(i,j,bi,bj) |
|
|
& -mean_psMgfoobs(i,j,bi,bj) |
|
|
anom_psMgfoobs_NUM(i,j,bi,bj)= |
|
|
& anom_psMgfoobs_NUM(i,j,bi,bj)+1. _d 0 |
|
852 |
anom_psMslaobs(i,j,bi,bj)= anom_psMslaobs(i,j,bi,bj)+ |
anom_psMslaobs(i,j,bi,bj)= anom_psMslaobs(i,j,bi,bj)+ |
853 |
& psbar(i,j,bi,bj)-gfoobs(i,j,bi,bj) |
& psbar(i,j,bi,bj)-gfoobs(i,j,bi,bj) |
854 |
& -mean_psMgfoobs(i,j,bi,bj) |
& -mean_psMslaobs(i,j,bi,bj) |
855 |
anom_slaobs(i,j,bi,bj)= anom_slaobs(i,j,bi,bj)+ |
anom_slaobs(i,j,bi,bj)= anom_slaobs(i,j,bi,bj)+ |
856 |
& gfoobs(i,j,bi,bj) |
& gfoobs(i,j,bi,bj) |
857 |
anom_psMslaobs_NUM(i,j,bi,bj)= |
anom_psMslaobs_NUM(i,j,bi,bj)= |
858 |
& anom_psMslaobs_NUM(i,j,bi,bj)+1. _d 0 |
& anom_psMslaobs_NUM(i,j,bi,bj)+1. _d 0 |
859 |
|
if ( (2*jrec.EQ.ndaysave).OR.(2*jrec+1.EQ.ndaysave) ) |
860 |
|
& anom_psMslaobs_MSK(i,j,bi,bj) = 1. _d 0 |
861 |
endif |
endif |
862 |
#endif |
#endif |
863 |
enddo |
enddo |
871 |
do bi = itlo,ithi |
do bi = itlo,ithi |
872 |
do j = jmin,jmax |
do j = jmin,jmax |
873 |
do i = imin,imax |
do i = imin,imax |
|
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
|
|
if ( anom_psMtpobs_NUM(i,j,bi,bj) .NE. 0. ) then |
|
|
anom_psMtpobs(i,j,bi,bj) = |
|
|
& anom_psMtpobs(i,j,bi,bj) / |
|
|
& anom_psMtpobs_NUM(i,j,bi,bj) |
|
|
endif |
|
|
#endif |
|
|
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
|
|
if ( anom_psMersobs_NUM(i,j,bi,bj) .NE. 0. ) then |
|
|
anom_psMersobs(i,j,bi,bj) = |
|
|
& anom_psMersobs(i,j,bi,bj) / |
|
|
& anom_psMersobs_NUM(i,j,bi,bj) |
|
|
endif |
|
|
#endif |
|
|
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
|
|
if ( anom_psMgfoobs_NUM(i,j,bi,bj) .NE. 0. ) then |
|
|
anom_psMgfoobs(i,j,bi,bj) = |
|
|
& anom_psMgfoobs(i,j,bi,bj) / |
|
|
& anom_psMgfoobs_NUM(i,j,bi,bj) |
|
|
endif |
|
|
#endif |
|
874 |
if ( ( anom_psMslaobs_NUM(i,j,bi,bj) .NE. 0. ).AND. |
if ( ( anom_psMslaobs_NUM(i,j,bi,bj) .NE. 0. ).AND. |
875 |
& ( maskc(i,j,1,bi,bj) .NE. 0. ) ) then |
& ( maskc(i,j,1,bi,bj) .NE. 0. ) |
876 |
|
#ifndef ALLOW_HIGHLAT_ALTIMETRY |
877 |
|
& .AND.( abs(YC(i,j,bi,bj)) .LE. 66. ) |
878 |
|
#endif |
879 |
|
& ) then |
880 |
anom_psMslaobs(i,j,bi,bj) = |
anom_psMslaobs(i,j,bi,bj) = |
881 |
& anom_psMslaobs(i,j,bi,bj) / |
& anom_psMslaobs(i,j,bi,bj) / |
882 |
& anom_psMslaobs_NUM(i,j,bi,bj) |
& anom_psMslaobs_NUM(i,j,bi,bj) |
892 |
enddo |
enddo |
893 |
enddo |
enddo |
894 |
|
|
895 |
|
c PART 4.11: compute time variable offset |
896 |
|
c ---------------------------------------- |
897 |
|
|
898 |
|
slaoffset = 0. _d 0 |
899 |
|
slaoffset_sum = 0. _d 0 |
900 |
|
|
901 |
|
do bj = jtlo,jthi |
902 |
|
do bi = itlo,ithi |
903 |
|
do j = jmin,jmax |
904 |
|
do i = imin,imax |
905 |
|
if ( ( anom_psMslaobs_NUM(i,j,bi,bj) .NE. 0. ).AND. |
906 |
|
& ( maskc(i,j,1,bi,bj) .NE. 0. ) |
907 |
|
#ifndef ALLOW_HIGHLAT_ALTIMETRY |
908 |
|
& .AND.( abs(YC(i,j,bi,bj)) .LE. 66. ) |
909 |
|
#endif |
910 |
|
& ) then |
911 |
|
slaoffset=slaoffset+RA(i,j,bi,bj)* |
912 |
|
& anom_psMslaobs(i,j,bi,bj) |
913 |
|
slaoffset_sum=slaoffset_sum+RA(i,j,bi,bj) |
914 |
|
endif |
915 |
|
enddo |
916 |
|
enddo |
917 |
|
enddo |
918 |
|
enddo |
919 |
|
|
920 |
|
_GLOBAL_SUM_RL( slaoffset , mythid ) |
921 |
|
_GLOBAL_SUM_RL( slaoffset_sum , mythid ) |
922 |
|
|
923 |
|
write(msgbuf,'(a,2d22.15)') ' sshv4:slaoffset=', |
924 |
|
& slaoffset,slaoffset_sum |
925 |
|
call print_message( msgbuf, standardmessageunit, |
926 |
|
& SQUEEZE_RIGHT , mythid) |
927 |
|
|
928 |
|
if (slaoffset_sum .eq. 0.0) then |
929 |
|
_BEGIN_MASTER( mythid ) |
930 |
|
write(msgbuf,'(a)') ' sshv4: slaoffset_sum = zero!' |
931 |
|
call print_message( msgbuf, standardmessageunit, |
932 |
|
& SQUEEZE_RIGHT , mythid) |
933 |
|
_END_MASTER( mythid ) |
934 |
|
c stop ' ... stopped in cost_ssh.' |
935 |
|
else |
936 |
|
_BEGIN_MASTER( mythid ) |
937 |
|
write(msgbuf,'(a,d22.15)') |
938 |
|
& ' sshv4: slaoffset_sum = ',slaoffset_sum |
939 |
|
call print_message( msgbuf, standardmessageunit, |
940 |
|
& SQUEEZE_RIGHT , mythid) |
941 |
|
_END_MASTER( mythid ) |
942 |
|
endif |
943 |
|
|
944 |
|
c-- Compute (average) slaoffset |
945 |
|
slaoffset = slaoffset / slaoffset_sum |
946 |
|
|
947 |
|
do bj = jtlo,jthi |
948 |
|
do bi = itlo,ithi |
949 |
|
do j = jmin,jmax |
950 |
|
do i = imin,imax |
951 |
|
if ( ( anom_psMslaobs_NUM(i,j,bi,bj) .NE. 0. ).AND. |
952 |
|
& ( maskc(i,j,1,bi,bj) .NE. 0. ) |
953 |
|
#ifndef ALLOW_HIGHLAT_ALTIMETRY |
954 |
|
& .AND.( abs(YC(i,j,bi,bj)) .LE. 66. ) |
955 |
|
#endif |
956 |
|
& ) then |
957 |
|
anom_psMslaobs(i,j,bi,bj) = |
958 |
|
& anom_psMslaobs(i,j,bi,bj) - slaoffset |
959 |
|
anom_slaobs(i,j,bi,bj) = |
960 |
|
& anom_slaobs(i,j,bi,bj) - slaoffset |
961 |
|
else |
962 |
|
anom_psMslaobs(i,j,bi,bj) = 0. _d 0 |
963 |
|
anom_slaobs(i,j,bi,bj) = 0. _d 0 |
964 |
|
endif |
965 |
|
enddo |
966 |
|
enddo |
967 |
|
enddo |
968 |
|
enddo |
969 |
|
|
970 |
|
|
971 |
c PART 4.2: smooth anom_psMslaobs in space |
c PART 4.2: smooth anom_psMslaobs in space |
972 |
c ---------------------------------------- |
c ---------------------------------------- |
973 |
|
|
981 |
& 1,anom_slaobs,irec,1,mythid) |
& 1,anom_slaobs,irec,1,mythid) |
982 |
#endif |
#endif |
983 |
|
|
984 |
call smooth_hetero2d(anom_psMslaobs,maskc, |
#ifdef ALLOW_SMOOTH |
985 |
& gencost_scalefile(igen_lsc),300,mythid) |
if ( useSMOOTH ) |
986 |
|
& call smooth_hetero2d(anom_psMslaobs,maskc, |
987 |
|
& gencost_scalefile(igen_lsc), |
988 |
|
& gencost_smooth2Ddiffnbt(igen_lsc),mythid) |
989 |
|
#endif |
990 |
|
|
991 |
#ifdef ALLOW_GENCOST_SSHV4_OUTPUT |
#ifdef ALLOW_GENCOST_SSHV4_OUTPUT |
992 |
call smooth_hetero2d(anom_slaobs,maskc, |
#ifdef ALLOW_SMOOTH |
993 |
& gencost_scalefile(igen_lsc),300,mythid) |
if ( useSMOOTH ) |
994 |
|
& call smooth_hetero2d(anom_slaobs,maskc, |
995 |
|
& gencost_scalefile(igen_lsc), |
996 |
|
& gencost_smooth2Ddiffnbt(igen_lsc),mythid) |
997 |
|
#endif |
998 |
|
|
999 |
write(fname4test(1:80),'(1a)') 'sladiff_smooth' |
write(fname4test(1:80),'(1a)') 'sladiff_smooth' |
1000 |
call mdswritefield(fname4test,32,.false.,'RL', |
call mdswritefield(fname4test,32,.false.,'RL', |
1015 |
# if (defined (ALLOW_SSH_GFOANOM_COST_CONTRIBUTION) || \ |
# if (defined (ALLOW_SSH_GFOANOM_COST_CONTRIBUTION) || \ |
1016 |
defined (ALLOW_SSH_TPANOM_COST_CONTRIBUTION) || \ |
defined (ALLOW_SSH_TPANOM_COST_CONTRIBUTION) || \ |
1017 |
defined (ALLOW_SSH_ERSANOM_COST_CONTRIBUTION)) |
defined (ALLOW_SSH_ERSANOM_COST_CONTRIBUTION)) |
1018 |
junk = anom_psMslaobs(i,j,bi,bj) |
if ( (gencost_weight(i,j,bi,bj,igen_lsc).GT.0.).AND. |
1019 |
objf_gencost(igen_lsc,bi,bj) = objf_gencost(igen_lsc,bi,bj) |
& (anom_psMslaobs_MSK(i,j,bi,bj).GT.0.) ) then |
1020 |
|
junk = anom_psMslaobs(i,j,bi,bj) |
1021 |
|
anom_slaobs_SUB(i,j,bi,bj) = anom_slaobs(i,j,bi,bj) |
1022 |
|
anom_psMslaobs_SUB(i,j,bi,bj) = anom_psMslaobs(i,j,bi,bj) |
1023 |
|
else |
1024 |
|
junk = 0. _d 0 |
1025 |
|
anom_slaobs_SUB(i,j,bi,bj)= 0. _d 0 |
1026 |
|
anom_psMslaobs_SUB(i,j,bi,bj)= 0. _d 0 |
1027 |
|
endif |
1028 |
|
objf_gencost(bi,bj,igen_lsc) = objf_gencost(bi,bj,igen_lsc) |
1029 |
& + junk*junk*gencost_weight(i,j,bi,bj,igen_lsc) |
& + junk*junk*gencost_weight(i,j,bi,bj,igen_lsc) |
|
& *maskc(i,j,1,bi,bj)/ndaysaveRL |
|
1030 |
if ( (gencost_weight(i,j,bi,bj,igen_lsc).GT.0.).AND. |
if ( (gencost_weight(i,j,bi,bj,igen_lsc).GT.0.).AND. |
1031 |
& (anom_psMslaobs_NUM(i,j,bi,bj).GT.0.).AND. |
& (anom_psMslaobs_MSK(i,j,bi,bj).GT.0.) ) |
1032 |
& (maskc(i,j,1,bi,bj) .ne. 0.) ) |
& num_gencost(bi,bj,igen_lsc) = |
1033 |
& num_gencost(igen_lsc,bi,bj) = |
& num_gencost(bi,bj,igen_lsc) + 1. _d 0 |
|
& num_gencost(igen_lsc,bi,bj) + 1. _d 0 /ndaysaveRL |
|
1034 |
#endif |
#endif |
1035 |
enddo |
enddo |
1036 |
enddo |
enddo |
1037 |
enddo |
enddo |
1038 |
enddo |
enddo |
1039 |
|
|
1040 |
|
#ifdef ALLOW_GENCOST_SSHV4_OUTPUT |
1041 |
|
write(fname4test(1:80),'(1a)') 'sladiff_subsample' |
1042 |
|
call mdswritefield(fname4test,32,.false.,'RL', |
1043 |
|
& 1,anom_psMslaobs_SUB,irec,1,mythid) |
1044 |
|
|
1045 |
|
write(fname4test(1:80),'(1a)') 'slaobs_subsample' |
1046 |
|
call mdswritefield(fname4test,32,.false.,'RL', |
1047 |
|
& 1,anom_slaobs_SUB,irec,1,mythid) |
1048 |
|
#endif |
1049 |
|
|
1050 |
enddo |
enddo |
1051 |
|
|
1052 |
|
|
1061 |
& ladinit, optimcycle, mythid, |
& ladinit, optimcycle, mythid, |
1062 |
& xx_psbar_mean_dummy ) |
& xx_psbar_mean_dummy ) |
1063 |
|
|
1064 |
|
#ifndef ALLOW_PSBAR_MEAN |
1065 |
|
CALL REMOVE_MEAN_RL( 1, psbar, maskInC, maskInC, rA, drF, |
1066 |
|
& 'psbar', myTime, myThid ) |
1067 |
|
#endif |
1068 |
|
|
1069 |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
1070 |
call cost_readtopex( irec, mythid ) |
call cost_readtopex( irec, mythid ) |
1071 |
#endif |
#endif |
1096 |
do j = jmin,jmax |
do j = jmin,jmax |
1097 |
do i = imin,imax |
do i = imin,imax |
1098 |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
1099 |
if ( tpmask(i,j,bi,bj)*mean_psMtpobs_MSK(i,j,bi,bj).NE.0. ) |
if ( tpmask(i,j,bi,bj)*mean_psMslaobs_MSK(i,j,bi,bj).NE.0. ) |
1100 |
& then |
& then |
1101 |
anom_psMtpobs(i,j,bi,bj)= |
anom_psMtpobs(i,j,bi,bj)= |
1102 |
& psbar(i,j,bi,bj) - tpobs(i,j,bi,bj) |
& psbar(i,j,bi,bj) - tpobs(i,j,bi,bj) |
1103 |
& - mean_psMtpobs(i,j,bi,bj) |
& - mean_psMslaobs(i,j,bi,bj) |
1104 |
anom_tpobs(i,j,bi,bj)=tpobs(i,j,bi,bj) |
anom_tpobs(i,j,bi,bj)=tpobs(i,j,bi,bj) |
1105 |
endif |
endif |
1106 |
#endif |
#endif |
1107 |
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
1108 |
if ( ersmask(i,j,bi,bj)*mean_psMersobs_MSK(i,j,bi,bj).NE.0. ) |
if ( ersmask(i,j,bi,bj)*mean_psMslaobs_MSK(i,j,bi,bj).NE.0. ) |
1109 |
& then |
& then |
1110 |
anom_psMersobs(i,j,bi,bj)= |
anom_psMersobs(i,j,bi,bj)= |
1111 |
& psbar(i,j,bi,bj) - ersobs(i,j,bi,bj) |
& psbar(i,j,bi,bj) - ersobs(i,j,bi,bj) |
1112 |
& - mean_psMersobs(i,j,bi,bj) |
& - mean_psMslaobs(i,j,bi,bj) |
1113 |
anom_ersobs(i,j,bi,bj)=ersobs(i,j,bi,bj) |
anom_ersobs(i,j,bi,bj)=ersobs(i,j,bi,bj) |
1114 |
endif |
endif |
1115 |
#endif |
#endif |
1116 |
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
1117 |
if ( gfomask(i,j,bi,bj)*mean_psMgfoobs_MSK(i,j,bi,bj).NE.0. ) |
if ( gfomask(i,j,bi,bj)*mean_psMslaobs_MSK(i,j,bi,bj).NE.0. ) |
1118 |
& then |
& then |
1119 |
anom_psMgfoobs(i,j,bi,bj)= |
anom_psMgfoobs(i,j,bi,bj)= |
1120 |
& psbar(i,j,bi,bj) - gfoobs(i,j,bi,bj) |
& psbar(i,j,bi,bj) - gfoobs(i,j,bi,bj) |
1121 |
& - mean_psMgfoobs(i,j,bi,bj) |
& - mean_psMslaobs(i,j,bi,bj) |
1122 |
anom_gfoobs(i,j,bi,bj)=gfoobs(i,j,bi,bj) |
anom_gfoobs(i,j,bi,bj)=gfoobs(i,j,bi,bj) |
1123 |
endif |
endif |
1124 |
#endif |
#endif |
1147 |
write(fname4test(1:80),'(1a)') 'slaobs_gfo_raw' |
write(fname4test(1:80),'(1a)') 'slaobs_gfo_raw' |
1148 |
call mdswritefield(fname4test,32,.false.,'RL', |
call mdswritefield(fname4test,32,.false.,'RL', |
1149 |
& 1,anom_gfoobs,irec,1,mythid) |
& 1,anom_gfoobs,irec,1,mythid) |
1150 |
#endif |
#endif |
1151 |
|
|
1152 |
do bj = jtlo,jthi |
do bj = jtlo,jthi |
1153 |
do bi = itlo,ithi |
do bi = itlo,ithi |
1155 |
do i = imin,imax |
do i = imin,imax |
1156 |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_TPANOM_COST_CONTRIBUTION |
1157 |
c-- The array psobs contains SSH anomalies. |
c-- The array psobs contains SSH anomalies. |
1158 |
junkweight = mean_psMtpobs_MSK(i,j,bi,bj) |
junkweight = mean_psMslaobs_MSK(i,j,bi,bj) |
1159 |
& *gencost_weight(i,j,bi,bj,igen_tp) |
& *gencost_weight(i,j,bi,bj,igen_tp) |
1160 |
& *tpmask(i,j,bi,bj) |
& *tpmask(i,j,bi,bj) |
1161 |
& *cosphi(i,j,bi,bj) |
& *cosphi(i,j,bi,bj) |
1162 |
junk = anom_psMtpobs(i,j,bi,bj) |
junk = anom_psMtpobs(i,j,bi,bj) |
1163 |
objf_gencost(igen_tp,bi,bj) = |
objf_gencost(bi,bj,igen_tp) = |
1164 |
& objf_gencost(igen_tp,bi,bj)+junk*junk*junkweight |
& objf_gencost(bi,bj,igen_tp)+junk*junk*junkweight |
1165 |
if ( junkweight .ne. 0. ) |
if ( junkweight .ne. 0. ) |
1166 |
& num_gencost(igen_tp,bi,bj) = |
& num_gencost(bi,bj,igen_tp) = |
1167 |
& num_gencost(igen_tp,bi,bj) + 1. _d 0 |
& num_gencost(bi,bj,igen_tp) + 1. _d 0 |
1168 |
#endif |
#endif |
1169 |
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
1170 |
c-- The array ersobs contains SSH anomalies. |
c-- The array ersobs contains SSH anomalies. |
1171 |
junkweight = mean_psMersobs_MSK(i,j,bi,bj) |
junkweight = mean_psMslaobs_MSK(i,j,bi,bj) |
1172 |
& *gencost_weight(i,j,bi,bj,igen_ers) |
& *gencost_weight(i,j,bi,bj,igen_ers) |
1173 |
& *ersmask(i,j,bi,bj) |
& *ersmask(i,j,bi,bj) |
1174 |
& *cosphi(i,j,bi,bj) |
& *cosphi(i,j,bi,bj) |
1175 |
junk = anom_psMersobs(i,j,bi,bj) |
junk = anom_psMersobs(i,j,bi,bj) |
1176 |
objf_gencost(igen_ers,bi,bj) = |
objf_gencost(bi,bj,igen_ers) = |
1177 |
& objf_gencost(igen_ers,bi,bj)+junk*junk*junkweight |
& objf_gencost(bi,bj,igen_ers)+junk*junk*junkweight |
1178 |
if ( junkweight .ne. 0. ) |
if ( junkweight .ne. 0. ) |
1179 |
& num_gencost(igen_ers,bi,bj) = |
& num_gencost(bi,bj,igen_ers) = |
1180 |
& num_gencost(igen_ers,bi,bj) + 1. _d 0 |
& num_gencost(bi,bj,igen_ers) + 1. _d 0 |
1181 |
#endif |
#endif |
1182 |
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
#ifdef ALLOW_SSH_GFOANOM_COST_CONTRIBUTION |
1183 |
c-- The array gfoobs contains SSH anomalies. |
c-- The array gfoobs contains SSH anomalies. |
1184 |
junkweight = mean_psMgfoobs_MSK(i,j,bi,bj) |
junkweight = mean_psMslaobs_MSK(i,j,bi,bj) |
1185 |
& *gencost_weight(i,j,bi,bj,igen_gfo) |
& *gencost_weight(i,j,bi,bj,igen_gfo) |
1186 |
& *gfomask(i,j,bi,bj) |
& *gfomask(i,j,bi,bj) |
1187 |
& *cosphi(i,j,bi,bj) |
& *cosphi(i,j,bi,bj) |
1188 |
junk = anom_psMgfoobs(i,j,bi,bj) |
junk = anom_psMgfoobs(i,j,bi,bj) |
1189 |
objf_gencost(igen_gfo,bi,bj) = |
objf_gencost(bi,bj,igen_gfo) = |
1190 |
& objf_gencost(igen_gfo,bi,bj)+junk*junk*junkweight |
& objf_gencost(bi,bj,igen_gfo)+junk*junk*junkweight |
1191 |
if ( junkweight .ne. 0. ) |
if ( junkweight .ne. 0. ) |
1192 |
& num_gencost(igen_gfo,bi,bj) = |
& num_gencost(bi,bj,igen_gfo) = |
1193 |
& num_gencost(igen_gfo,bi,bj) + 1. _d 0 |
& num_gencost(bi,bj,igen_gfo) + 1. _d 0 |
1194 |
#endif |
#endif |
1195 |
enddo |
enddo |
1196 |
enddo |
enddo |
1200 |
enddo |
enddo |
1201 |
|
|
1202 |
|
|
|
#endif /* ifdef ALLOW_GENCOST_FREEFORM */ |
|
1203 |
#endif /* ifdef ALLOW_GENCOST_CONTRIBUTION */ |
#endif /* ifdef ALLOW_GENCOST_CONTRIBUTION */ |
|
#endif /* ifdef ALLOW_SMOOTH */ |
|
1204 |
#endif /* ifdef ALLOW_SSH_COST_CONTRIBUTION */ |
#endif /* ifdef ALLOW_SSH_COST_CONTRIBUTION */ |
1205 |
|
|
1206 |
end |
end |