1 | ! |
---|
2 | ! $Id: grid_noro.F 1442 2010-10-18 08:31:31Z jghattas $ |
---|
3 | ! |
---|
4 | c |
---|
5 | c |
---|
6 | SUBROUTINE grid_noro(imdep, jmdep, xdata, ydata, zdata, |
---|
7 | . imar, jmar, x, y, |
---|
8 | . zphi,zmea,zstd,zsig,zgam,zthe, |
---|
9 | . zpic,zval) |
---|
10 | c======================================================================= |
---|
11 | c (F. Lott) (voir aussi z.x. Li, A. Harzallah et L. Fairhead) |
---|
12 | c |
---|
13 | c Compute the Parameters of the SSO scheme as described in |
---|
14 | c LOTT & MILLER (1997) and LOTT(1999). |
---|
15 | c Target points are on a rectangular grid: |
---|
16 | c iim+1 latitudes including North and South Poles; |
---|
17 | c jjm+1 longitudes, with periodicity jjm+1=1. |
---|
18 | c aux poles. At the poles the fields value is repeated |
---|
19 | c jjm+1 time. |
---|
20 | c The parameters a,b,c,d represent the limite of the target |
---|
21 | c gridpoint region. The means over this region are calculated |
---|
22 | c from USN data, ponderated by a weight proportional to the |
---|
23 | c surface occupated by the data inside the model gridpoint area. |
---|
24 | c In most circumstances, this weight is the ratio between the |
---|
25 | c surface of the USN gridpoint area and the surface of the |
---|
26 | c model gridpoint area. |
---|
27 | c |
---|
28 | c (c) |
---|
29 | c ----d----- |
---|
30 | c | . . . .| |
---|
31 | c | | |
---|
32 | c (b)a . * . .b(a) |
---|
33 | c | | |
---|
34 | c | . . . .| |
---|
35 | c ----c----- |
---|
36 | c (d) |
---|
37 | C======================================================================= |
---|
38 | c INPUT: |
---|
39 | c imdep, jmdep: dimensions X and Y input field |
---|
40 | c xdata, ydata: coordinates X and Y input field |
---|
41 | c zdata: Input field |
---|
42 | c OUTPUT: |
---|
43 | c imar, jmar: dimensions X and Y Output field |
---|
44 | c x, y: ccordinates X and Y Output field. |
---|
45 | c zmea: Mean orographie |
---|
46 | c zstd: Standard deviation |
---|
47 | c zsig: Slope |
---|
48 | c zgam: Anisotropy |
---|
49 | c zthe: Orientation of the small axis |
---|
50 | c zpic: Maximum altitude |
---|
51 | c zval: Minimum altitude |
---|
52 | C======================================================================= |
---|
53 | |
---|
54 | IMPLICIT none |
---|
55 | |
---|
56 | #include "dimensions.h" |
---|
57 | #include "YOMCST.h" |
---|
58 | |
---|
59 | INTEGER imdep, jmdep |
---|
60 | REAL xdata(imdep),ydata(jmdep) |
---|
61 | REAL zdata(imdep,jmdep) |
---|
62 | c |
---|
63 | INTEGER imar, jmar |
---|
64 | c parametres lies au fichier d entree... A documenter... |
---|
65 | integer iext |
---|
66 | parameter(iext=216) |
---|
67 | REAL xusn(imdep+2*iext),yusn(jmdep+2) |
---|
68 | REAL zusn(imdep+2*iext,jmdep+2) |
---|
69 | |
---|
70 | c local var |
---|
71 | real zdeltax,zdeltay,zlenx,zleny,xincr |
---|
72 | real zbordnor,zbordsud,zbordest,zbordoue,weighx,weighy |
---|
73 | real zllmmea,zllmstd,zllmsig,zllmgam,zllmpic,zllmval,zllmthe |
---|
74 | real zminthe,xk,xl,xm,xp,xq,xw |
---|
75 | real zmeanor,zmeasud,zstdnor,zstdsud,zsignor,zsigsud |
---|
76 | real zweinor,zweisud,zpicnor,zpicsud,zvalnor,zvalsud |
---|
77 | integer i,j,ii,jj |
---|
78 | |
---|
79 | C INTERMEDIATE FIELDS (CORRELATIONS OF OROGRAPHY GRADIENT) |
---|
80 | |
---|
81 | REAL ztz(iim+1,jjm+1),zxtzx(iim+1,jjm+1) |
---|
82 | REAL zytzy(iim+1,jjm+1),zxtzy(iim+1,jjm+1) |
---|
83 | REAL weight(iim+1,jjm+1) |
---|
84 | |
---|
85 | C CORRELATIONS OF USN OROGRAPHY GRADIENTS |
---|
86 | |
---|
87 | REAL zxtzxusn(imdep+2*iext,jmdep+2) |
---|
88 | REAL zytzyusn(imdep+2*iext,jmdep+2) |
---|
89 | REAL zxtzyusn(imdep+2*iext,jmdep+2) |
---|
90 | REAL x(imar+1),y(jmar),zphi(imar+1,jmar) |
---|
91 | REAL zmea(imar+1,jmar),zstd(imar+1,jmar) |
---|
92 | REAL zsig(imar+1,jmar),zgam(imar+1,jmar),zthe(imar+1,jmar) |
---|
93 | REAL zpic(imar+1,jmar),zval(imar+1,jmar) |
---|
94 | real num_tot(2200,1100),num_lan(2200,1100) |
---|
95 | |
---|
96 | REAL a(2200),b(2200),c(1100),d(1100) |
---|
97 | |
---|
98 | c pas defini puisque pas de physique dans newstart... |
---|
99 | RPI=2.*ASIN(1.) |
---|
100 | RA=2575000. |
---|
101 | |
---|
102 | print *,' parametres de l orographie a l echelle sous maille' |
---|
103 | |
---|
104 | zdeltay=2.*RPI/REAL(jmdep)*RA |
---|
105 | c |
---|
106 | c quelques tests de dimensions: |
---|
107 | c |
---|
108 | c |
---|
109 | if(iim.ne.imar) STOP 'Problem dim. x' |
---|
110 | if(jjm.ne.jmar-1) STOP 'Problem dim. y' |
---|
111 | IF (imar.GT.2200 .OR. jmar.GT.1100) THEN |
---|
112 | PRINT*, 'imar or jmar too big', imar, jmar |
---|
113 | CALL ABORT |
---|
114 | ENDIF |
---|
115 | |
---|
116 | IF(imar+1.ne.iim+1.or.jmar.ne.jjm+1)THEN |
---|
117 | print *,' imar or jmar bad dimensions:',imar,jmar |
---|
118 | call abort |
---|
119 | ENDIF |
---|
120 | |
---|
121 | |
---|
122 | c print *,'xdata:',xdata |
---|
123 | c print *,'ydata:',ydata |
---|
124 | c print *,'x:',x |
---|
125 | c print *,'y:',y |
---|
126 | c |
---|
127 | C EXTENSION OF THE USN DATABASE TO POCEED COMPUTATIONS AT |
---|
128 | C BOUNDARIES: |
---|
129 | c |
---|
130 | DO j=1,jmdep |
---|
131 | yusn(j+1)=ydata(j) |
---|
132 | DO i=1,imdep |
---|
133 | zusn(i+iext,j+1)=zdata(i,j) |
---|
134 | xusn(i+iext)=xdata(i) |
---|
135 | ENDDO |
---|
136 | DO i=1,iext |
---|
137 | zusn(i,j+1)=zdata(imdep-iext+i,j) |
---|
138 | xusn(i)=xdata(imdep-iext+i)-2.*RPI |
---|
139 | zusn(imdep+iext+i,j+1)=zdata(i,j) |
---|
140 | xusn(imdep+iext+i)=xdata(i)+2.*RPI |
---|
141 | ENDDO |
---|
142 | ENDDO |
---|
143 | |
---|
144 | yusn(1)=ydata(1)+(ydata(1)-ydata(2)) |
---|
145 | yusn(jmdep+2)=ydata(jmdep)+(ydata(jmdep)-ydata(jmdep-1)) |
---|
146 | DO i=1,imdep/2+iext |
---|
147 | zusn(i,1)=zusn(i+imdep/2,2) |
---|
148 | zusn(i+imdep/2+iext,1)=zusn(i,2) |
---|
149 | zusn(i,jmdep+2)=zusn(i+imdep/2,jmdep+1) |
---|
150 | zusn(i+imdep/2+iext,jmdep+2)=zusn(i,jmdep+1) |
---|
151 | ENDDO |
---|
152 | c |
---|
153 | c COMPUTE LIMITS OF MODEL GRIDPOINT AREA |
---|
154 | C ( REGULAR GRID) |
---|
155 | c |
---|
156 | a(1) = x(1) - (x(2)-x(1))/2.0 |
---|
157 | b(1) = (x(1)+x(2))/2.0 |
---|
158 | DO i = 2, imar |
---|
159 | a(i) = b(i-1) |
---|
160 | b(i) = (x(i)+x(i+1))/2.0 |
---|
161 | ENDDO |
---|
162 | a(imar+1) = b(imar) |
---|
163 | b(imar+1) = x(imar+1) + (x(imar+1)-x(imar))/2.0 |
---|
164 | |
---|
165 | c(1) = y(1) - (y(2)-y(1))/2.0 |
---|
166 | d(1) = (y(1)+y(2))/2.0 |
---|
167 | DO j = 2, jmar-1 |
---|
168 | c(j) = d(j-1) |
---|
169 | d(j) = (y(j)+y(j+1))/2.0 |
---|
170 | ENDDO |
---|
171 | c(jmar) = d(jmar-1) |
---|
172 | d(jmar) = y(jmar) + (y(jmar)-y(jmar-1))/2.0 |
---|
173 | c |
---|
174 | c initialisations: |
---|
175 | c |
---|
176 | DO i = 1, imar+1 |
---|
177 | DO j = 1, jmar |
---|
178 | weight(i,j) = 0.0 |
---|
179 | zxtzx(i,j) = 0.0 |
---|
180 | zytzy(i,j) = 0.0 |
---|
181 | zxtzy(i,j) = 0.0 |
---|
182 | ztz(i,j) = 0.0 |
---|
183 | zmea(i,j) = 0.0 |
---|
184 | zpic(i,j) =-1.E+10 |
---|
185 | zval(i,j) = 1.E+10 |
---|
186 | ENDDO |
---|
187 | ENDDO |
---|
188 | c |
---|
189 | c COMPUTE SLOPES CORRELATIONS ON USN GRID |
---|
190 | c |
---|
191 | DO j = 1,jmdep+2 |
---|
192 | DO i = 1, imdep+2*iext |
---|
193 | zytzyusn(i,j)=0.0 |
---|
194 | zxtzxusn(i,j)=0.0 |
---|
195 | zxtzyusn(i,j)=0.0 |
---|
196 | ENDDO |
---|
197 | ENDDO |
---|
198 | |
---|
199 | |
---|
200 | DO j = 2,jmdep+1 |
---|
201 | zdeltax=zdeltay*cos(yusn(j)) |
---|
202 | DO i = 2, imdep+2*iext-1 |
---|
203 | zytzyusn(i,j)=(zusn(i,j+1)-zusn(i,j-1))**2/zdeltay**2 |
---|
204 | zxtzxusn(i,j)=(zusn(i+1,j)-zusn(i-1,j))**2/zdeltax**2 |
---|
205 | zxtzyusn(i,j)=(zusn(i,j+1)-zusn(i,j-1))/zdeltay |
---|
206 | * *(zusn(i+1,j)-zusn(i-1,j))/zdeltax |
---|
207 | ENDDO |
---|
208 | ENDDO |
---|
209 | c |
---|
210 | c SUMMATION OVER GRIDPOINT AREA |
---|
211 | c |
---|
212 | zleny=RPI/REAL(jmdep)*RA |
---|
213 | xincr=RPI/2./REAL(jmdep) |
---|
214 | DO ii = 1, imar+1 |
---|
215 | DO jj = 1, jmar |
---|
216 | num_tot(ii,jj)=0. |
---|
217 | num_lan(ii,jj)=0. |
---|
218 | c PRINT *,' iteration ii jj:',ii,jj |
---|
219 | DO j = 2,jmdep+1 |
---|
220 | c DO j = 3,jmdep |
---|
221 | zlenx=zleny*cos(yusn(j)) |
---|
222 | zdeltax=zdeltay*cos(yusn(j)) |
---|
223 | zbordnor=(c(jj)-yusn(j)+xincr)*RA |
---|
224 | zbordsud=(yusn(j)-d(jj)+xincr)*RA |
---|
225 | weighy=AMAX1(0., |
---|
226 | * amin1(zbordnor,zbordsud,zleny)) |
---|
227 | IF(weighy.ne.0)THEN |
---|
228 | DO i = 2, imdep+2*iext-1 |
---|
229 | zbordest=(xusn(i)-a(ii)+xincr)*RA*cos(yusn(j)) |
---|
230 | zbordoue=(b(ii)+xincr-xusn(i))*RA*cos(yusn(j)) |
---|
231 | weighx=AMAX1(0., |
---|
232 | * amin1(zbordest,zbordoue,zlenx)) |
---|
233 | IF(weighx.ne.0)THEN |
---|
234 | num_tot(ii,jj)=num_tot(ii,jj)+1.0 |
---|
235 | if(zusn(i,j).ge.1.)num_lan(ii,jj)=num_lan(ii,jj)+1.0 |
---|
236 | weight(ii,jj)=weight(ii,jj)+weighx*weighy |
---|
237 | zxtzx(ii,jj)=zxtzx(ii,jj)+zxtzxusn(i,j)*weighx*weighy |
---|
238 | zytzy(ii,jj)=zytzy(ii,jj)+zytzyusn(i,j)*weighx*weighy |
---|
239 | zxtzy(ii,jj)=zxtzy(ii,jj)+zxtzyusn(i,j)*weighx*weighy |
---|
240 | ztz(ii,jj) =ztz(ii,jj) +zusn(i,j)*zusn(i,j)*weighx*weighy |
---|
241 | c mean |
---|
242 | zmea(ii,jj) =zmea(ii,jj)+zusn(i,j)*weighx*weighy |
---|
243 | c peacks |
---|
244 | zpic(ii,jj)=amax1(zpic(ii,jj),zusn(i,j)) |
---|
245 | c valleys |
---|
246 | zval(ii,jj)=amin1(zval(ii,jj),zusn(i,j)) |
---|
247 | ENDIF |
---|
248 | ENDDO |
---|
249 | ENDIF |
---|
250 | ENDDO |
---|
251 | ENDDO |
---|
252 | ENDDO |
---|
253 | c |
---|
254 | c COMPUTE PARAMETERS NEEDED BY THE LOTT & MILLER (1997) AND |
---|
255 | C LOTT (1999) SSO SCHEME. |
---|
256 | c |
---|
257 | zllmmea=0. |
---|
258 | zllmstd=0. |
---|
259 | zllmsig=0. |
---|
260 | zllmgam=0. |
---|
261 | zllmpic=0. |
---|
262 | zllmval=0. |
---|
263 | zllmthe=0. |
---|
264 | zminthe=0. |
---|
265 | c print 100,' ' |
---|
266 | c100 format(1X,A1,'II JJ',4X,'H',8X,'SD',8X,'SI',3X,'GA',3X,'TH') |
---|
267 | DO ii = 1, imar+1 |
---|
268 | DO jj = 1, jmar |
---|
269 | IF (weight(ii,jj) .NE. 0.0) THEN |
---|
270 | c Mean Orography: |
---|
271 | zmea (ii,jj)=zmea (ii,jj)/weight(ii,jj) |
---|
272 | zxtzx(ii,jj)=zxtzx(ii,jj)/weight(ii,jj) |
---|
273 | zytzy(ii,jj)=zytzy(ii,jj)/weight(ii,jj) |
---|
274 | zxtzy(ii,jj)=zxtzy(ii,jj)/weight(ii,jj) |
---|
275 | ztz(ii,jj) =ztz(ii,jj)/weight(ii,jj) |
---|
276 | c Standard deviation: |
---|
277 | zstd(ii,jj)=sqrt(AMAX1(0.,ztz(ii,jj)-zmea(ii,jj)**2)) |
---|
278 | ELSE |
---|
279 | PRINT*, 'probleme,ii,jj=', ii,jj |
---|
280 | ENDIF |
---|
281 | ENDDO |
---|
282 | ENDDO |
---|
283 | |
---|
284 | C CORRECT VALUES OF HORIZONTAL SLOPE NEAR THE POLES: |
---|
285 | |
---|
286 | DO ii = 1, imar+1 |
---|
287 | zxtzx(ii,1)=zxtzx(ii,2) |
---|
288 | zxtzx(ii,jmar)=zxtzx(ii,jmar-1) |
---|
289 | zxtzy(ii,1)=zxtzy(ii,2) |
---|
290 | zxtzy(ii,jmar)=zxtzy(ii,jmar-1) |
---|
291 | zytzy(ii,1)=zytzy(ii,2) |
---|
292 | zytzy(ii,jmar)=zytzy(ii,jmar-1) |
---|
293 | ENDDO |
---|
294 | |
---|
295 | C FILTERS TO SMOOTH OUT FIELDS FOR INPUT INTO SSO SCHEME. |
---|
296 | |
---|
297 | C FIRST FILTER, MOVING AVERAGE OVER 9 POINTS. |
---|
298 | |
---|
299 | CALL MVA9(zmea,iim+1,jjm+1) |
---|
300 | CALL MVA9(zstd,iim+1,jjm+1) |
---|
301 | CALL MVA9(zpic,iim+1,jjm+1) |
---|
302 | CALL MVA9(zval,iim+1,jjm+1) |
---|
303 | CALL MVA9(zxtzx,iim+1,jjm+1) |
---|
304 | CALL MVA9(zxtzy,iim+1,jjm+1) |
---|
305 | CALL MVA9(zytzy,iim+1,jjm+1) |
---|
306 | |
---|
307 | DO ii = 1, imar |
---|
308 | DO jj = 1, jmar |
---|
309 | IF (weight(ii,jj) .NE. 0.0) THEN |
---|
310 | c Coefficients K, L et M: |
---|
311 | xk=(zxtzx(ii,jj)+zytzy(ii,jj))/2. |
---|
312 | xl=(zxtzx(ii,jj)-zytzy(ii,jj))/2. |
---|
313 | xm=zxtzy(ii,jj) |
---|
314 | xp=xk-sqrt(xl**2+xm**2) |
---|
315 | xq=xk+sqrt(xl**2+xm**2) |
---|
316 | xw=1.e-8 |
---|
317 | if(xp.le.xw) xp=0. |
---|
318 | if(xq.le.xw) xq=xw |
---|
319 | if(abs(xm).le.xw) xm=xw*sign(1.,xm) |
---|
320 | c slope: |
---|
321 | zsig(ii,jj)=sqrt(xq) |
---|
322 | c isotropy: |
---|
323 | zgam(ii,jj)=xp/xq |
---|
324 | c angle theta: |
---|
325 | zthe(ii,jj)=57.29577951*atan2(xm,xl)/2. |
---|
326 | zphi(ii,jj)=zmea(ii,jj) |
---|
327 | ! |
---|
328 | zmea(ii,jj)=zmea(ii,jj) |
---|
329 | zpic(ii,jj)=zpic(ii,jj) |
---|
330 | zval(ii,jj)=zval(ii,jj) |
---|
331 | zstd(ii,jj)=zstd(ii,jj) |
---|
332 | c print 101,ii,jj, |
---|
333 | c * zmea(ii,jj),zstd(ii,jj),zsig(ii,jj),zgam(ii,jj), |
---|
334 | c * zthe(ii,jj) |
---|
335 | c101 format(1x,2(1x,i2),2(1x,f7.1),1x,f7.4,2x,f4.2,1x,f5.1) |
---|
336 | ELSE |
---|
337 | c PRINT*, 'probleme,ii,jj=', ii,jj |
---|
338 | ENDIF |
---|
339 | zllmmea=AMAX1(zmea(ii,jj),zllmmea) |
---|
340 | zllmstd=AMAX1(zstd(ii,jj),zllmstd) |
---|
341 | zllmsig=AMAX1(zsig(ii,jj),zllmsig) |
---|
342 | zllmgam=AMAX1(zgam(ii,jj),zllmgam) |
---|
343 | zllmthe=AMAX1(zthe(ii,jj),zllmthe) |
---|
344 | zminthe=amin1(zthe(ii,jj),zminthe) |
---|
345 | zllmpic=AMAX1(zpic(ii,jj),zllmpic) |
---|
346 | zllmval=AMAX1(zval(ii,jj),zllmval) |
---|
347 | ENDDO |
---|
348 | ENDDO |
---|
349 | print *,' MEAN ORO:',zllmmea |
---|
350 | print *,' ST. DEV.:',zllmstd |
---|
351 | print *,' PENTE:',zllmsig |
---|
352 | print *,' ANISOTROP:',zllmgam |
---|
353 | print *,' ANGLE:',zminthe,zllmthe |
---|
354 | print *,' pic:',zllmpic |
---|
355 | print *,' val:',zllmval |
---|
356 | |
---|
357 | C |
---|
358 | c gamma and theta a 1. and 0. at poles |
---|
359 | c |
---|
360 | DO jj=1,jmar |
---|
361 | zmea(imar+1,jj)=zmea(1,jj) |
---|
362 | zphi(imar+1,jj)=zphi(1,jj) |
---|
363 | zpic(imar+1,jj)=zpic(1,jj) |
---|
364 | zval(imar+1,jj)=zval(1,jj) |
---|
365 | zstd(imar+1,jj)=zstd(1,jj) |
---|
366 | zsig(imar+1,jj)=zsig(1,jj) |
---|
367 | zgam(imar+1,jj)=zgam(1,jj) |
---|
368 | zthe(imar+1,jj)=zthe(1,jj) |
---|
369 | ENDDO |
---|
370 | |
---|
371 | |
---|
372 | zmeanor=0.0 |
---|
373 | zmeasud=0.0 |
---|
374 | zstdnor=0.0 |
---|
375 | zstdsud=0.0 |
---|
376 | zsignor=0.0 |
---|
377 | zsigsud=0.0 |
---|
378 | zweinor=0.0 |
---|
379 | zweisud=0.0 |
---|
380 | zpicnor=0.0 |
---|
381 | zpicsud=0.0 |
---|
382 | zvalnor=0.0 |
---|
383 | zvalsud=0.0 |
---|
384 | |
---|
385 | DO ii=1,imar |
---|
386 | zweinor=zweinor+ weight(ii, 1) |
---|
387 | zweisud=zweisud+ weight(ii,jmar) |
---|
388 | zmeanor=zmeanor+zmea(ii, 1)*weight(ii, 1) |
---|
389 | zmeasud=zmeasud+zmea(ii,jmar)*weight(ii,jmar) |
---|
390 | zstdnor=zstdnor+zstd(ii, 1)*weight(ii, 1) |
---|
391 | zstdsud=zstdsud+zstd(ii,jmar)*weight(ii,jmar) |
---|
392 | zsignor=zsignor+zsig(ii, 1)*weight(ii, 1) |
---|
393 | zsigsud=zsigsud+zsig(ii,jmar)*weight(ii,jmar) |
---|
394 | zpicnor=zpicnor+zpic(ii, 1)*weight(ii, 1) |
---|
395 | zpicsud=zpicsud+zpic(ii,jmar)*weight(ii,jmar) |
---|
396 | zvalnor=zvalnor+zval(ii, 1)*weight(ii, 1) |
---|
397 | zvalsud=zvalsud+zval(ii,jmar)*weight(ii,jmar) |
---|
398 | ENDDO |
---|
399 | |
---|
400 | DO ii=1,imar+1 |
---|
401 | zmea(ii, 1)=zmeanor/zweinor |
---|
402 | zmea(ii,jmar)=zmeasud/zweisud |
---|
403 | zphi(ii, 1)=zmeanor/zweinor |
---|
404 | zphi(ii,jmar)=zmeasud/zweisud |
---|
405 | zpic(ii, 1)=zpicnor/zweinor |
---|
406 | zpic(ii,jmar)=zpicsud/zweisud |
---|
407 | zval(ii, 1)=zvalnor/zweinor |
---|
408 | zval(ii,jmar)=zvalsud/zweisud |
---|
409 | zstd(ii, 1)=zstdnor/zweinor |
---|
410 | zstd(ii,jmar)=zstdsud/zweisud |
---|
411 | zsig(ii, 1)=zsignor/zweinor |
---|
412 | zsig(ii,jmar)=zsigsud/zweisud |
---|
413 | zgam(ii, 1)=1. |
---|
414 | zgam(ii,jmar)=1. |
---|
415 | zthe(ii, 1)=0. |
---|
416 | zthe(ii,jmar)=0. |
---|
417 | ENDDO |
---|
418 | |
---|
419 | RETURN |
---|
420 | END |
---|
421 | |
---|
422 | SUBROUTINE MVA9(X,IMAR,JMAR) |
---|
423 | |
---|
424 | C MAKE A MOVING AVERAGE OVER 9 GRIDPOINTS OF THE X FIELDS |
---|
425 | |
---|
426 | REAL X(IMAR,JMAR),XF(IMAR,JMAR) |
---|
427 | real WEIGHTpb(-1:1,-1:1) |
---|
428 | |
---|
429 | |
---|
430 | SUM=0. |
---|
431 | DO IS=-1,1 |
---|
432 | DO JS=-1,1 |
---|
433 | WEIGHTpb(IS,JS)=1./REAL((1+IS**2)*(1+JS**2)) |
---|
434 | SUM=SUM+WEIGHTpb(IS,JS) |
---|
435 | ENDDO |
---|
436 | ENDDO |
---|
437 | |
---|
438 | c WRITE(*,*) 'MVA9 ', IMAR, JMAR |
---|
439 | c WRITE(*,*) 'MVA9 ', WEIGHTpb |
---|
440 | c WRITE(*,*) 'MVA9 SUM ', SUM |
---|
441 | DO IS=-1,1 |
---|
442 | DO JS=-1,1 |
---|
443 | WEIGHTpb(IS,JS)=WEIGHTpb(IS,JS)/SUM |
---|
444 | ENDDO |
---|
445 | ENDDO |
---|
446 | |
---|
447 | DO J=2,JMAR-1 |
---|
448 | DO I=2,IMAR-1 |
---|
449 | XF(I,J)=0. |
---|
450 | DO IS=-1,1 |
---|
451 | DO JS=-1,1 |
---|
452 | XF(I,J)=XF(I,J)+X(I+IS,J+JS)*WEIGHTpb(IS,JS) |
---|
453 | ENDDO |
---|
454 | ENDDO |
---|
455 | ENDDO |
---|
456 | ENDDO |
---|
457 | |
---|
458 | DO J=2,JMAR-1 |
---|
459 | XF(1,J)=0. |
---|
460 | IS=IMAR-1 |
---|
461 | DO JS=-1,1 |
---|
462 | XF(1,J)=XF(1,J)+X(IS,J+JS)*WEIGHTpb(-1,JS) |
---|
463 | ENDDO |
---|
464 | DO IS=0,1 |
---|
465 | DO JS=-1,1 |
---|
466 | XF(1,J)=XF(1,J)+X(1+IS,J+JS)*WEIGHTpb(IS,JS) |
---|
467 | ENDDO |
---|
468 | ENDDO |
---|
469 | XF(IMAR,J)=XF(1,J) |
---|
470 | ENDDO |
---|
471 | |
---|
472 | DO I=1,IMAR |
---|
473 | XF(I,1)=XF(I,2) |
---|
474 | XF(I,JMAR)=XF(I,JMAR-1) |
---|
475 | ENDDO |
---|
476 | |
---|
477 | DO I=1,IMAR |
---|
478 | DO J=1,JMAR |
---|
479 | X(I,J)=XF(I,J) |
---|
480 | ENDDO |
---|
481 | ENDDO |
---|
482 | |
---|
483 | RETURN |
---|
484 | END |
---|
485 | |
---|
486 | |
---|
487 | |
---|