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