1 subroutine proctim2(input,nframes,navqc,time,timref,
54 #include "nav_cnst.fin"
55 #include "input_s.fin"
56 #include "timtag_s.fin"
57 #include "navqc_s.fin"
59 type(timtag_struct) :: timtag(maxlin)
62 integer*4 gaclac, ntim, itim, iret
63 real*8 time(maxlin), timref(3)
66 integer*4 nframes, flag(maxlin), flagsec(maxlin), daycross
67 integer*4 i1, i2, crosspt, nper, ilin, nlines, jd
68 integer*4 iy1, iy2, id1, id2
70 real*8 delsec, tolmult, delfac
73 parameter(secinday = 60.d0 * 60.d0 * 24.d0 )
81 if (input(1)%sc_id(2).eq.15)
then
91 if( gaclac .eq. 1 )
then
99 timtag(itim)%sec = input(itim)%msec/1.d3
106 if( ( input(itim)%iyear .ge. navqc%yearmin ) .and.
107 1 ( input(itim)%iyear .le. navqc%yearmax ) .and.
108 1 ( input(itim)%iday .ge. 1 ) .and.
109 1 ( input(itim)%iday .le. 366 ) ) flag(itim) = 0
111 if( ( timtag(itim)%sec .ge. 0 ) .and.
112 1 ( timtag(itim)%sec .le. secinday ) ) flagsec(itim) = 0
125 call fndflg(flagsec, ntim, 1, i1 )
132 100
format(
' PROCTIM: no unflagged tag second values found')
138 do while( .not. endsec )
139 call fndflg(flagsec, ntim, (i1 + 1), i2 )
146 if( daycross .ne. 0 )
147 1 timtag(i2)%sec = timtag(i2)%sec + secinday
150 iy1 = input(i1)%iyear
152 iy2 = input(i2)%iyear
154 if ( (
jd(iy2,0,id2) -
jd(iy1,0,id1)) .eq. 1)
then
157 timtag(i2)%sec = timtag(i2)%sec + secinday
168 if( .not. found )
then
171 500
format(
' PROCTIM: no consistent pairs of tag seconds were
182 time( ( ilin - 1 ) * nper + 1 ) = timtag( ilin )%sec
189 call fndflg(flagsec, ntim, 1, i1 )
191 if( flagsec(1) .eq. 1)
then
193 do ilin = 1, (i1 - 1) * nper
194 time( ilin ) = timtag(i1)%sec - delsec * tolmult *
195 1 ( (i1 - 1) * nper + 1 - ilin )
203 do while( .not. endsec )
204 call fndflg(flagsec, ntim, (i1 + 1), i2 )
208 if( ( i2 * nper - i1 * nper ) .gt. 1 )
then
210 do ilin = (i1 - 1) * nper + 2, (i2 - 1) * nper
211 time(ilin) = timtag(i1)%sec + delsec * tolmult *
212 1 ( ilin - ( i1 - 1 ) * nper - 1 )
223 if( ( flagsec(ntim) .eq. 1 ) .or. ( gaclac .eq. 1 ) )
then
224 do ilin = (i1 - 1 ) * nper + 2, ntim * nper
225 time(ilin) = timtag(i1)%sec + delsec * tolmult *
226 1 ( ilin - ( i1 - 1 ) * nper - 1 )
233 call fndflg(flag, ntim, 1, i1 )
237 300
format(
' PROCTIM: no unflagged tag year/day values found')
243 do while( .not. found )
244 call fndflg(flag, ntim, (i1 + 1), i2)
247 400
format(
' PROCTIM: unable to find a good year/ day sequence '
251 if( ( input(i1)%iyear .ne. input(i2)%iyear ) .or.
252 1 ( input(i1)%iday .ne. input(i2)%iday ) .or.
253 1 ( flagsec(i1) .eq. 1 ) )
then
268 iy1 = input(i1)%iyear
271 if( ( crosspt .gt. 0 ) .and. ( i1 .ge. crosspt ) )
272 1
call ydsadd( iy1, id1, r8sec, -1, r8dels )
282 time(ilin) = time(ilin) - timref(3)
286 timref(3) = timref(3) + delfac*delsec
325 real*8 r8jd, secinday
326 integer*4 i, iy, id, jd, nshift
328 parameter(secinday = 60.d0 * 60.d0 * 24.d0 )
331 real*8 sjd1(nshift), sjd2(nshift), shft(nshift)
335 data sjd1/2450995.700d0,
341 data sjd2/2450996.650d0,
347 data shft/8.d0,8.d0,-2.d0,-3.d0, 0.d0/
352 r8jd =
jd(iy, 1, id) + timref(3)/secinday
355 shft(5) = (r8jd - sjd1(5))*0.41d0
361 if ((r8jd.gt.sjd1(i)).and.(r8jd.lt.sjd2(i)))
then
362 timref(3) = timref(3) + shft(i)
363 write(*,*)
'Time shift applied ', shft(i)