c: camfill.for c: c: Converted from CAMFILL.BAS basic program. c: c: ! Computes "SUB" locations during CAMERA tows by interpolating c: ! between known positions throughout the record. Data which c: ! results is aproximate position for every second c: ! c: ! ***NOTE*** this program must be compiles usuing c: ! $bas/double camfill c: ! c: ! Modified for 1988 VENTS navigation data where the tow data were c: ! by Dan Clapp from Newport as output from his navigation routines c: ! where the camera was within the AT-NAV grid, or from the c: ! INTELLIFISH program where the fish was outside the AT-NAV grid. c: ! Resulting positions at each second are in c: ! latitude and longitude (xx.xxxxx degrees) and distance along c: ! tow is calculated from position converted to meters using c: ! 1 degree latitude = 111,120 meters c: ! 1 degree long = meters from the folowing fit c: ! m/deg = -12.057143*L**2 -280.577143*L + 115890.342857 c: ! c: ! S.Walker : March 1989 character*40 sub_file,newpos_file character*80 dlin1,dlin2 integer*4 aveint integer*4 hr1,hr2, min1,min2, sec1,sec2 integer*4 latdeg1,latdeg2, londeg1,londeg2 integer*4 hrs,mins,secs real*8 xx(0:31000),yy(0:31000),stim(0:31000) real*8 x(0:31000),y(0:31000) real*8 xint,yint,dx,dy,dist,cumdist,fct real*8 x1,y1,x2,y2 real*8 latmin1,latmin2,lonmin1,lonmin2 100 write (6,101) 101 format (' Enter SUB position file name: '$) read (5,102) sub_file 102 format (a) write (6,121) 121 format (' Enter time interval used for averaging: '$) read (5,122) aveint 122 format (i10) write (6,141) 141 format (' Enter file name for extrapolated positions: '$) read (5,142) newpos_file 142 format (a) open (unit=1,name=sub_file,type='old',access='sequential', 1 carriagecontrol='list') open (unit=2,name=newpos_file,type='new',access='sequential', 1 carriagecontrol='list') j = 0 read (1,161,end=900) dlin1 161 format (a) 200 read (1,201,end=900) dlin2 201 format (a) decode (36,221,dlin1) hr1,min1,sec1, 1 latdeg1,latmin1, 1 londeg1,lonmin1 221 format (5x,i2,i3,i3,i4,f7.3,1x,i4,f7.3) decode (36,221,dlin2) hr2,min2,sec2, 1 latdeg2,latmin2, 1 londeg2,lonmin2 y1 = latdeg1 + (latmin1/60.0) y2 = latdeg2 + (latmin2/60.0) x1 = londeg1 + (lonmin1/60.0) x2 = londeg2 + (lonmin2/60.0) time1 = sec1 + (60*min1) + ((60*hr1)*60) time2 = sec2 + (60*min2) + ((60*hr2)*60) t2adj = sec2 + (60*min2) + ((60*24)*60) c: timeint is time difference from previous in seconds if ( time2 .lt. time1 ) timeint = (t2adj-time1) if ( time2 .gt. time1 ) timeint = (time2-time1) xint = abs((x1-x2)/timeint) yint = abs((y1-y2)/timeint) if ( x1 .gt. x2 ) xint = -xint if ( y1 .gt. y2 ) yint = -yint do i = 0, timeint xx(i) = x1 + (xint*i) yy(i) = y1 + (yint*i) stim(i) = time1 + i end do do i = 0, timeint-1 hrs = aint((stim(i)/60.0)/60.0) hrsec = hrs*60*60 rems = stim(i) - hrsec mins = aint(rems/60) minsec = mins*60 rems = rems - minsec secs = rems if ( aveint .eq. 15 ) then c: Time interval == 15, use interp values at secs == 7, 22, 37, 52 if ( mod(secs,15) .eq. 7) go to 300 go to 700 end if if ( aveint .eq. 10 ) then c: Time interval == 10, use interp values at secs == 5, 15, 25, ... if ( mod(secs,10) .eq. 5) go to 300 go to 700 end if if ( aveint .eq. 5 ) then c: Time interval == 5, use interp values at secs == 2, 7, 12, ... if ( mod(secs,5) .eq. 2) go to 300 go to 700 end if c: Time interval == 5, use interp values at secs == 0, 1, 2, ... if ( aveint .eq. 1 ) go to 300 write (6,261) aveint 261 format (/' Averaging interval ==',i3,' not accounted for by', 1 ' this program... quitting.'/) call exit c: Compute distance from previous point and cumulative distance 300 x(j) = xx(i) y(j) = yy(i) if ( j .eq. 0 ) cumdist = 0 if ( j .gt. 0 ) then dx = abs(x(j)-x(j-1)) dy = abs(y(j)-y(j-1)) C** fct = (-12.057143*(y(j)**2))-(280.577143*y(j))+115890.342857 fct = ( dble(-12.057143) * (y(j)**2) )- 1 ( dble(280.577143) * y(j) ) + 1 dble(115890.342857) dx = dx * fct dy = dy * dble(111120.0) dist = sqrt((dx**2) + (dy**2)) cumdist = cumdist + dist end if if ( hrs .gt. 23) hrs = hrs-24 write (2,321) hrs,mins,secs, xx(i),yy(i),cumdist 321 format (i2.2,':',i2.2,':',i2.2,3x,3f15.6) j = j+1 go to 700 700 continue end do dlin1 = dlin2 go to 200 900 continue call exit end