NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3ft210.f
Go to the documentation of this file.
1C> @file
2C> @brief Convert (361,91) grid to (25,25) mercator grid.
3C> @author Ralph Jones @date 1993-10-19
4
5C> Convert a northern hemisphere 1.0 degree lat.,lon. 361 by
6C> 91 grid to a regional - puerto rico (mercator) 25*25 awips 210
7C> grid.
8C>
9C> ### Program History Log:
10C> Date | Programmer | Comment
11C> -----|------------|--------
12C> 1993-10-19 | Ralph Jones | Initial.
13
14C> @param[in] ALOLA 361*91 grid 1.0 deg. lat,lon grid n. hemi.
15C> 32851 point grid. 360 * 181 one degree grib grid 3 was flipped, greenwish added
16C> to right side and cut to 361 * 91.
17C> @param[in] INTERP 1 linear interpolation , ne.1 biquadratic
18C> @param[out] AMERC 25*25 grid of northern mercator 625 point grid is awips grid type 210
19C>
20C> @note
21C> - 1. W1 and w2 are used to store sets of constants which are
22C> reusable for repeated calls to the subroutine. 20 other array
23C> are saved and reused on the next call.
24C>
25C> @author Ralph Jones @date 1993-10-19
26 SUBROUTINE w3ft210(ALOLA,AMERC,INTERP)
27C
28 parameter(npts=625,ii=25,jj=25)
29 parameter(alatin=20.000)
30 parameter(pi=3.1416)
31 parameter(dx=80000.0)
32 parameter(alat1=9.000)
33 parameter(alon1=283.000)
34C
35 REAL R2(NPTS), WLON(NPTS)
36 REAL XLAT(NPTS), XI(II,JJ), XJ(II,JJ)
37 REAL XII(NPTS), XJJ(NPTS), ANGLE(NPTS)
38 REAL ALOLA(361,91), AMERC(NPTS), ERAS(NPTS,4)
39 REAL W1(NPTS), W2(NPTS)
40 REAL XDELI(NPTS), XDELJ(NPTS)
41 REAL XI2TM(NPTS), XJ2TM(NPTS)
42C
43 INTEGER IV(NPTS), JV(NPTS), JY(NPTS,4)
44 INTEGER IM1(NPTS), IP1(NPTS), IP2(NPTS)
45C
46 LOGICAL LIN
47C
48 SAVE
49C
50 equivalence(xi(1,1),xii(1)),(xj(1,1),xjj(1))
51C
52C DATA DEGPR /57.2957795/
53 DATA rerth /6.3712e+6/
54 DATA intrpo/99/
55 DATA iswt /0/
56C
57 degpr = 180.0 / pi
58 radpd = pi / 180.0
59 clain = cos(radpd * alatin)
60 dellon = dx / (rerth * clain)
61 djeo = (alog(tan(0.5*((alat1+90.0)*radpd))))/dellon
62 lin = .false.
63 IF (interp.EQ.1) lin = .true.
64C
65 IF (iswt.EQ.1) GO TO 900
66C
67 deg = 1.0
68C
69C NEXT 32 LINES OF CODE PUTS SUBROUTINE W3FB09 IN LINE
70C
71 DO 100 j = 1,jj
72 DO 100 i = 1,ii
73 xi(i,j) = i
74 xj(i,j) = j
75 100 CONTINUE
76C
77 DO 200 kk = 1,npts
78 xlat(kk) = 2.0*atan(exp(dellon*(djeo + xjj(kk)-1.)))
79 & * degpr - 90.0
80 200 CONTINUE
81C
82 DO 300 kk = 1,npts
83 wlon(kk) = (xii(kk) -1.0) * dellon * degpr + alon1
84 300 CONTINUE
85C
86 DO 400 kk = 1,npts
87 w1(kk) = wlon(kk) + 1.0
88 w2(kk) = xlat(kk) + 1.0
89 400 CONTINUE
90C
91 iswt = 1
92 intrpo = interp
93 GO TO 1000
94C
95C AFTER THE 1ST CALL TO W3FT210 TEST INTERP, IF IT HAS
96C CHANGED RECOMPUTE SOME CONSTANTS
97C
98 900 CONTINUE
99 IF (interp.EQ.intrpo) GO TO 2100
100 intrpo = interp
101C
102 1000 CONTINUE
103 DO 1100 k = 1,npts
104 iv(k) = w1(k)
105 jv(k) = w2(k)
106 xdeli(k) = w1(k) - iv(k)
107 xdelj(k) = w2(k) - jv(k)
108 ip1(k) = iv(k) + 1
109 jy(k,3) = jv(k) + 1
110 jy(k,2) = jv(k)
111 1100 CONTINUE
112C
113 IF (.NOT.lin) THEN
114 DO 1200 k = 1,npts
115 ip2(k) = iv(k) + 2
116 im1(k) = iv(k) - 1
117 jy(k,1) = jv(k) - 1
118 jy(k,4) = jv(k) + 2
119 xi2tm(k) = xdeli(k) * (xdeli(k) - 1.0) * .25
120 xj2tm(k) = xdelj(k) * (xdelj(k) - 1.0) * .25
121 1200 CONTINUE
122 END IF
123C
124 2100 CONTINUE
125 IF (lin) THEN
126C
127C LINEAR INTERPOLATION
128C
129 DO 2200 kk = 1,npts
130 eras(kk,2) = (alola(ip1(kk),jy(kk,2))-alola(iv(kk),jy(kk,2)))
131 & * xdeli(kk) + alola(iv(kk),jy(kk,2))
132 eras(kk,3) = (alola(ip1(kk),jy(kk,3))-alola(iv(kk),jy(kk,3)))
133 & * xdeli(kk) + alola(iv(kk),jy(kk,3))
134 2200 CONTINUE
135C
136 DO 2300 kk = 1,npts
137 amerc(kk) = eras(kk,2) + (eras(kk,3) - eras(kk,2))
138 & * xdelj(kk)
139 2300 CONTINUE
140C
141 ELSE
142C
143C QUADRATIC INTERPOLATION
144C
145 DO 2400 kk = 1,npts
146 eras(kk,1)=(alola(ip1(kk),jy(kk,1))-alola(iv(kk),jy(kk,1)))
147 & * xdeli(kk) + alola(iv(kk),jy(kk,1)) +
148 & ( alola(im1(kk),jy(kk,1)) - alola(iv(kk),jy(kk,1))
149 & - alola(ip1(kk),jy(kk,1))+alola(ip2(kk),jy(kk,1)))
150 & * xi2tm(kk)
151 eras(kk,2)=(alola(ip1(kk),jy(kk,2))-alola(iv(kk),jy(kk,2)))
152 & * xdeli(kk) + alola(iv(kk),jy(kk,2)) +
153 & ( alola(im1(kk),jy(kk,2)) - alola(iv(kk),jy(kk,2))
154 & - alola(ip1(kk),jy(kk,2))+alola(ip2(kk),jy(kk,2)))
155 & * xi2tm(kk)
156 eras(kk,3)=(alola(ip1(kk),jy(kk,3))-alola(iv(kk),jy(kk,3)))
157 & * xdeli(kk) + alola(iv(kk),jy(kk,3)) +
158 & ( alola(im1(kk),jy(kk,3)) - alola(iv(kk),jy(kk,3))
159 & - alola(ip1(kk),jy(kk,3))+alola(ip2(kk),jy(kk,3)))
160 & * xi2tm(kk)
161 eras(kk,4)=(alola(ip1(kk),jy(kk,4))-alola(iv(kk),jy(kk,4)))
162 & * xdeli(kk) + alola(iv(kk),jy(kk,4)) +
163 & ( alola(im1(kk),jy(kk,4)) - alola(iv(kk),jy(kk,4))
164 & - alola(ip1(kk),jy(kk,4))+alola(ip2(kk),jy(kk,4)))
165 & * xi2tm(kk)
166 2400 CONTINUE
167C
168 DO 2500 kk = 1,npts
169 amerc(kk) = eras(kk,2) + (eras(kk,3) - eras(kk,2))
170 & * xdelj(kk) + (eras(kk,1) - eras(kk,2)
171 & - eras(kk,3) + eras(kk,4)) * xj2tm(kk)
172 2500 CONTINUE
173C
174 ENDIF
175C
176 RETURN
177 END
subroutine w3ft210(alola, amerc, interp)
Convert a northern hemisphere 1.0 degree lat.,lon.
Definition w3ft210.f:27