1 |
C $Header: /u/gcmpack/MITgcm/pkg/cost/Attic/cost_readscatxfields.F,v 1.1.2.2 2003/06/19 15:21:16 heimbach Exp $ |
2 |
|
3 |
#include "COST_CPPOPTIONS.h" |
4 |
|
5 |
|
6 |
subroutine cost_ReadscatxFields( |
7 |
I irec, |
8 |
I mythid |
9 |
& ) |
10 |
|
11 |
c ================================================================== |
12 |
c SUBROUTINE cost_ReadscatxFields |
13 |
c ================================================================== |
14 |
c |
15 |
c o Read a given record of the SST data. |
16 |
c |
17 |
c started: Christian Eckert eckert@mit.edu 25-May-1999 |
18 |
c |
19 |
c changed: Christian Eckert eckert@mit.edu 25-Feb-2000 |
20 |
c |
21 |
c - Restructured the code in order to create a package |
22 |
c for the MITgcmUV. |
23 |
c |
24 |
c ================================================================== |
25 |
c SUBROUTINE cost_ReadscatxFields |
26 |
c ================================================================== |
27 |
|
28 |
implicit none |
29 |
|
30 |
c == global variables == |
31 |
|
32 |
#include "EEPARAMS.h" |
33 |
#include "SIZE.h" |
34 |
#include "PARAMS.h" |
35 |
#include "GRID.h" |
36 |
|
37 |
#include "cal.h" |
38 |
#include "ecco_cost.h" |
39 |
|
40 |
c == routine arguments == |
41 |
|
42 |
integer irec |
43 |
integer mythid |
44 |
|
45 |
c == local variables == |
46 |
|
47 |
integer bi,bj |
48 |
integer i,j,k |
49 |
integer itlo,ithi |
50 |
integer jtlo,jthi |
51 |
integer jmin,jmax |
52 |
integer imin,imax |
53 |
integer nobs |
54 |
integer scatxrec |
55 |
integer beginscatx |
56 |
integer beginrun |
57 |
|
58 |
_RL spval |
59 |
_RL vartile |
60 |
|
61 |
c == end of interface == |
62 |
|
63 |
parameter (spval = -1.8 ) |
64 |
ce --> there is certainly a better place for this. |
65 |
|
66 |
jtlo = mybylo(mythid) |
67 |
jthi = mybyhi(mythid) |
68 |
itlo = mybxlo(mythid) |
69 |
ithi = mybxhi(mythid) |
70 |
jmin = 1 |
71 |
jmax = sny |
72 |
imin = 1 |
73 |
imax = snx |
74 |
|
75 |
beginscatx = scatxstartdate(1)/10000 |
76 |
beginrun = modelstartdate(1)/10000 |
77 |
if ( beginscatx .eq. beginrun ) then |
78 |
scatxrec = mod(modelstartdate(1)/100,100) - |
79 |
& mod(scatxstartdate(1)/100,100) + irec |
80 |
else |
81 |
scatxrec = ( beginrun - beginscatx - 1)*nmonthyear + |
82 |
& (nmonthyear - mod(scatxstartdate(1)/100,100) + |
83 |
& 1) + mod(modelstartdate(1)/100,100) - 1 + irec |
84 |
endif |
85 |
|
86 |
if ( scatxrec .gt. 0 .and. scatxdatfile .ne. ' ' ) then |
87 |
call mdsreadfield( scatxdatfile, cost_iprec, cost_yftype, 1, |
88 |
& scatxdat, scatxrec, mythid ) |
89 |
else |
90 |
do bj = jtlo,jthi |
91 |
do bi = itlo,ithi |
92 |
do j = jmin,jmax |
93 |
do i = imin,imax |
94 |
scatxdat(i,j,bi,bj)=0. _d 0 |
95 |
enddo |
96 |
enddo |
97 |
enddo |
98 |
enddo |
99 |
endif |
100 |
|
101 |
nobs = 0 |
102 |
do bj = jtlo,jthi |
103 |
do bi = itlo,ithi |
104 |
k = 1 |
105 |
do j = jmin,jmax |
106 |
do i = imin,imax |
107 |
if (_hFacC(i,j,k,bi,bj) .eq. 0.) then |
108 |
scatxmask(i,j,bi,bj) = 0. _d 0 |
109 |
else |
110 |
scatxmask(i,j,bi,bj) = 1. _d 0 |
111 |
endif |
112 |
if (scatxdat(i,j,bi,bj) .lt. spval) then |
113 |
scatxmask(i,j,bi,bj) = 0. _d 0 |
114 |
endif |
115 |
if (scatxdat(i,j,bi,bj) .eq. 0. _d 0 ) then |
116 |
scatxmask(i,j,bi,bj) = 0. _d 0 |
117 |
endif |
118 |
scatxmask(i,j,bi,bj) = scatxmask(i,j,bi,bj)*frame(i,j) |
119 |
scatxdat(i,j,bi,bj) = scatxdat(i,j,bi,bj)* |
120 |
& scatxmask(i,j,bi,bj) |
121 |
nobs = nobs + int(scatxmask(i,j,bi,bj)) |
122 |
enddo |
123 |
enddo |
124 |
enddo |
125 |
enddo |
126 |
|
127 |
c-- Calculate the field variance for present subdomain. |
128 |
c-- One could of course do a global sum here. |
129 |
vartile = 0. _d 0 |
130 |
do bj = jtlo,jthi |
131 |
do bi = itlo,ithi |
132 |
do j = jmin,jmax |
133 |
do i = imin,imax |
134 |
vartile=vartile+scatxdat(i,j,bi,bj)*scatxdat(i,j,bi,bj) |
135 |
enddo |
136 |
enddo |
137 |
enddo |
138 |
enddo |
139 |
|
140 |
if (nobs .gt. 0) then |
141 |
vartile = vartile/float(nobs) |
142 |
else |
143 |
vartile = spval |
144 |
endif |
145 |
|
146 |
return |
147 |
end |
148 |
|