NCEPLIBS-w3emc  2.11.0
w3ft00.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Data field tranformation subroutine.
3 C> @author J. McDonell @date 1974-09-01
4 
5 C> Transforms data contained in a grid array by translation, rotation about a
6 C> common point and dilatation to a new grid array.
7 C>
8 C> ### Program History Log:
9 C> Date | Programmer | Comments
10 C> -----|------------|---------
11 C> 1974-09-01 | J. McDonell | Initial.
12 C> 1984-06-27 | Ralph Jones | Change to ibm vs fortran.
13 C>
14 C> @param[in] IA (Integer) i-dimension of the input array fa
15 C> @param[in] JA (Integer) j-dimension of the input array fa
16 C> @param[in] IB (Integer) i-dimension of the output array fb
17 C> @param[in] JB (Integer) j-dimension of the output array fb
18 C> @param[in] SC (Real) Scale change (dilation) expressed as a ratio of the
19 C> transformed to the origional field.
20 C> @param[in] ARG (Real) Degree measure of the angle required to rotate the
21 C> j-row of the origional grid into coincidence with the new grid. (+ counter-
22 C> clockwise, - clockwise)
23 C> @param[in] LIN (Integer) Interpolation method switch
24 C> - .eq. 1 bilinear interpolation
25 C> - .ne. 1 biquadratic interpolation
26 C> @param FLD
27 C> @param B
28 C> @param CIP
29 C> @param CJP
30 C> @param FIPB
31 C> @param FJPB
32 C>
33 C> @remark In general 'fa' and 'fb' cannot be equivalenced although there are
34 C> situations in which it would be safe to do so. care should be taken that
35 C> all of the new grid points lie within the origional grid, no error checks
36 C> are made.
37 C>
38 C> @author J. McDonell @date 1974-09-01
39  SUBROUTINE w3ft00(FLD,B,IA,JA,IB,JB,CIP,CJP,FIPB,FJPB,SC,ARG,LIN)
40 C
41  REAL B(IB,JB)
42  REAL ERAS(4)
43  REAL FLD(IA,JA)
44 C
45  equivalence(ci,sti), (cj,stj)
46 C
47  theta = arg * (3.14159 / 180.0)
48  sint = sin(theta)
49  cost = cos(theta)
50 C
51  DO 180 jn = 1,jb
52  fjn = jn
53  fj = fjn - fjpb
54  DO 180 in = 1,ib
55  fin = in
56  fi = fin - fipb
57  ioff = 0
58  joff = 0
59  kquad = 0
60  ci = cip + sc * (fi * cost - fj * sint)
61  cj = cjp + sc * (fi * sint + fj * cost)
62  im = ci
63  jm = cj
64  IF ((im - 1).GT.0) GO TO 20
65  IF ((im - 1).EQ.0) GO TO 40
66  ii = 1
67  ioff = 1
68  GO TO 50
69 C
70  20 CONTINUE
71  IF ((ia - im - 1).GT.0) GO TO 50
72  IF ((ia - im - 1).EQ.0) GO TO 40
73  ii = ia
74  ioff = 1
75  GO TO 50
76 C
77  40 CONTINUE
78  kquad = 5
79 C
80  50 CONTINUE
81  IF ((jm - 1).GT.0) GO TO 70
82  IF ((jm - 1).EQ.0) GO TO 90
83  jj = 1
84  joff = 1
85  GO TO 100
86 C
87  70 CONTINUE
88  IF ((ja - jm - 1).GT.0) GO TO 100
89  IF ((ja - jm - 1).EQ.0) GO TO 90
90  jj = ja
91  joff = 1
92  GO TO 100
93 C
94  90 CONTINUE
95  kquad = 5
96 C
97  100 CONTINUE
98  IF ((ioff + joff) .EQ. 0) GO TO 120
99  IF ((ioff + joff) .EQ. 2) GO TO 110
100  IF (ioff .EQ. 1) jj = cj
101  IF (joff .EQ. 1) ii = ci
102 C
103  110 CONTINUE
104  b(in,jn) = fld(ii,jj)
105  GO TO 180
106 C
107  120 CONTINUE
108  i = sti
109  j = stj
110  fix = i
111  xdeli = sti - fix
112  fjx = j
113  xdelj = stj - fjx
114  IF ((kquad - 5).EQ.0) GO TO 140
115 C
116  IF ((lin-1).NE.0) GO TO 150
117 C
118  140 CONTINUE
119  eras(1) = fld(i,j)
120  eras(4) = fld(i,j+1)
121  eras(2) = eras(1) + (fld(i+1,j) - eras(1)) * xdeli
122  eras(3) = eras(4) + (fld(i+1,j+1) - eras(4)) * xdeli
123  di = eras(2) + (eras(3) - eras(2)) * xdelj
124  GO TO 170
125 C
126  150 CONTINUE
127  xi2tm = xdeli * (xdeli - 1.0) * 0.25
128  xj2tm = xdelj * (xdelj - 1.0) * 0.25
129  j1 = j - 1
130 C
131  DO 160 k = 1,4
132  eras(k) = (fld(i+1,j1) - fld(i,j1)) * xdeli + fld(i,j1) +
133  & (fld(i-1,j1) - fld(i,j1) - fld(i+1,j1) + fld(i+2,j1)) * xi2tm
134  j1 = j1 + 1
135  160 CONTINUE
136 C
137  di = eras(2) + (eras(3) - eras(2)) * xdelj + (eras(1) -
138  & eras(2) - eras(3) + eras(4)) * xj2tm
139 C
140  170 CONTINUE
141  b(in,jn) = di
142 C
143  180 CONTINUE
144 C
145  RETURN
146  END
subroutine w3ft00(FLD, B, IA, JA, IB, JB, CIP, CJP, FIPB, FJPB, SC, ARG, LIN)
Transforms data contained in a grid array by translation, rotation about a common point and dilatatio...
Definition: w3ft00.f:40