5 |
|
|
6 |
c read the area dat file and compare against the averaged salinity file |
c read the area dat file and compare against the averaged salinity file |
7 |
|
|
8 |
subroutine seaice_cost_sss( |
subroutine seaice_cost_sss( |
9 |
& nnzbar, localbarfile, localbar, xx_localbar_mean_dummy, |
& nnzbar, localbarfile, localbar, xx_localbar_mean_dummy, |
10 |
& areabarfile, areabar, xx_areabar_mean_dummy, |
& areabarfile, areabar, xx_areabar_mean_dummy, |
11 |
& nnzobs, localobsfile, localobs, mult_local, |
& nnzobs, localobsfile, localobs, mult_local, |
27 |
# include "cal.h" |
# include "cal.h" |
28 |
#endif |
#endif |
29 |
#ifdef ALLOW_COST |
#ifdef ALLOW_COST |
|
# include "ecco_cost.h" |
|
30 |
# include "optim.h" |
# include "optim.h" |
31 |
|
# ifdef ALLOW_ECCO |
32 |
|
# include "ecco_cost.h" |
33 |
|
# endif |
34 |
# ifdef ALLOW_SEAICE |
# ifdef ALLOW_SEAICE |
35 |
# include "SEAICE_COST.h" |
# include "SEAICE_COST.h" |
36 |
# include "SEAICE_PARAMS.h" |
# include "SEAICE_PARAMS.h" |
51 |
|
|
52 |
_RL localobs (1-olx:snx+olx,1-oly:sny+oly,nnzobs,nsx,nsy) |
_RL localobs (1-olx:snx+olx,1-oly:sny+oly,nnzobs,nsx,nsy) |
53 |
_RL localweight(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL localweight(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
54 |
_RL localmask (1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
_RS localmask (1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
55 |
_RL xx_localbar_mean_dummy |
_RL xx_localbar_mean_dummy |
56 |
_RL xx_areabar_mean_dummy |
_RL xx_areabar_mean_dummy |
57 |
_RL mult_local |
_RL mult_local |
67 |
character*(MAX_LEN_FNAM) localbarfile |
character*(MAX_LEN_FNAM) localbarfile |
68 |
character*(MAX_LEN_FNAM) localobsfile |
character*(MAX_LEN_FNAM) localobsfile |
69 |
|
|
70 |
#ifdef ALLOW_COST |
#if (defined (ALLOW_ECCO) && defined (ALLOW_COST)) |
71 |
c == local variables == |
c == local variables == |
72 |
|
|
73 |
integer bi,bj |
integer bi,bj |
90 |
_RL localcost |
_RL localcost |
91 |
_RL junk |
_RL junk |
92 |
|
|
93 |
_RL cmask (1-olx:snx+olx,1-oly:sny+oly,nnzobs) |
_RL cmask (1-olx:snx+olx,1-oly:sny+oly,nnzobs) |
94 |
|
|
95 |
character*(128) fname1, fname2,fname3 |
character*(128) fname1, fname2,fname3 |
96 |
character*(MAX_LEN_MBUF) msgbuf |
character*(MAX_LEN_MBUF) msgbuf |
146 |
write(fname3(1:128),'(80a)') ' ' |
write(fname3(1:128),'(80a)') ' ' |
147 |
|
|
148 |
il=ilnblnk( localbarfile ) |
il=ilnblnk( localbarfile ) |
149 |
write(fname1(1:128),'(2a,i10.10)') |
write(fname1(1:128),'(2a,i10.10)') |
150 |
& localbarfile(1:il),'.',optimcycle |
& localbarfile(1:il),'.',optimcycle |
151 |
|
|
152 |
csss |
csss |
153 |
il=ilnblnk( areabarfile ) |
il=ilnblnk( areabarfile ) |
154 |
write(fname3(1:128),'(2a,i10.10)') |
write(fname3(1:128),'(2a,i10.10)') |
155 |
& areabarfile(1:il),'.',optimcycle |
& areabarfile(1:il),'.',optimcycle |
156 |
|
|
157 |
if ( .NOT. ( localobsfile.EQ.' ' ) ) then |
if ( .NOT. ( localobsfile.EQ.' ' ) ) then |
161 |
|
|
162 |
if ( nnzbar .EQ. 1 ) then |
if ( nnzbar .EQ. 1 ) then |
163 |
call active_read_xy( fname1, localbar, irec, doglobalread, |
call active_read_xy( fname1, localbar, irec, doglobalread, |
164 |
& ladinit, optimcycle, mythid, |
& ladinit, optimcycle, mythid, |
165 |
& xx_localbar_mean_dummy ) |
& xx_localbar_mean_dummy ) |
166 |
else |
else |
167 |
call active_read_xyz( fname1, localbar, irec, doglobalread, |
call active_read_xyz( fname1, localbar, irec, doglobalread, |
168 |
& ladinit, optimcycle, mythid, |
& ladinit, optimcycle, mythid, |
169 |
& xx_localbar_mean_dummy ) |
& xx_localbar_mean_dummy ) |
170 |
endif |
endif |
171 |
|
|
172 |
csss |
csss |
173 |
if ( nnzbar .EQ. 1 ) then |
if ( nnzbar .EQ. 1 ) then |
174 |
call active_read_xy( fname3, areabar, irec, doglobalread, |
call active_read_xy( fname3, areabar, irec, doglobalread, |
175 |
& ladinit, optimcycle, mythid, |
& ladinit, optimcycle, mythid, |
176 |
& xx_areabar_mean_dummy ) |
& xx_areabar_mean_dummy ) |
177 |
else |
else |
178 |
call active_read_xyz( fname3, areabar, irec, doglobalread, |
call active_read_xyz( fname3, areabar, irec, doglobalread, |
179 |
& ladinit, optimcycle, mythid, |
& ladinit, optimcycle, mythid, |
180 |
& xx_areabar_mean_dummy ) |
& xx_areabar_mean_dummy ) |
181 |
endif |
endif |
182 |
|
|
204 |
print *,'ymod, yday ', ymod,yday |
print *,'ymod, yday ', ymod,yday |
205 |
print *,'smrarstrtdt(1) ', smrareastartdate(1) |
print *,'smrarstrtdt(1) ', smrareastartdate(1) |
206 |
print *,'smrarstartdate ', smrareastartdate |
print *,'smrarstartdate ', smrareastartdate |
207 |
#endif SEAICE_DEBUG |
#endif /* SEAICE_DEBUG */ |
208 |
|
|
209 |
if ( ymod .EQ. yday ) then |
if ( ymod .EQ. yday ) then |
210 |
middate(1) = smrareastartdate(1) |
middate(1) = smrareastartdate(1) |
211 |
else |
else |
212 |
middate(1) = yday*10000+100+1 |
middate(1) = yday*10000+100+1 |
213 |
endif |
endif |
226 |
print *,'middate(3,4) ', middate(3),middate(4) |
print *,'middate(3,4) ', middate(3),middate(4) |
227 |
print *,'difftime,diffsecs',difftime,diffsecs |
print *,'difftime,diffsecs',difftime,diffsecs |
228 |
print *,'localrec ',localrec |
print *,'localrec ',localrec |
229 |
#endif |
#endif |
230 |
|
|
231 |
il=ilnblnk(localobsfile) |
il=ilnblnk(localobsfile) |
232 |
write(fname2(1:128),'(2a,i4)') |
write(fname2(1:128),'(2a,i4)') |
245 |
#endif |
#endif |
246 |
endif |
endif |
247 |
|
|
248 |
if ( localrec .GT. 0 ) then |
if ( localrec .GT. 0 ) then |
249 |
|
|
250 |
#ifdef SEAICE_DEBUG |
#ifdef SEAICE_DEBUG |
251 |
print *,'calling mdsreadfile',fname2,localrec |
print *,'calling mdsreadfile',fname2,localrec |
252 |
#endif |
#endif |
253 |
|
|
254 |
call mdsreadfield( fname2, cost_iprec, cost_yftype, nnzobs, |
call mdsreadfield( fname2, cost_iprec, cost_yftype, nnzobs, |
255 |
& localobs, localrec, mythid ) |
& localobs, localrec, mythid ) |
256 |
else |
else |
257 |
do bj = jtlo,jthi |
do bj = jtlo,jthi |
309 |
localwww = localweight(i,j,bi,bj)*cmask(i,j,k) |
localwww = localweight(i,j,bi,bj)*cmask(i,j,k) |
310 |
|
|
311 |
c only accumulate cost if there is ice observed but not simulated.. |
c only accumulate cost if there is ice observed but not simulated.. |
312 |
if ( localobs(i,j,k,bi,bj) .GT. 0.0 .AND. |
if ( localobs(i,j,k,bi,bj) .GT. 0.0 .AND. |
313 |
& areabar(i,j,1,bi,bj) .LE. 0.0) then |
& areabar(i,j,1,bi,bj) .LE. 0.0) then |
314 |
|
|
315 |
c if ( localobs(i,j,k,bi,bj) .GT. |
c if ( localobs(i,j,k,bi,bj) .GT. |
316 |
c & areabar(i,j,1,bi,bj)) then |
c & areabar(i,j,1,bi,bj)) then |
317 |
|
|
318 |
junk = ( localbar(i,j,k,bi,bj) - SEAICE_clamp_salt ) |
junk = ( localbar(i,j,k,bi,bj) - SEAICE_clamp_salt ) |
337 |
|
|
338 |
print '(A,2i4,2(1x,1P2E15.3))', |
print '(A,2i4,2(1x,1P2E15.3))', |
339 |
& 'costg i j bar-obs,wgt,loCost ',i,j, |
& 'costg i j bar-obs,wgt,loCost ',i,j, |
340 |
& junk, |
& junk, |
341 |
& localwww, |
& localwww, |
342 |
& localcost |
& localcost |
343 |
endif |
endif |
344 |
#endif |
#endif |