1 subroutine tiltcomp( nlines, tlm, timref, time, gaclac, navqc,
49 #include "tlm_str.fin"
50 #include "navqc_s.fin"
51 type(tlm_struct) :: tlm
54 integer*4 gaclac, nlines, tiltfl(nlines)
56 integer*4 nper, ilin, j, k, i1, in(4), ntilt, n1, n2, tfl(100)
57 integer*4 nskip, iret, nfit, jp, sgn
58 real*8 timref(3),time(nlines)
60 real*4 tout(100),tlcl(100),tdif(100),tdlim(2),tldif,tlim(2)
62 data nfit/9/,nskip/2/,tdif/100*0.0/,tdlim/-1.,10./,tlim/-20.,20./
68 if( gaclac .eq. 1 ) nper = 5
82 tiltfl((ilin - 1) * nper + j ) = tlm%tilt(1)%flag(j,ilin)
85 tiltpr((ilin - 1) * nper + j ) = tlm%tilt(1)%ang(j,ilin)
101 call fndflg(tiltfl(1),nlines,i1,in(k))
103 if (in(k).eq.-1)
then
107 print *,
'Insufficient static tilt data samples'
108 print *,
' Smoothing attempted'
110 if (tiltfl(j).eq.2) tiltfl(j) = 0
113 call runfit3t(nfit,nskip,tlcl,tiltpr(1),ntilt,1,tiltfl(1),
114 * 1,time(1),tdif,tout,tfl,iret)
117 tiltfl(j) = 2 - tfl(j)
122 else if (k.eq.3)
then
134 if (tiltfl(j).eq.2)
then
137 if (j.lt.in(1)) n1 = n1 + 1
143 call runfit3t(nfit,nskip,tlcl,tiltpr(1),ntilt,1,tiltfl(1),
144 * 1,time(1),tdif,tout,tfl,iret)
148 if ((n1.gt.0).and.(iret.eq.0))
then
151 tiltfl(j) = 2 - tfl(j)
155 tiltpr(j) = tiltpr(in(1))
156 tiltfl(j) = tiltfl(in(1))
162 if (in(2).gt.(in(1)+1))
then
163 if (tiltpr(in(2)).eq.tiltpr(in(1)))
then
165 tiltpr(j) = tiltpr(in(1))
166 tiltfl(j) = tiltfl(in(1))
171 tiltfl(j) = 2 - tfl(j)
181 if (tiltpr(in(3)).eq.tiltpr(in(2)))
then
182 if (in(3).gt.(in(2)+1))
then
184 tiltpr(j) = tiltpr(in(2))
185 tiltfl(j) = tiltfl(in(2))
195 sgn =
sign(1.0,(tiltpr(in(3)) - tiltpr(in(2))))
197 if (tiltfl(j).eq.2)
then
198 if (time(j).ne.time(jp))
then
199 tldif = sgn*(tiltpr(j) - tiltpr(jp)) /
201 if ((tldif.lt.tdlim(1)).or.(tldif.gt.tdlim(2)))
then
202 if (.not.gottwo) tiltfl(jp) = 1
214 if (.not.gottwo) tiltfl(jp) = 1
215 ntilt = in(3) - in(2) + 1
216 call runfit3t(nfit,nskip,tlcl,tiltpr(in(2)),ntilt,1,
217 1 tiltfl(in(2)),1,time(in(2)),tdif,tout,tfl,iret)
219 tiltpr(j) = tout(j-in(2)+1)
220 tiltfl(j) = 2 - tfl(j-in(2)+1)
229 call fndflg(tiltfl(1),nlines,i1,in(4))
239 if (tiltfl(j).eq.2)
then
242 if (j.gt.in(3)) n1 = n1 + 1
247 ntilt = nlines - in(1) + 1
248 call runfit3t(nfit,nskip,tlcl,tiltpr(in(1)),ntilt,1,
249 1 tiltfl(in(1)),1,time(in(1)),tdif,tout,tfl,iret)
252 if (in(3).gt.(in(2)+1))
then
253 if (tiltpr(in(3)).eq.tiltpr(in(2)))
then
255 tiltpr(j) = tiltpr(in(2))
256 tiltfl(j) = tiltfl(in(2))
260 tiltpr(j) = tout(j-in(1)+1)
261 tiltfl(j) = 2 - tfl(j-in(1)+1)
267 if (in(3).lt.nlines)
then
268 if ((n1.gt.0).and.(iret.eq.0))
then
270 tiltpr(j) = tout(j-in(1)+1)
271 tiltfl(j) = 2 - tfl(j-in(1)+1)
275 tiltpr(j) = tiltpr(in(3))
276 tiltfl(j) = tiltfl(in(3))
288 if (tiltpr(j).gt.tlim(2))
then
291 else if (tiltpr(j).lt.tlim(1))
then