NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3ft204.f
Go to the documentation of this file.
1C> @file
2C> @brief Convert (361,181) grid to (93,68) mercator grid.
3C> @author Ralph Jones @date 1994-05-18
4
5C> Convert a n. s. hemisphere 1.0 degree lat.,lon. 361 by
6C> 181 grid to a national - hawaii (mercator) 93*68 awips 204
7C> grid.
8C>
9C> ### Program History Log:
10C> Date | Programmer | Comment
11C> -----|------------|--------
12C> 1994-05-18 | Ralph Jones | Initial.
13C>
14C> @param[in] ALOLA 361*181 grid 1.0 deg. lat,lon grid n. hemi.
15C> 65341 point grid. 360 * 181 one degree grib grid 3 was flipped, greenwish added
16C> to right side.
17C> @param[in] INTERP 1 linear interpolation , ne.1 biquadratic
18C> @param[out] AMERC 93*68 grid national - hawaii (mercator) 6324 point grid
19C> is awips grid type 204
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 1994-05-18
26 SUBROUTINE w3ft204(ALOLA,AMERC,INTERP)
27C
28 parameter(npts=6324,ii=93,jj=68)
29 parameter(alatin=20.000)
30 parameter(pi=3.1416)
31 parameter(dx=160000.0)
32 parameter(alat1=-25.000)
33 parameter(alon1=110.000)
34C
35 REAL WLON(NPTS), XLAT(NPTS)
36 REAL XI(II,JJ), XJ(II,JJ)
37 REAL XII(NPTS), XJJ(NPTS)
38 REAL ALOLA(361,181), 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 radpd = pi / 180.0
58 degpr = 180.0 / pi
59 clain = cos(radpd * alatin)
60 dellon = dx / (rerth * clain)
61 djeo = (alog(tan(0.5*((alat1+90.0)*radpd))))/dellon
62C
63 lin = .false.
64 IF (interp.EQ.1) lin = .true.
65C
66 IF (iswt.EQ.1) GO TO 900
67C
68 deg = 1.0
69C
70C NEXT 32 LINES OF CODE PUTS SUBROUTINE W3FB09 IN LINE
71C
72 DO 100 j = 1,jj
73 DO 100 i = 1,ii
74 xi(i,j) = i
75 xj(i,j) = j
76 100 CONTINUE
77C
78 DO 200 kk = 1,npts
79 xlat(kk) = 2.0*atan(exp(dellon*(djeo + xjj(kk)-1.)))
80 & * degpr - 90.0
81 200 CONTINUE
82C
83 DO 300 kk = 1,npts
84 wlon(kk) = (xii(kk) -1.0) * dellon * degpr + alon1
85 300 CONTINUE
86C
87 DO 400 kk = 1,npts
88 w1(kk) = wlon(kk) + 1.0
89 w2(kk) = xlat(kk) + 91.0
90 400 CONTINUE
91C
92 iswt = 1
93 intrpo = interp
94 GO TO 1000
95C
96C AFTER THE 1ST CALL TO W3FT204 TEST INTERP, IF IT HAS
97C CHANGED RECOMPUTE SOME CONSTANTS
98C
99 900 CONTINUE
100 IF (interp.EQ.intrpo) GO TO 2100
101 intrpo = interp
102C
103 1000 CONTINUE
104 DO 1100 k = 1,npts
105 iv(k) = w1(k)
106 jv(k) = w2(k)
107 xdeli(k) = w1(k) - iv(k)
108 xdelj(k) = w2(k) - jv(k)
109 ip1(k) = iv(k) + 1
110 jy(k,3) = jv(k) + 1
111 jy(k,2) = jv(k)
112 1100 CONTINUE
113C
114 IF (lin) GO TO 2100
115C
116 DO 1200 k = 1,npts
117 ip2(k) = iv(k) + 2
118 im1(k) = iv(k) - 1
119 jy(k,1) = jv(k) - 1
120 jy(k,4) = jv(k) + 2
121 xi2tm(k) = xdeli(k) * (xdeli(k) - 1.0) * .25
122 xj2tm(k) = xdelj(k) * (xdelj(k) - 1.0) * .25
123 1200 CONTINUE
124C
125 2100 CONTINUE
126 IF (lin) THEN
127C
128C LINEAR INTERPOLATION
129C
130 DO 2200 kk = 1,npts
131 eras(kk,2) = (alola(ip1(kk),jy(kk,2))-alola(iv(kk),jy(kk,2)))
132 & * xdeli(kk) + alola(iv(kk),jy(kk,2))
133 eras(kk,3) = (alola(ip1(kk),jy(kk,3))-alola(iv(kk),jy(kk,3)))
134 & * xdeli(kk) + alola(iv(kk),jy(kk,3))
135 2200 CONTINUE
136C
137 DO 2300 kk = 1,npts
138 amerc(kk) = eras(kk,2) + (eras(kk,3) - eras(kk,2))
139 & * xdelj(kk)
140 2300 CONTINUE
141C
142 ELSE
143C
144C QUADRATIC INTERPOLATION
145C
146 DO 2400 kk = 1,npts
147 eras(kk,1)=(alola(ip1(kk),jy(kk,1))-alola(iv(kk),jy(kk,1)))
148 & * xdeli(kk) + alola(iv(kk),jy(kk,1)) +
149 & ( alola(im1(kk),jy(kk,1)) - alola(iv(kk),jy(kk,1))
150 & - alola(ip1(kk),jy(kk,1))+alola(ip2(kk),jy(kk,1)))
151 & * xi2tm(kk)
152 eras(kk,2)=(alola(ip1(kk),jy(kk,2))-alola(iv(kk),jy(kk,2)))
153 & * xdeli(kk) + alola(iv(kk),jy(kk,2)) +
154 & ( alola(im1(kk),jy(kk,2)) - alola(iv(kk),jy(kk,2))
155 & - alola(ip1(kk),jy(kk,2))+alola(ip2(kk),jy(kk,2)))
156 & * xi2tm(kk)
157 eras(kk,3)=(alola(ip1(kk),jy(kk,3))-alola(iv(kk),jy(kk,3)))
158 & * xdeli(kk) + alola(iv(kk),jy(kk,3)) +
159 & ( alola(im1(kk),jy(kk,3)) - alola(iv(kk),jy(kk,3))
160 & - alola(ip1(kk),jy(kk,3))+alola(ip2(kk),jy(kk,3)))
161 & * xi2tm(kk)
162 eras(kk,4)=(alola(ip1(kk),jy(kk,4))-alola(iv(kk),jy(kk,4)))
163 & * xdeli(kk) + alola(iv(kk),jy(kk,4)) +
164 & ( alola(im1(kk),jy(kk,4)) - alola(iv(kk),jy(kk,4))
165 & - alola(ip1(kk),jy(kk,4))+alola(ip2(kk),jy(kk,4)))
166 & * xi2tm(kk)
167 2400 CONTINUE
168C
169 DO 2500 kk = 1,npts
170 amerc(kk) = eras(kk,2) + (eras(kk,3) - eras(kk,2))
171 & * xdelj(kk) + (eras(kk,1) - eras(kk,2)
172 & - eras(kk,3) + eras(kk,4)) * xj2tm(kk)
173 2500 CONTINUE
174C
175 ENDIF
176C
177 RETURN
178 END
subroutine w3ft204(alola, amerc, interp)
Convert a n.
Definition w3ft204.f:27