NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3ft02.f
Go to the documentation of this file.
1C> @file
2C> @brief Interpolate precipitation to specific point.
3C> @author Robert Hirano @date 1979-08-05
4
5C> Interpolate, using a fancy non-linear method,
6C> gridded quantitative precipitation forecasts to a specific
7C> interior point. One point (e.g. an observation station)
8C> per call to w3ft02().
9C>
10C> ### Program History Log:
11C> Date | Programmer | Comment
12C> -----|------------|--------
13C> 1979-08-05 | Robert Hirano | Initial.
14C> 1996-06-23 | Farley | Converted to cray fortran 77
15C>
16C> @param[in] RAIN Real*4 grid field of (forecast) precipitation.
17C> @param[in] IMAX Integer*4 i-dimension of rain field.
18C> @param[in] JMAX Integer *4 j-dimension of rain field.
19C> @param[in] PI Real*4 i-coordinate of interpolation point.
20C> @param[in] PJ Real*4 j-coordinate of interpolation point.
21C> @param[out] AMOUNT Real*4 amount of precip interpolated to pi,pj.
22C>
23C> @author Robert Hirano @date 1979-08-05
24 SUBROUTINE w3ft02 (RAIN, IMAX, JMAX, PI, PJ, AMOUNT)
25C
26C INTERPOLATE PRECIPITATION FROM RAIN FIELD
27C TO INTERNAL POINT (PI,PJ). RESULT IN AMOUNT
28C
29 real RAIN(IMAX,JMAX)
30C
31C CHECK FOR INTERPOLATION POINT OUTSIDE GRID
32C
33 amount = 0.
34 IF(pi.LE.1.OR.pi.GE.imax) GO TO 150
35 IF(pj.LE.1.OR.pj.GE.jmax) GO TO 150
36C
37C SET UP RAIN AMMOUNTS AT CORNERS OF BOX SURROUNDING POINT (PI,PJ
38C
39C R2 R4
40C
41C (PI,PJ)
42C
43C R1 R3
44C
45 i=pi
46 j=pj
47 r1=rain(i ,j )
48 r2=rain(i ,j+1)
49 r3=rain(i+1,j )
50 r4=rain(i+1,j+1)
51C
52C CHECK FOR NO RAIN AT ALL
53C
54 IF(amax1(r1,r2,r3,r4).LE.0.) GO TO 150
55C
56C GOT SOME -- FIND APPROPRIATE SECTOR AND SECTION
57C OF THE GRID BOX IN WHICH THE STATION IS LOCATED
58C
59 ai = pi-i
60 aj=pj-j
61 x = 0.5
62C
63C MEANINOF IC FOR SECTORS (K=1) OR SECTIONS (K=2)
64C
65C 2 4
66C
67C 1 3
68C
69C ALSO REFERENCED AS
70C
71C TOP DIAGONAL / T D
72C /
73C NEAR RIGHT / N R
74C
75 DO 1 k=1,2
76 IF(ai.GT.x) GO TO 2
77 IF(aj.GT.x) GO TO 4
78 ic = 1
79 GO TO 10
80 4 CONTINUE
81 ic = 2
82 GO TO 10
83 2 CONTINUE
84 IF(aj.GT.x) GO TO 6
85 ic = 3
86 GO TO 10
87 6 CONTINUE
88 ic = 4
89 10 CONTINUE
90 IF(k.NE.1) GO TO 16
91C
92C SET UP SECTORS THIS BUSINESS IN EFFECT ROTATES THE SECTORS
93C FOR CONVENIENCE IN LATER INTERPOLATIONS
94C
95 GO TO (11, 12, 13, 14), ic
96 11 CONTINUE
97 r = r1
98 rt = r2
99 rr = r3
100 rd = r4
101 GO TO 15
102 12 CONTINUE
103 r = r2
104 rt = r1
105 rr = r4
106 rd = r3
107 aj = 1. - aj
108 GO TO 15
109 13 CONTINUE
110 r = r3
111 rt = r4
112 rr = r1
113 rd = r2
114 ai = 1. - ai
115 GO TO 15
116 14 CONTINUE
117 r = r4
118 rt = r3
119 rr = r2
120 rd = r1
121 ai = 1. - ai
122 aj = 1. - aj
123 15 CONTINUE
124C
125C IF NO RAIN IN CORNER SECTTOR WHERE STATION IS - QUIT
126C
127 IF(r.LE.0.) GO TO 150
128 x = 0.5 * x
129 16 CONTINUE
130 1 CONTINUE
131C
132C INTERPOLATE TO STATION IN EASY (NON-CORNER) SECTIONS
133C
134 GO TO (21, 22, 23, 24), ic
135 21 CONTINUE
136 amount = r
137 GO TO 150
138 22 CONTINUE
139 rc = rt
140 rx = aj
141 GO TO 120
142 23 CONTINUE
143 rc = rr
144 rx = ai
145 120 CONTINUE
146 IF(rc.GT. 0.) GO TO 130
147 amount = r - r*(rx-x)/x
148 GO TO 150
149 130 CONTINUE
150 amount = r + (0.5*(r+rc)-r)*(rx-x)/x
151 GO TO 150
152 24 CONTINUE
153C
154C CORNER (CENTER OF BOX) SECTION
155C
156 aa = amax1(rr, rt, rd)
157 IF(aa.GT.0.) GO TO 30
158 rs = 0.
159 ru = 0.
160 rd = 0.
161 GO TO 37
162 30 CONTINUE
163 IF(rr.GT.0.) GO TO 32
164 rs = 0.
165 rrd = 0.
166 33 CONTINUE
167 IF(rt.GT.0.) GO TO 34
168 ru = 0.
169 rtd = 0.
170 GO TO 35
171 34 CONTINUE
172 ru = 0.5 * (r+rt)
173 IF(rd.GT.0.) GO TO 36
174 rtd = 0.
175 GO TO 35
176 36 CONTINUE
177 rtd = 0.5 * (rt + rd)
178 GO TO 35
179 32 CONTINUE
180 rs = 0.5 * (r+rr)
181 IF(rd.GT.0.) GO TO 38
182 rrd = 0.
183 GO TO 33
184 38 CONTINUE
185 rrd = 0.5 * (rd + rr)
186 GO TO 33
187 35 CONTINUE
188 rd = 0.25 * (rs + ru + rtd + rrd)
189 IF(rs.LE.0. .AND. rtd.LE.0.) rd = 0.
190 IF(ru.LE.0..AND.rrd.LE.0.) rd=0.
191 ru = ru + (rd-ru) * (ai-x)/x
192 37 CONTINUE
193 r = r + (rs-r) * (ai-x)/x
194 amount = r + (ru-r) * (aj-x)/x
195 150 CONTINUE
196 RETURN
197C
198 END
subroutine w3ft02(rain, imax, jmax, pi, pj, amount)
Interpolate, using a fancy non-linear method, gridded quantitative precipitation forecasts to a speci...
Definition w3ft02.f:25