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