NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3ft06.f
Go to the documentation of this file.
1C> @file
2C> @brief Convert (145,37) to (65,65) s. hemi. grid.
3C> @author Ralph Jones @date 1984-06-18
4
5C> Convert a southern hemisphere 2.5 degree lat.,lon. 145 by
6C> 37 grid to a polar stereographic 65 by 65 grid. The polar
7C> stereographic map projection is true at 60 deg. s.; The mesh
8C> length is 381 km. and the oriention is 260 deg. w.(100e).
9C>
10C> ### Program History Log:
11C> Date | Programmer | Comment
12C> -----|------------|--------
13C> 1984-06-18 | Ralph Jones | Initial.
14C> 1991-07-30 | Ralph Jones | Convert to cray cft77 fortran.
15C> 1992-05-02 | Ralph Jones | Add save.
16C>
17C> @param[in] ALOLA 145*37 deg 2.5 lat,lon grid s. hemi.
18C> 5365 point grid is type 30 or 1e hex o.n. 84.
19C> @param[in] LINEAR 1 linear interpolation , ne.1 biquadratic.
20C> @param[out] APOLA 65*65 grid of southern hemi.
21C> 4225 point grid is type 28 or 1c hex o.n. 84.
22C> @param[out] W1 65*65 scratch field.
23C> @param[out] W2 65*65 scratch field. FT06F001 Error message
24C>
25C> @remark
26C> - 1. W1 and w2 are used to store sets of constants which are
27C> reusable for repeated calls to the subroutine. If they are
28C> over written by the user, a warning message will be printed
29C> and w1 and w2 will be recomputed.
30C> - 2. Wind components are not rotated to the 65*65 grid orientation
31C> after interpolation. You may use w3fc10() to do this.
32C> - 3. The grid points values on the equator have been extrapolated
33C> outward to all the grid points outside the equator on the 65*65
34C> grid (about 1100 points).
35C> - 4. You should use the cray vectorized verion w3ft06v() on the cray
36C> it has 3 parameters in the call, runs about times faster, uses
37C> more memory.
38C>
39C> @author Ralph Jones @date 1984-06-18
40 SUBROUTINE w3ft06(ALOLA,APOLA,W1,W2,LINEAR)
41C
42 REAL ALOLA(145,37)
43 REAL APOLA(4225)
44 REAL ERAS(4)
45 REAL SAVEW1(10)
46 REAL SAVEW2(10)
47 REAL W1(4225)
48 REAL W2(4225)
49C
50 INTEGER JY(4)
51 INTEGER OUT
52C
53 LOGICAL LIN
54C
55 SAVE
56C
57 DATA degprd/57.2957795/
58 DATA earthr/6371.2/
59 DATA iswt /0/
60 DATA out /6/
61C
62 4000 FORMAT ( 52h *** warning , w1 or w2 scratch files over written ,,
63 & 43h i will restore them , burning up cpu time,,
64 & 14h in w3ft06 ***)
65C
66 lin = .false.
67 IF (linear.EQ.1) lin = .true.
68 IF (iswt.EQ.0) GO TO 300
69C
70C TEST TO SEE IF W1 OR W2 WAS WRITTEN OVER
71C
72 DO 100 kk=1,10
73 IF (savew1(kk).NE.w1(kk)) GO TO 200
74 IF (savew2(kk).NE.w2(kk)) GO TO 200
75 100 CONTINUE
76 GO TO 800
77C
78 200 CONTINUE
79 WRITE (out,4000)
80C
81 300 CONTINUE
82 deg = 2.5
83 nn = 0
84 xmesh = 381.0
85 gi2 = (1.86603*earthr) / xmesh
86 gi2 = gi2 * gi2
87C
88C DO LOOP 600 PUTS SUBROUTINE W3FB03 IN LINE
89C
90 DO 600 j=1,65
91 xj = j - 33
92 xj2 = xj * xj
93 DO 600 i=1,65
94 xi = i - 33
95 r2 = xi*xi + xj2
96 IF (r2.NE.0.0) GO TO 400
97 wlon = 0.0
98 xlat = -90.0
99 GO TO 500
100 400 CONTINUE
101 xlong = degprd * atan2(xj,xi)
102 wlon = xlong -10.0
103 IF (wlon.LT.0.0) wlon = wlon + 360.0
104 xlat = asin((gi2-r2)/(gi2+r2))*degprd
105 xlat = -xlat
106 500 CONTINUE
107 xlat = xlat + 90.0
108 IF (wlon.GT.360.0) wlon = wlon - 360.0
109 IF (wlon.LT.0.0) wlon = wlon + 360.0
110 nn = nn + 1
111 w1(nn) = ( 360.0 - wlon ) / deg + 1.0
112 w2(nn) = xlat / deg + 1.0
113 600 CONTINUE
114C
115 DO 700 kk=1,10
116 savew1(kk)=w1(kk)
117 savew2(kk)=w2(kk)
118 700 CONTINUE
119C
120 iswt = 1
121C
122 800 CONTINUE
123C
124 DO 1900 kk=1,4225
125 i = w1(kk)
126 j = w2(kk)
127 fi = i
128 fj = j
129 xdeli = w1(kk) - fi
130 xdelj = w2(kk) - fj
131 ip1 = i + 1
132 jy(3) = j + 1
133 jy(2) = j
134 IF (lin) GO TO 900
135 ip2 = i + 2
136 im1 = i - 1
137 jy(4) = j + 2
138 jy(1) = j - 1
139 xi2tm = xdeli*(xdeli-1.)*.25
140 xj2tm = xdelj*(xdelj-1.)*.25
141 900 CONTINUE
142 IF ((i.LT.2).OR.(j.LT.2)) GO TO 1000
143 IF ((i.GT.142).OR.(j.GT.34)) GO TO 1000
144C QUADRATIC (LINEAR TOO) OK W/O FURTHER ADO SO GO TO 1500
145 GO TO 1500
146C
147 1000 CONTINUE
148 IF (i.EQ.1) GO TO 1100
149 IF (i.EQ.144) GO TO 1200
150 ip2 = i+2
151 im1 = i-1
152 GO TO 1300
153C
154 1100 CONTINUE
155 ip2 = 3
156 im1 = 144
157 GO TO 1300
158C
159 1200 CONTINUE
160 ip2 = 2
161 im1 = 143
162C
163 1300 CONTINUE
164 ip1 = i + 1
165 IF (lin) GO TO 1400
166 IF ((j.LT.2).OR.(j.GE.36)) xj2tm=0.
167C.....DO NOT ALLOW POINT OFF GRID,CYCLIC OR NOT
168 IF (ip2.LT.1) ip2 = 1
169 IF (im1.LT.1) im1 = 1
170 IF (ip2.GT.145) ip2 = 145
171 IF (im1.GT.145) im1 = 145
172C
173 1400 CONTINUE
174C.....DO NOT ALLOW POINT OFF GRID,CYCLIC OR NOT
175 IF (i.LT.1) i = 1
176 IF (ip1.LT.1) ip1 = 1
177 IF (i.GT.145) i = 145
178 IF (ip1.GT.145) ip1 = 145
179C
180 1500 CONTINUE
181C
182 IF (.NOT.lin) GO TO 1700
183C
184C LINEAR INTERPOLATION
185C
186 DO 1600 k = 2,3
187 j1 = jy(k)
188 IF (j1.LT.1) j1=1
189 IF (j1.GT.37) j1=37
190 eras(k) = (alola(ip1,j1) - alola(i,j1)) * xdeli + alola(i,j1)
191 1600 CONTINUE
192C
193 apola(kk) = eras(2) + (eras(3) - eras(2)) * xdelj
194 GO TO 1900
195C
196 1700 CONTINUE
197C
198C QUADRATIC INTERPOLATION
199C
200 DO 1800 k = 1,4
201 j1 = jy(k)
202C.....DO NOT ALLOW POINT OFF GRID,CYCLIC OR NOT
203 IF (j1.LT.1) j1=1
204 IF (j1.GT.37) j1=37
205 eras(k)=(alola(ip1,j1)-alola(i,j1))*xdeli+alola(i,j1)+
206 & (alola(im1,j1)-alola(i,j1)-alola(ip1,j1)+
207 & alola(ip2,j1))*xi2tm
208 1800 CONTINUE
209C
210 apola(kk) = eras(2)+(eras(3)-eras(2))*xdelj+(eras(1)-
211 & eras(2)-eras(3)+eras(4))*xj2tm
212C
213 1900 CONTINUE
214C
215C SET POLE POINT, WMO STANDARD FOR U OR V
216C
217 apola(2113) = alola(73,1)
218C
219 RETURN
220 END
subroutine w3ft06(alola, apola, w1, w2, linear)
Convert a southern hemisphere 2.5 degree lat.,lon.
Definition w3ft06.f:41