NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3ft03.f
Go to the documentation of this file.
1C> @file
2C> @brief A point interpolater.
3C> @author James Howcroft @date 1979-02-15
4
5C> Do either bilinear or biquadratic interpolation for a
6C> point within a two-dimensional data array.
7C>
8C> ### Program History Log:
9C> Date | Programmer | Comment
10C> -----|------------|--------
11C> 1979-02-15 | James Howcroft | Initial.
12C> 1989-01-25 | Ralph Jones | Change to microsoft fortran 4.10.
13C> 1990-06-12 | Ralph Jones | Change to sun fortran 1.3.
14C> 1991-03-30 | Ralph Jones | Convert to silicongraphics fortran.
15C> 1993-03-29 | Ralph Jones | Add save statement.
16C> 1996-07-01 | Ralph Jones | Compile on cray.
17C>
18C> @param[in] FL Real*4 two-dimensional cartesian array of data.
19C> @param[in] MAXI Integer*4 i-dimension of fl.
20C> @param[in] MAXJ Integer*4 j-dimension of fl.
21C> @param[in] STI Real*4 i-coordinate to which a value is to be
22C> interpolated.
23C> @param[in] STJ Real*4 j-coordinate to which a value is to be
24C> interpolated.
25C> @param ITYPE
26C> @param[out] HI Real*4 interpolated output value.
27C>
28C> @remark No error checks are made. it is left for the user to
29C> determine that the point for which interpolation is desired
30C> lies within the grid.
31C>
32C> @author James Howcroft @date 1979-02-15
33 SUBROUTINE w3ft03(FL,HI,STI,STJ,MAXI,MAXJ,ITYPE)
34C
35 REAL FL(MAXI,MAXJ)
36 REAL E (4)
37C
38 SAVE
39C
40 i = sti
41 j = stj
42 di = i
43 dj = j
44 di = sti - di
45 dj = stj - dj
46C
47 hi = 0.
48C TEST FOR POINT OFF GRID.
49 IF (i.LT.1 .OR. i.GT.maxi) GO TO 300
50 IF (j.LT.1 .OR. j.GT.maxj) GO TO 300
51 IF (itype .NE. 2) GO TO 100
52C DO BILINEAR IF POINT IS BETWEEN ULTIMATE AND
53C PENULTIMATE ROWS, WHERE BIQUAD NOT POSSIBLE.
54 IF (i.LT.2 .OR. i.GT.(maxi-1)) GO TO 100
55 IF (j.LT.2 .OR. j.GT.(maxj-1)) GO TO 100
56 GO TO 200
57C
58C BILINEAR.
59 100 CONTINUE
60 hi = fl(i ,j )*(1.-di)*(1.-dj) + fl(i+1,j )*di*(1.-dj)
61 & + fl(i ,j+1)*(1.-di)*dj + fl(i+1,j+1)*di*dj
62 GO TO 300
63C
64 200 CONTINUE
65C BIQUADRATIC.
66 di2 = di*(di-1.)*.25
67 dj2 = dj*(dj-1.)*.25
68 j1 = j - 1
69 DO 250 k=1,4
70 e(k) = fl(i ,j1)*(1.-di-di2) + fl(i+1,j1)*(di-di2)
71 & + (fl(i-1,j1) + fl(i+2,j1))*di2
72 j1 = j1 + 1
73 250 CONTINUE
74 hi = e(2)*(1.-dj-dj2) + e(3)*(dj-dj2) + (e(1) + e(4))*dj2
75C
76 300 CONTINUE
77 RETURN
78 END
subroutine w3ft03(fl, hi, sti, stj, maxi, maxj, itype)
Do either bilinear or biquadratic interpolation for a point within a two-dimensional data array.
Definition w3ft03.f:34