NCEPLIBS-w3emc  2.11.0
w3ft06.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Convert (145,37) to (65,65) s. hemi. grid.
3 C> @author Ralph Jones @date 1984-06-18
4 
5 C> Convert a southern hemisphere 2.5 degree lat.,lon. 145 by
6 C> 37 grid to a polar stereographic 65 by 65 grid. The polar
7 C> stereographic map projection is true at 60 deg. s.; The mesh
8 C> length is 381 km. and the oriention is 260 deg. w.(100e).
9 C>
10 C> ### Program History Log:
11 C> Date | Programmer | Comment
12 C> -----|------------|--------
13 C> 1984-06-18 | Ralph Jones | Initial.
14 C> 1991-07-30 | Ralph Jones | Convert to cray cft77 fortran.
15 C> 1992-05-02 | Ralph Jones | Add save.
16 C>
17 C> @param[in] ALOLA 145*37 deg 2.5 lat,lon grid s. hemi.
18 C> 5365 point grid is type 30 or 1e hex o.n. 84.
19 C> @param[in] LINEAR 1 linear interpolation , ne.1 biquadratic.
20 C> @param[out] APOLA 65*65 grid of southern hemi.
21 C> 4225 point grid is type 28 or 1c hex o.n. 84.
22 C> @param[out] W1 65*65 scratch field.
23 C> @param[out] W2 65*65 scratch field. FT06F001 Error message
24 C>
25 C> @remark
26 C> - 1. W1 and w2 are used to store sets of constants which are
27 C> reusable for repeated calls to the subroutine. If they are
28 C> over written by the user, a warning message will be printed
29 C> and w1 and w2 will be recomputed.
30 C> - 2. Wind components are not rotated to the 65*65 grid orientation
31 C> after interpolation. You may use w3fc10() to do this.
32 C> - 3. The grid points values on the equator have been extrapolated
33 C> outward to all the grid points outside the equator on the 65*65
34 C> grid (about 1100 points).
35 C> - 4. You should use the cray vectorized verion w3ft06v() on the cray
36 C> it has 3 parameters in the call, runs about times faster, uses
37 C> more memory.
38 C>
39 C> @author Ralph Jones @date 1984-06-18
40  SUBROUTINE w3ft06(ALOLA,APOLA,W1,W2,LINEAR)
41 C
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)
49 C
50  INTEGER JY(4)
51  INTEGER OUT
52 C
53  LOGICAL LIN
54 C
55  SAVE
56 C
57  DATA degprd/57.2957795/
58  DATA earthr/6371.2/
59  DATA iswt /0/
60  DATA out /6/
61 C
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 ***)
65 C
66  lin = .false.
67  IF (linear.EQ.1) lin = .true.
68  IF (iswt.EQ.0) GO TO 300
69 C
70 C TEST TO SEE IF W1 OR W2 WAS WRITTEN OVER
71 C
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
77 C
78  200 CONTINUE
79  WRITE (out,4000)
80 C
81  300 CONTINUE
82  deg = 2.5
83  nn = 0
84  xmesh = 381.0
85  gi2 = (1.86603*earthr) / xmesh
86  gi2 = gi2 * gi2
87 C
88 C DO LOOP 600 PUTS SUBROUTINE W3FB03 IN LINE
89 C
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
114 C
115  DO 700 kk=1,10
116  savew1(kk)=w1(kk)
117  savew2(kk)=w2(kk)
118  700 CONTINUE
119 C
120  iswt = 1
121 C
122  800 CONTINUE
123 C
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
144 C QUADRATIC (LINEAR TOO) OK W/O FURTHER ADO SO GO TO 1500
145  GO TO 1500
146 C
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
153 C
154  1100 CONTINUE
155  ip2 = 3
156  im1 = 144
157  GO TO 1300
158 C
159  1200 CONTINUE
160  ip2 = 2
161  im1 = 143
162 C
163  1300 CONTINUE
164  ip1 = i + 1
165  IF (lin) GO TO 1400
166  IF ((j.LT.2).OR.(j.GE.36)) xj2tm=0.
167 C.....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
172 C
173  1400 CONTINUE
174 C.....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
179 C
180  1500 CONTINUE
181 C
182  IF (.NOT.lin) GO TO 1700
183 C
184 C LINEAR INTERPOLATION
185 C
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
192 C
193  apola(kk) = eras(2) + (eras(3) - eras(2)) * xdelj
194  GO TO 1900
195 C
196  1700 CONTINUE
197 C
198 C QUADRATIC INTERPOLATION
199 C
200  DO 1800 k = 1,4
201  j1 = jy(k)
202 C.....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
209 C
210  apola(kk) = eras(2)+(eras(3)-eras(2))*xdelj+(eras(1)-
211  & eras(2)-eras(3)+eras(4))*xj2tm
212 C
213  1900 CONTINUE
214 C
215 C SET POLE POINT, WMO STANDARD FOR U OR V
216 C
217  apola(2113) = alola(73,1)
218 C
219  RETURN
220  END
subroutine w3ft06(ALOLA, APOLA, W1, W2, LINEAR)
Convert a southern hemisphere 2.5 degree lat.,lon.
Definition: w3ft06.f:41