NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3ft01.f
Go to the documentation of this file.
1C> @file
2C> @brief Interpolate values in a data field.
3C> @author James McDonell @date 1984-06-27
4
5C> For a given grid coordinate in a data array, estimates
6C> a data value for that point using either a linear or quadratic
7C> interpolation method.
8C>
9C> ### Program History Log:
10C> Date | Programmer | Commment
11C> -----|------------|---------
12C> 1984-06-27 | James McDonell | Initial
13C> 1989-11-01 | Ralph Jones | Change to cray cft77 fortran
14C>
15C> @param[in] STI Real*4 i grid coordinate of the point for which
16C> an interpolated value is desired.
17C> @param[in] STJ Real*4 j grid coordinate of the point for which
18C> an interpolated value is desired.
19C> @param[in] FLD Real*4 size(ii,jj) data field.
20C> @param[in] II Integer*4 number of columns in 'fld'.
21C> @param[in] JJ Integer*4 number of rows in 'fld'.
22C> @param[in] NCYCLK Integer*4 code to specify if grid is cyclic or
23C> not:
24C> - = 0 Non-cyclic in ii, non-cyclic in jj
25C> - = 1 Cyclic in ii, non-cyclic in jj
26C> - = 2 Cyclic in jj, non-cyclic in ii
27C> - = 3 Cyclic in ii, cyclic in jj
28C> @param[in] LIN Integer*4 code specifying interpolation method:
29C> - = 1 Linear interpolation
30C> - .NE.1 Quadratic interpolation
31C> @param[out] HI Real*4 data field value at (sti,stj) obtained
32C> by interpolation.
33C>
34C> @author James McDonell @date 1984-06-27
35 SUBROUTINE w3ft01(STI,STJ,FLD,HI,II,JJ,NCYCLK,LIN)
36C
37 REAL ERAS(4)
38 REAL FLD(II,JJ)
39 REAL JY(4)
40C
41 i = sti
42 j = stj
43 fi = i
44 fj = j
45 xdeli = sti - fi
46 xdelj = stj - fj
47 ip2 = i + 2
48 im1 = i - 1
49 ip1 = i + 1
50 jy(4) = j + 2
51 jy(1) = j - 1
52 jy(3) = j + 1
53 jy(2) = j
54 xi2tm = 0.0
55 xj2tm = 0.0
56 IF (lin.NE.1) THEN
57 xi2tm = xdeli * (xdeli - 1.0) * 0.25
58 xj2tm = xdelj * (xdelj - 1.0) * 0.25
59 ENDIF
60 IF ((i.LT.2).OR.(j.LT.2)) GO TO 10
61 IF ((i.GT.ii-3).OR.(j.GT.jj-3)) GO TO 10
62C
63C QUADRATIC (LINEAR TOO) OK W/O FURTHER ADO SO GO TO 170
64C
65 GO TO 170
66C
67 10 CONTINUE
68 icyclk = 0
69 jcyclk = 0
70 IF (ncyclk) 20,120,20
71C
72 20 CONTINUE
73 IF (ncyclk / 2 .NE. 0) jcyclk = 1
74 IF (ncyclk .NE. 2) icyclk = 1
75 IF (icyclk) 30,70,30
76C
77 30 CONTINUE
78 IF (i.EQ.1) GO TO 40
79 IF (i.EQ.(ii-1)) GO TO 50
80 ip2 = i + 2
81 im1 = i - 1
82 GO TO 60
83C
84 40 CONTINUE
85 ip2 = 3
86 im1 = ii - 1
87 GO TO 60
88C
89 50 CONTINUE
90 ip2 = 2
91 im1 = ii - 2
92C
93 60 CONTINUE
94 ip1 = i + 1
95C
96 70 CONTINUE
97 IF (jcyclk) 80,120,80
98C
99 80 CONTINUE
100 IF (j.EQ.1) GO TO 90
101 IF (j.EQ.(jj-1)) GO TO 100
102 jy(4) = j + 2
103 jy(1) = j - 1
104 GO TO 110
105C
106 90 CONTINUE
107 jy(4) = 3
108 jy(1) = jj - 1
109 GO TO 110
110C
111 100 CONTINUE
112 jy(4) = 2
113 jy(1) = jj - 2
114C
115 110 CONTINUE
116 jy(3) = j + 1
117 jy(2) = j
118C
119 120 CONTINUE
120 IF (lin.EQ.1) GO TO 160
121 IF (icyclk) 140,130,140
122C
123 130 CONTINUE
124 IF ((i.LT.2).OR.(i.GE.(ii-1))) xi2tm = 0.0
125C
126 140 CONTINUE
127 IF (jcyclk) 160,150,160
128C
129 150 CONTINUE
130 IF ((j.LT.2).OR.(j.GE.(jj-1))) xj2tm = 0.0
131C
132 160 CONTINUE
133C
134C.....DO NOT ALLOW POINT OFF GRID,CYCLIC OR NOT
135C
136 IF (i.LT.1) i = 1
137 IF (ip1.LT.1) ip1 = 1
138 IF (ip2.LT.1) ip2 = 1
139 IF (im1.LT.1) im1 = 1
140C
141C.....DO NOT ALLOW POINT OFF GRID,CYCLIC OR NOT
142C
143 IF (i.GT.ii) i = ii
144 IF (ip1.GT.ii) ip1 = ii
145 IF (ip2.GT.ii) ip2 = ii
146 IF (im1.GT.ii) im1 = ii
147C
148 170 CONTINUE
149 DO 180 k = 1,4
150 j1 = jy(k)
151C
152C.....DO NOT ALLOW POINT OFF GRID,CYCLIC OR NOT
153C
154 IF (j1.LT.1) j1 = 1
155 IF (j1.GT.jj) j1 = jj
156 eras(k) = (fld(ip1,j1) - fld(i,j1)) * xdeli + fld(i,j1) +
157 & (fld(im1,j1) - fld(i,j1) - fld(ip1,j1) + fld(ip2,j1)) * xi2tm
158 180 CONTINUE
159C
160 hi = eras(2) + (eras(3) - eras(2)) * xdelj + (eras(1) -
161 & eras(2) - eras(3) + eras(4)) * xj2tm
162C
163 RETURN
164 END
subroutine w3ft01(sti, stj, fld, hi, ii, jj, ncyclk, lin)
For a given grid coordinate in a data array, estimates a data value for that point using either a lin...
Definition w3ft01.f:36