NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3ft202.f
Go to the documentation of this file.
1C> @file
2C> @brief Convert (361,91) grid to (65,43) n. hemi. grid
3C> @author Ralph Jones @date 1994-05-18
4
5C> Convert a northern hemisphere 1.0 degree lat.,lon. 361 by
6C> 91 grid to a polar stereographic 65 by 43 grid. The polar
7C> stereographic map projection is true at 60 deg. n. , The mesh
8C> length is 190.5 km. and the oriention is 105 deg. w.
9C>
10C> ### Program History Log:
11C> Date | Programmer | Comment
12C> -----|------------|--------
13C> 1994-05-18 | Ralph Jones | Initial.
14C>
15C> @param[in] ALOLA 361*91 grid 1.0 lat,lon grid n. hemisphere 32851 point
16C> grid is o.n. 84 type ?? or ?? hex
17C> @param[in] INTERP 1 linear interpolation , ne.1 biquadratic
18C> @param[out] APOLA 65*43 grid of northern hemisphere. 2795 point grid is
19C> awips grid type 202
20C>
21C> @note
22C> - 1. W1 and w2 are used to store sets of constants which are
23C> reusable for repeated calls to the subroutine.
24C> - 2. Wind components are not rotated to the 65*43 grid orientation
25C> after interpolation. You may use w3fc08() to do this.
26C> - 3. The grid points values on the equator have been extrapolated
27C> outward to all the grid points outside the equator on the 65*43
28C> grid (about 1100 points).
29C>
30C> @author Ralph Jones @date 1994-05-18
31 SUBROUTINE w3ft202(ALOLA,APOLA,INTERP)
32C
33 parameter(npts=2795,ii=65,jj=43)
34 parameter(orient=105.0,ipole=33,jpole=45)
35 parameter(xmesh=190.5)
36C
37 REAL R2(NPTS), WLON(NPTS)
38 REAL XLAT(NPTS), XI(II,JJ), XJ(II,JJ)
39 REAL XII(NPTS), XJJ(NPTS), ANGLE(NPTS)
40 REAL ALOLA(361,91), APOLA(NPTS), ERAS(NPTS,4)
41 REAL W1(NPTS), W2(NPTS)
42 REAL XDELI(NPTS), XDELJ(NPTS)
43 REAL XI2TM(NPTS), XJ2TM(NPTS)
44C
45 INTEGER IV(NPTS), JV(NPTS), JY(NPTS,4)
46 INTEGER IM1(NPTS), IP1(NPTS), IP2(NPTS)
47C
48 LOGICAL LIN
49C
50 SAVE
51C
52 equivalence(xi(1,1),xii(1)),(xj(1,1),xjj(1))
53C
54 DATA degprd/57.2957795/
55 DATA earthr/6371.2/
56 DATA intrpo/99/
57 DATA iswt /0/
58C
59 lin = .false.
60 IF (interp.EQ.1) lin = .true.
61C
62 IF (iswt.EQ.1) GO TO 900
63C
64 deg = 1.0
65 gi2 = (1.86603 * earthr) / xmesh
66 gi2 = gi2 * gi2
67C
68C NEXT 32 LINES OF CODE PUTS SUBROUTINE W3FB01 IN LINE
69C
70 DO 100 j = 1,jj
71 xj1 = j - jpole
72 DO 100 i = 1,ii
73 xi(i,j) = i - ipole
74 xj(i,j) = xj1
75 100 CONTINUE
76C
77 DO 200 kk = 1,npts
78 r2(kk) = xjj(kk) * xjj(kk) + xii(kk) * xii(kk)
79 xlat(kk) = degprd *
80 & asin((gi2 - r2(kk)) / (gi2 + r2(kk)))
81 200 CONTINUE
82C
83 DO 300 kk = 1,npts
84 angle(kk) = degprd * atan2(xjj(kk),xii(kk))
85 300 CONTINUE
86C
87 DO 400 kk = 1,npts
88 IF (angle(kk).LT.0.0) angle(kk) = angle(kk) + 360.0
89 400 CONTINUE
90C
91 DO 500 kk = 1,npts
92 wlon(kk) = 270.0 + orient - angle(kk)
93 500 CONTINUE
94C
95 DO 600 kk = 1,npts
96 IF (wlon(kk).LT.0.0) wlon(kk) = wlon(kk) + 360.0
97 600 CONTINUE
98C
99 DO 700 kk = 1,npts
100 IF (wlon(kk).GE.360.0) wlon(kk) = wlon(kk) - 360.0
101 700 CONTINUE
102C
103 DO 800 kk = 1,npts
104 w1(kk) = (360.0 - wlon(kk)) / deg + 1.0
105 w2(kk) = xlat(kk) / deg + 1.0
106 800 CONTINUE
107C
108 iswt = 1
109 intrpo = interp
110 GO TO 1000
111C
112C AFTER THE 1ST CALL TO W3FT202 TEST INTERP, IF IT HAS
113C CHANGED RECOMPUTE SOME CONSTANTS
114C
115 900 CONTINUE
116 IF (interp.EQ.intrpo) GO TO 2100
117 intrpo = interp
118C
119 1000 CONTINUE
120 DO 1100 k = 1,npts
121 iv(k) = w1(k)
122 jv(k) = w2(k)
123 xdeli(k) = w1(k) - iv(k)
124 xdelj(k) = w2(k) - jv(k)
125 ip1(k) = iv(k) + 1
126 jy(k,3) = jv(k) + 1
127 jy(k,2) = jv(k)
128 1100 CONTINUE
129C
130 IF (lin) GO TO 2100
131C
132 DO 1200 k = 1,npts
133 ip2(k) = iv(k) + 2
134 im1(k) = iv(k) - 1
135 jy(k,1) = jv(k) - 1
136 jy(k,4) = jv(k) + 2
137 xi2tm(k) = xdeli(k) * (xdeli(k) - 1.0) * .25
138 xj2tm(k) = xdelj(k) * (xdelj(k) - 1.0) * .25
139 1200 CONTINUE
140C
141 2100 CONTINUE
142 IF (lin) THEN
143C
144C LINEAR INTERPOLATION
145C
146 DO 2200 kk = 1,npts
147 eras(kk,2) = (alola(ip1(kk),jy(kk,2))-alola(iv(kk),jy(kk,2)))
148 & * xdeli(kk) + alola(iv(kk),jy(kk,2))
149 eras(kk,3) = (alola(ip1(kk),jy(kk,3))-alola(iv(kk),jy(kk,3)))
150 & * xdeli(kk) + alola(iv(kk),jy(kk,3))
151 2200 CONTINUE
152C
153 DO 2300 kk = 1,npts
154 apola(kk) = eras(kk,2) + (eras(kk,3) - eras(kk,2))
155 & * xdelj(kk)
156 2300 CONTINUE
157C
158 ELSE
159C
160C QUADRATIC INTERPOLATION
161C
162 DO 2400 kk = 1,npts
163 eras(kk,1)=(alola(ip1(kk),jy(kk,1))-alola(iv(kk),jy(kk,1)))
164 & * xdeli(kk) + alola(iv(kk),jy(kk,1)) +
165 & ( alola(im1(kk),jy(kk,1)) - alola(iv(kk),jy(kk,1))
166 & - alola(ip1(kk),jy(kk,1))+alola(ip2(kk),jy(kk,1)))
167 & * xi2tm(kk)
168 eras(kk,2)=(alola(ip1(kk),jy(kk,2))-alola(iv(kk),jy(kk,2)))
169 & * xdeli(kk) + alola(iv(kk),jy(kk,2)) +
170 & ( alola(im1(kk),jy(kk,2)) - alola(iv(kk),jy(kk,2))
171 & - alola(ip1(kk),jy(kk,2))+alola(ip2(kk),jy(kk,2)))
172 & * xi2tm(kk)
173 eras(kk,3)=(alola(ip1(kk),jy(kk,3))-alola(iv(kk),jy(kk,3)))
174 & * xdeli(kk) + alola(iv(kk),jy(kk,3)) +
175 & ( alola(im1(kk),jy(kk,3)) - alola(iv(kk),jy(kk,3))
176 & - alola(ip1(kk),jy(kk,3))+alola(ip2(kk),jy(kk,3)))
177 & * xi2tm(kk)
178 eras(kk,4)=(alola(ip1(kk),jy(kk,4))-alola(iv(kk),jy(kk,4)))
179 & * xdeli(kk) + alola(iv(kk),jy(kk,4)) +
180 & ( alola(im1(kk),jy(kk,4)) - alola(iv(kk),jy(kk,4))
181 & - alola(ip1(kk),jy(kk,4))+alola(ip2(kk),jy(kk,4)))
182 & * xi2tm(kk)
183 2400 CONTINUE
184C
185 DO 2500 kk = 1,npts
186 apola(kk) = eras(kk,2) + (eras(kk,3) - eras(kk,2))
187 & * xdelj(kk) + (eras(kk,1) - eras(kk,2)
188 & - eras(kk,3) + eras(kk,4)) * xj2tm(kk)
189 2500 CONTINUE
190C
191 ENDIF
192C
193 RETURN
194 END
subroutine w3ft202(alola, apola, interp)
Convert a northern hemisphere 1.0 degree lat.,lon.
Definition w3ft202.f:32