NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3fm07.f
Go to the documentation of this file.
1C> @file
2C> @brief Nine-point smoother for rectangular grids.
3C> @author P. Chase @date 1975-04-01
4
5C> Smooths data on a rectangular grid using a nine-point
6C> smoothing operator.
7C>
8C> Program history log:
9C> P. Chase 1975-04-01
10C> Ralph Jones 1984-07-01 Change to ibm vs fortran
11C> Ralph Jones 1991-04-24 Change to cray cft77 fortran
12C>
13C> @param[in] FIN - Real size(ncol*nrow) array of data to be smoothed
14C> @param[in] CWORK - Real size(2*ncol*(nrow+2)) work array
15C> @param[in] GAMMA - Complex smoothing parameter. The imaginary part must
16C> be positive.
17C> @param[in] NCOL - Integer number of columns in the grid
18C> @param[in] NROW - Integer number of rows in the grid
19C> @param[out] FOUT - Real size(ncol*nrow) array of smoothed data. May
20C> be the same array as 'fin' or overlap it in any fashion.
21C>
22C> @author P. Chase @date 1975-04-01
23 SUBROUTINE w3fm07(FIN,FOUT,CWORK,GAMMA,NCOL,NROW)
24C
25 REAL FIN(NCOL,NROW)
26 REAL FOUT(NCOL,NROW)
27C
28 COMPLEX CWORK(NCOL,*),GAMMA,GAMMX,GAMA,GAMB,GAMC
29C
30 gammx = gamma
31 xswtch = aimag(gammx)
32 ncolm = ncol-1
33 nrowm = nrow-1
34C
35C INITIALIZE WORK ARRAY. WORK ARRAY STARTS UP TWO ROWS SO IT CAN SMOOTH
36C DOWNWARD WITHOUT OVERLAP OF SMOOTHED AND UNSMOOTHED DATA
37C
38 DO 10 j = 1,nrow
39 DO 10 i = 1,ncol
40 cwork(i,j+2) = cmplx(fin(i,j),0.)
41 10 CONTINUE
42 IF (xswtch .EQ. 0.) GO TO 30
43 DO 20 j = 1,nrow,nrowm
44 jj = j+isign(1,nrowm-j)
45 DO 20 i = 1,ncol,ncolm
46 ii = i+isign(1,ncolm-i)
47 cwork(i,j+2) = cmplx(fin(i,jj)+fin(ii,j)-fin(ii,jj),0.)
48 20 CONTINUE
49C
50C SET SMOOTHING OPERATORS
51C
52 30 gama = 0.50 * gammx * (1.0 - gammx)
53 gamb = 0.25 * gammx * gammx
54 gamc = 0.50 * gammx
55C
56C SMOOTH WORK ARRAY, PUTTING SMOOTHED POINTS DOWN TWO ROWS
57C
58 cwork(1,1) = cwork(1,3)
59 cwork(ncol,1) = cwork(ncol,3)
60 DO 40 i = 2,ncolm
61 cwork(i,1) = cwork(i,3)+gamc*(cwork(i-1,3)-2.*cwork(i,3)+
62 & cwork(i+1,3))
63 40 CONTINUE
64 DO 60 j = 2,nrowm
65 DO 50 i = 1,ncol,ncolm
66 cwork(i,j) = cwork(i,j+2)+gamc*(cwork(i,j+1)-2.*cwork(i,j+2)+
67 & cwork(i,j+3))
68 50 CONTINUE
69 DO 60 i = 2,ncolm
70 cwork(i,j) = cwork(i,j+2)+gama*(cwork(i+1,j+2)+cwork(i-1,j+2)+
71 & cwork(i,j+1)+cwork(i,j+3)-4.*cwork(i,j+2))+gamb*(cwork(i-1,j+1)+
72 & cwork(i+1,j+1)+cwork(i-1,j+3)+cwork(i+1,j+3)-4.*cwork(i,j+2))
73 60 CONTINUE
74 cwork(1,nrow) = cwork(1,nrow+2)
75 cwork(ncol,nrow) = cwork(ncol,nrow+2)
76 DO 70 i = 2,ncolm
77 cwork(i,nrow) = cwork(i,nrow+2)+gamc*(cwork(i-1,nrow+2)-2.*
78 & cwork(i,nrow+2)+cwork(i+1,nrow+2))
79 70 CONTINUE
80C
81C IF IMAGINARY PART OF SMOOTHING PARAMETER IS NOT POSITIVE, DONE
82C
83 IF (xswtch .LE. 0.) GO TO 90
84C
85C OTHERWISE MOVE WORK ARRAY BACK UP TWO ROWS
86C
87 DO 80 jj=1,nrow
88 j = nrow+1-jj
89 DO 80 i=1,ncol
90 cwork(i,j+2) = cwork(i,j)
91 80 CONTINUE
92C
93C SET SMOOTHING PARAMETER FOR CONJUGATE PASS AND GO DO IT
94C
95 gammx = conjg(gammx)
96 xswtch = aimag(gammx)
97 GO TO 30
98C
99C DONE. OUTPUT SMOOTH ARRAY
100C
101 90 DO 100 j = 1,nrow
102 DO 100 i = 1,ncol
103 fout(i,j) = real(cwork(i,j))
104 100 CONTINUE
105 RETURN
106 END
subroutine w3fm07(fin, fout, cwork, gamma, ncol, nrow)
Smooths data on a rectangular grid using a nine-point smoothing operator.
Definition w3fm07.f:24