OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
interp_att.f
Go to the documentation of this file.
1  subroutine interp_att( msecl, nlin, msecg, attg, attl, iret)
2 c
3 c interp_att( msecl, nlin, msecg, attg, attl, iret)
4 c
5 c Purpose: interpolate GAC attitude angles to LAC scan line times
6 c
7 c Calling Arguments:
8 c
9 c Name Type I/O Description
10 c -------- ---- --- -----------
11 c msecl I*4 I LAC scan line time
12 c nlin I*4 I number of GAC scan lines
13 c msecg(*) I*4 I size nlin array of GAC scan line times
14 c attg(3,*) R*4 I size 3 by nlin array of GAC attitude angles
15 c attl(3) R*4 O size 3 array of interpolated attitude angles
16 c iret R*4 O return code (gt 3, number of scans
17 c LAC attitude was extrapolated)
18 c
19 c By: F. S. Patt, SAIC GSC, 24 Sep 98
20 c
21 c Notes: This routine performs linear interpolation of the attitude angles.
22 c
23 c Modification History:
24 c
25 c Modified to allow LAC times within a specified limit (currently 5 msec)
26 c outside the range of GAC time. F. S. Patt, SAIC GSC, April 22, 1999
27 c
28 c Changed time limit from previous update to 505 msec to allow for 3 LAC
29 c lines after the last GAC line (due to GAC subsampling).
30 c F. S. Patt, SAIC GSC, May 11, 1999
31 c
32 c Modified to remove limit on extrapolation and return number of lines
33 c extrapolated by if more than 3. F. S. Patt, SAIC GSC, April 27, 2000
34 
35  implicit none
36 
37  real*4 attg(3,*), attl(3)
38  real*4 fac, dt
39  integer*4 msecg(*), msecl, nlin, iret
40  integer*4 ind, i, limdif, lactim
41  data ind/0/, limdif/505/, lactim/166/
42 
43  iret = 0
44 
45 c Search for first GAC time later than LAC time
46 
47  dowhile((msecl.ge.msecg(ind+1)) .and. (ind.lt.(nlin-1)))
48  ind = ind + 1
49  end do
50 
51 c Check for LAC time after end of GAC time array
52  if (ind.ge.nlin-1) then
53  if ((msecl-msecg(nlin)).gt.limdif) then
54  iret = (msecl-msecg(nlin))/lactim
55  write(*,*) 'interp_att: LAC time after available GAC', msecl
56  end if
57  ind = nlin - 1
58  end if
59 
60 c Check for LAC time earlier than first GAC time
61  if (ind.le.0) then
62  if ((msecg(1)-msecl).gt.limdif) then
63  iret = (msecg(1)-msecl)/lactim
64  write(*,*) 'interp_att: LAC time before available GAC',msecl
65  return
66  end if
67  ind = 1
68  end if
69 
70 c Compute linear interpolation factor
71  dt = msecg(ind+1) - msecg(ind)
72  fac = (msecl - msecg(ind)) / dt
73 
74 c Interpolate attitude angles
75  do i=1,3
76  attl(i) = attg(i,ind)*(1.0 - fac) + attg(i,ind+1)*fac
77  end do
78 
79  return
80  end
81 
82 
83 
subroutine interp_att(msecl, nlin, msecg, attg, attl, iret)
Definition: interp_att.f:2
#define real
Definition: DbAlgOcean.cpp:26
#define fac