ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c "bins" sorts the data into files by bins. c It also creates header for ZOO files c c c amue Jan. 23, 1997 c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine bins(nav,name,nzmax,ndata,dt,ibinsize,zscale,mon) common /ini2/c30,s30,c,fact,fact1,xsc_lat,pi,d2r c real c30,s30,c,fact,fact1,pi,d2r double precision xsc_lat character file1*12,file2*12,label*4,path*20,adcp*49,nav*49,all1*93 character name*38,input*12,cal_name*16,all*89,name1*10,zname*10,btname*10 character biname*10,trans*95,header1*60,header2*60 character h_title(10)*14,h_units(10)*14,h_date*12 character zoo_file*44,file3*8 real h_val(10) real uu(13000),vv(13000) integer mon(12) c tsca2 = 24.*60.*60. tsca3 = 60.*60. write(6,*)nav open (unit=11,file=nav) c read(11,129)nfields,iy,im,iday,ih,iy1,im1,iday1,ih1,file3,ibin1 write(6,129)nfields,iy,im,iday,ih,iy1,im1,iday1,ih1,file3,ibin1 129 format(9(i2,1x),a8,1x,i4) read(11,120) h_title(1),h_units(1),h_date write(6,120) h_title(1),h_units(1),h_date 120 format(a10,1x,a12,1x,a12) read(11,*)(h_title(j),h_units(j),h_val(j),j=2,nfields) write(6,*)(h_title(j),h_units(j),h_val(j),j=2,nfields) read(11,118)header1 read(11,118)header2 118 format(a60) close (11) c magnetic rotation by 12.5 degrees ccw c arg = pi*12.5/180. tstart = ( (mon(im)+ iday)* tsca2+ ih*tsca3 )/tsca2 tend = ( (mon(im1)+iday1)*tsca2+ih1*tsca3 )/tsca2 do 11 ibin=1,nzmax write(6,*)'processing zoo-file for bin #:',ibin open(unit=10,file='tem') open(unit=13,file=name) t_old = tstart ntrans = 0 do 9 idata=1,ndata read(13,*)t,y,x,ib,u,v,temp,avg_int,avg_cor,avg_pg,shipbar,w,e if (t.ge.tstart .and. t.le.tend .and. ib.eq.ibin) then ddt = t-t_old if (ddt*24.*60. .le. dt+2.) then urot = ( u*cos(arg)+v*sin(arg)) vrot = (-u*sin(arg)+v*cos(arg)) ntrans = ntrans+1 uu(ntrans) = urot vv(ntrans) = vrot write(10,117)t,vrot,urot,temp,avg_int,avg_cor,avg_pg,w,e 117 format(4f10.3,3f7.0,2f10.3) 116 format(4f10.3,' NaN NaN NaN NaN NaN') else ngap = ddt*60.*24./dt if (ngap.eq.1) then tt = t_old+dt/60./24 write(10,117)tt,vrot,urot,temp,avg_int,avg_cor,avg_pg,w,e ntrans = ntrans+1 else if (ngap.eq.2) then tt = t_old+dt/60./24 write(10,117)tt,vrot,urot,temp,avg_int,avg_cor,avg_pg,w,e tt = t_old+2.*dt/60./24 write(10,117)tt,vrot,urot,temp,avg_int,avg_cor,avg_pg,w,e ntrans = ntrans+2 else if (ngap.le.13) then do 25 igap=1,ngap ntrans = ntrans+1 tt = t_old+float(igap)*dt/24./60. write(10,116)tt,vv(ntrans-12),uu(ntrans-12),temp 25 continue write(666,*)t,ngap,' records tidal fill in bin',ibin else do 12 igap=1,ngap write(10,128) ntrans = ntrans+1 128 format('NaN NaN NaN NaN NaN NaN NaN NaN NaN') 12 continue write(666,*)t,ngap,'records missing in bin',ibin write(6,*)ngap,' records missing in bin',ibin end if end if t_old = t end if 9 continue close (10) close (13) open (unit=10,file='tem') c open (unit=12,file='tem1') if(ibin.lt.10) write(12,125)file3,ibin if(ibin.ge.10) write(12,126)file3,ibin c125 format('/d54/data/moor/bb96/process/gap/',a8,'.00',i1) c126 format('/d54/data/moor/bb96/process/gap/',a8,'.0',i2) 125 format('/home/muenchow/9606/moor/bbmoor/',a8,'.00',i1) 126 format('/home/muenchow/9606/moor/bbmoor/',a8,'.0',i2) close (12) open (unit=12,file='tem1') read(12,127)zoo_file 127 format(a44) close (12) c open(unit=12,file=zoo_file) h_title(4) = 'inst_height' h_units(4) = 'meters' depth =h_val(7) write(12,123)(h_title(j),j=1,nfields) 123 format(a13,a7,a12,a11,1x,2a4,a8) write(12,123)(h_units(j),j=1,nfields) c zbin = 0.01*(float(ibin1)+float((ibin-1)*ibinsize)*zscale) c if (xx.eq.960xbbc2) then zoff = 1.03 c end if c c write(12,119)h_date,ntrans,dt*60,depth-zbin,h_val(5),h_val(6),h_val(7) write(12,119)h_date,ntrans,dt*60,zbin+zoff,h_val(5),h_val(6),h_val(7) 119 format(1x,a12,1x,i5,f8.2,f7.2,2f10.4,f6.1) c write(12,*)header1 c write(12,*)header2 write(12,*)'time north east temp intensity correlation pg vertical error' write(12,*)'year_day cm_s cm_s deg_C db counts % cm_s cm_s' do 10 idata=1,ntrans read(10,124)all1 write(12,124)all1 124 format(a80) 10 continue close (10) close (12) 11 continue return end cccccccccccccccccccccccccccccccccccccccccccccccccccccc c c c cccccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine sticks(n,uu,vv,tt) real uu(*),vv(*),tt(*) real xscale,yscale integer n data zero/0./,uscale/1./ vscale = (600./6)/(100./2.) c 50 / 50 r2d = 180./atan(1.)/4. c open (unit=61,file='adcp-stick.plt') c open (unit=62,file='adcp-stick.dat') do 1 i=2,n speed = sqrt(uu(i)*uu(i)+vv(i)*vv(i)) dir = atan2(uu(i),vv(i))*r2d v = -uu(i)*uscale u = vv(i)*vscale t0 = tt(i) write(61,101)t0,zero,speed,dir write(61,101)t0+u,v,speed,dir write(61,101)t0,zero,speed,dir 1 continue c 101 format(4f10.1) return end cccccccccccccccccccccccccccccccccccccccccccccccccccccc c c "plt_vs" plots variables related to the ship's speed c c 05-07-1992 amue c ccccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine plt_vs(nens) common /names/label character label*2,name*8,name2*8,all*80 c open (unit=10,file='scratch') write(3,*)'plotxy ',name write(10,101)label,label 101 format('pltvs.',a2,'vshp.',a2) close(10) open (unit=10,file='scratch') read(10,102)name,name2 write(3,*)'plotxy ',name write(3,*)'plotxy ',name 102 format(2a8) close(10) c open (unit=13,file=name2) open (unit=10,file='vship.dat') do 1 i=1,nens read(10,103)all write(13,103)all 1 continue 103 format(a80) close (13) close(10) c open (unit=12,file=name) dt = nens/10 c speed BT write(12,104)name2,name2,name2,name2,name2,name2,label 104 format( 'file ',a9/'mode 20 1 3'/'read'/'xlim 6'/'ylim 1.5'/ 1 'xlab Ensemble'/'ylab Speed (cm/s)'/'save'/ c speed GPS 1 'file ',a9/'mode 20 1 4'/'dash'/'read'/'plot'/'stack'/ c dir. BT 1 'file ',a9/'mode 20 1 5'/'dash 0 0'/'read'/ 1 'ylab Direction (deg.)'/'save'/ c dir. GPS 1 'file ',a9/'mode 20 1 6'/'dash'/'read'/'plot'/'stack'/ c BT-GPS 1 'file ',a9/'mode 20 1 7'/'dash 0 0'/'read'/ 1 'ylab GPS-BT (cm/s)'/'plot'/'stack'/ c BT-GPS 1 'file ',a9/'mode 20 1 8'/'read'/'ylab GPS-BT (deg.)'/ 1 'title ',a2/'plot'/'stop'/) return end cccccccccccccccccccccccccccccccccccccccccccccccccccc c c "plt_tilt" plots the tilt sensor output for each ensemble c c 05-07-1992 amue c ccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine plt_tilt(nens) common /names/label character label*2,name*8,name2*8,all*101 c open (unit=10,file='scratch') write(10,101)label,label 101 format('pltxy.',a2,'tilt.',a2) close(10) open (unit=10,file='scratch') read(10,102)name,name2 write(3,*)'plotxy ',name 102 format(2a8) close(10) c open (unit=13,file=name2) open (unit=10,file='tilt.dat') do 1 i=1,nens read(10,103)all write(13,103)all 1 continue 103 format(a101) close (13) close(10) c open (unit=12,file=name) dt = nens/10 c head write(12,104)name2,name2,name2,name2,label 104 format('file ',a9/'mode 20 1 3'/'read'/'xlim 6'/'ylim 1.5 0 360 90'/ 1 'xlab Ensmble'/'ylab Heading (deg.)'/'plot'/'stack'/ c pitch 1 'file ',a9/'mode 20 1 5'/'read'/'ylim 1.5 -20 20 5'/ 1 'ylab Pitch (deg.)'/'plot'/'stack'/ c roll 1 'file ',a9/'mode 20 1 7'/'read'/'ylim 1.5 -20 20 5'/ 1 'ylab Roll (dg.)'/'plot'/'stack'/ c bte 1 'file ',a9/'mode 20 1 10'/'read'/'ylim 1.5 -5 5 1'/ 1 'ylab bte (m/s)'/'title ',a2/'plot'/'stop') close (12) return end cccccccccccccccccccccccccccccccccccccccccccccccccccc c c "plt_vel" plots the velocity data output for each ensemble c c 12-21-1992 amue c ccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine plt_vel(nens,ivel) common /names/label character label*2,name*9,name2*9,all*62 c open (unit=10,file='scratch') write(10,101)label,label 101 format('pltvel.',a2,'datvel.',a2) close(10) open (unit=10,file='scratch') read(10,102)name,name2 write(3,*)'plotxy ',name 102 format(2a9) close(10) c open (unit=13,file=name2) open (unit=10,file='velocity.dat') do 1 i=1,ivel read(10,103)iens,time,z,all if (z.eq.2.) then write(13,103)iens,time,z,all end if 1 continue 103 format(1x,i5,f15.2,f7.1,a62) close (13) close(10) c open (unit=12,file=name) dt = nens/10 c write(12,104)name2,name2,name2,label c vxe 104 format('file ',a9/'mode 20 1 4'/'read'/'xlim 6'/'ylim 2 -50 50'/ 1 'xlab Ensemble'/'ylab vxe (cm/s)'/'plot'/'stack'/ c vye 1 'file ',a9/'mode 20 1 5'/'read'/'ylab vye (cm/s)'/'plot'/'stack'/ c ve 1 'file ',a9/'mode 20 1 7'/'read'/'ylab ve (cm/s)'/ 1 'title ',a2/'plot'/'stack'/) close (12) return end cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c "co_sys" for rthe co-ordinate transormation matrix elements c c 3/35/92 amue c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine co_sys(c,scale,line2,zsg,sig_up) real zsg(*),c,scale,sig_up integer line2(*) c c get scale for co-ordinate transformation c c transmit frequency (Hz) ft = line2(17)*1000. c range switch setting: high (1) or low (2) if (line2(13).eq.0) then rss = 0.125 else if (line2(13).eq.1) then rss = 0.25 c c line2(13)==2 indicates files originates from BB-ADCP processing c i.e., no scaling is necessary as it is done in BBLIST c (what about the speed of sound that enters here?) c else if (line2(13).eq.2) then rss = 99.9 else write(6,*)'invalid range switch setting',line2(13) write(6,*)(line2(i),i=1,17) stop end if c co-ordinates: beam (1) or earth (2) if (line2(14).eq.0) then vcs = 1. else if (line2(14).eq.1) then vcs = 2. else write(6,*)'invalid velocity co-ordinate system' stop end if c c scale to convert counts to cm/s c scale = rss*vcs*c/1536. if (rss.gt.1) then write(6,*) write(6,*)'BB-ADCP processing, scale set to 0.1' write(4,*)'BB-ADCP processing, scale set to 0.1' write(6,*) c T = 9. c D = 20. c S = 31. c c = 1449.7+4.6*T-0.055*T*T+0.00029*T*T*T c c = c+(1.34-0.01*T)*(S-35)+0.016*D write(6,*)'speed of sound use',c write(4,*)'speed of sound use',c scale = 0.1*c/1500. end if c c get sign for co-ordinate transformation c if (line2(15).eq.1 .and. line2(16).eq.0) then write(4,*)'downward, convex transducer' zsg(1) = 1. zsg(2) = -1. zsg(3) = -1. zsg(4) = 1. sig_up = 1. else if (line2(15).eq.1 .and. line2(16).eq.1) then write(4,*)'downward, concave transducer' zsg(1) = -1. zsg(2) = 1. zsg(3) = 1. zsg(4) = -1. sig_up = 1. else if (line2(15).eq.0 .and. line2(16).eq.0) then write(4,*)'upward, convex transducer' zsg(1) = 1. zsg(2) = -1. zsg(3) = 1. zsg(4) = -1. sig_up = -1. else if (line2(15).eq.0 .and. line2(16).eq.1) then write(4,*)'upward, concave transducer' zsg(1) = -1. zsg(2) = 1. zsg(3) = -1. zsg(4) = 1. sig_up = -1. end if write(4,*)'scale (co_sys): ',scale return end ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine read_raw(iens,ncell,nz,izcut) common /raw/line1(6),line2(17),line3(5),line4(8),line5(13),line6(5), 1 line(128,18),id(128),d1(128),d2(128),d3(128),d4(128), 1 bt1,bt2,bt3,bt4,h1,h2,h3,h4,ncol integer bt1,bt2,bt3,bt4,h1,h2,h3,h4 integer line1,line2,line3,line4,line5,line6,dummy(18) integer line,id,ncol,izcut,iens,ncell,nz real d1,d2,d3,d4 c date read(8,*)iens,(line1(j),j=2,6) c write(6,*)iens,(line1(j),j=2,6) c set-up read(8,*)iens,(line2(j),j=2,17) c health read(8,*)iens,(line3(j),j=2,5) c tilt read(8,*)iens,(line4(j),j=2,8) c b-track c read(8,*)iens,(line5(j),j=2,13) read(8,*)iens,bt1,bt2,bt3,bt4,h1,h2,h3,h4,(line5(j),j=10,13) c CTD read(8,*)iens,(line6(j),j=2,5) c Velocity Profile ncell = line2(6)-izcut c if (ncell.gt.nz) then c write(6,*)'# of depth cells read in header (iens)',ncell,iens c write(6,*)'increase dimension for nz (# of bins)' c stop c end if c c doppler shift of beam #1 to #4 in counts c do 3 ib=1,min(ncell,nz) read(8,*)iens,ibin,(line(ib,j),j=3,ncol) d1(ibin) = line(ibin,3) d2(ibin) = line(ibin,4) d3(ibin) = line(ibin,5) d4(ibin) = line(ibin,6) id(ibin) = max(d1(ibin),d2(ibin),d3(ibin),d4(ibin)) 3 continue if (ncell.gt.nz) then do 4 ib=nz+1,ncell read(8,*)iens,ibin,(dummy(j),j=3,ncol) 4 continue ncell = nz end if return end cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c bb-adcp c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine readbraw(iens,ncell,nz,izcut,tilt) common /raw/line1(6),line2(17),line3(5),line4(8),line5(13),line6(5), 1 line(85,18),id(85),d1(85),d2(85),d3(85),d4(85), 1 bt1,bt2,bt3,bt4,h1,h2,h3,h4,ncol integer bt1,bt2,bt3,bt4,h1,h2,h3,h4 integer line1,line2,line3,line4,line5,line6 integer line,id,ncol real d1,d2,d3,d4,tilt(8) c date read(8,*)iens,(line1(j),j=2,6) c write(6,*)iens,(line1(j),j=2,6) c set-up read(8,*)iens,(line2(j),j=2,17) c write(6,*)iens,(line2(j),j=2,17) c read(5,*)dummy c health read(8,*)iens,(line3(j),j=2,5) c write(6,*)iens,(line3(j),j=2,5) c tilt read(8,*)iens,(tilt(j),j=2,8) c write(6,*)iens,(tilt(j),j=2,8) c b-track c read(8,*)iens,(line5(j),j=2,13) read(8,*)iens,bt1,bt2,bt3,bt4,h1,h2,h3,h4,(line5(j),j=10,13) c read(8,*)iens,bt1,bt2,bt3,bt4,h1,h2,h3,h4 c write(6,*)iens,bt1,bt2,bt3,bt4,h1,h2,h3,h4,(line5(j),j=10,13) c CTD read(8,*)iens,(line6(j),j=2,5) c write(6,*)iens,(line6(j),j=2,5) c Velocity Profile ncell = line2(6)-izcut if (ncell.gt.nz) then write(6,*)'# of depth cells read in header (iens)',ncell,iens write(6,*)'increase dimension for nz (# of bins)' stop end if c c doppler shift of beam #1 to #4 in counts c do 3 ib=1,ncell read(8,*)iens,ibin,(line(ibin,j),j=3,ncol) d1(ibin) = line(ibin,3) d2(ibin) = line(ibin,4) d3(ibin) = line(ibin,5) d4(ibin) = line(ibin,6) id(ibin) = max(d1(ibin),d2(ibin),d3(ibin),d4(ibin)) 3 continue return end cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c os-adcp c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine read_os(iens,ncell,nz) common /raw/line1(6),line2(17),line3(5),line4(8),line5(13),line6(5), 1 line(85,18),id(85),d1(85),d2(85),d3(85),d4(85), 1 bt1,bt2,bt3,bt4,h1,h2,h3,h4,ncol integer bt1,bt2,bt3,bt4,h1,h2,h3,h4 integer line1,line2,line3,line4,line5,line6 integer line,id,ncol real d1,d2,d3,d4,tilt(8) c date read(91,*)iens,(line1(j),j=2,6) c write(6,*)iens,(line1(j),j=2,6) c set-up read(92,*)iens,(line2(j),j=2,17) c write(6,*)iens,(line2(j),j=2,17) c read(5,*)dummy c health c read(93,*)iens,(line3(j),j=2,5) c write(6,*)iens,(line3(j),j=2,5) c tilt read(94,*)iens,(line4(j),j=2,8) c write(6,*)iens,(line4(j),j=2,8) c b-track c read(8,*)iens,(line5(j),j=2,13) read(96,*)iens,bt1,bt2,bt3,bt4,h1,h2,h3,h4 read(95,*)iens,(line5(j),j=10,13) c write(6,*)iens,bt1,bt2,bt3,bt4,h1,h2,h3,h4,(line5(j),j=10,13) c CTD c read(8,*)iens,(line6(j),j=2,5) c write(6,*)iens,(line6(j),j=2,5) c Velocity Profile ncell = line2(6) if (ncell.gt.nz) then write(6,*)'# of depth cells read in header (iens)',ncell,iens write(6,*)'increase dimension for nz (# of bins)' stop end if c c doppler shift of beam #1 to #4 in counts c do 3 ib=1,ncell read(97,*)iens,ibin,(line(ibin,j),j=3,6) read(98,*)iens,ibin,(line(ibin,j),j=7,10) read(89,*)iens,ibin,(line(ibin,j),j=11,14) read(88,*)iens,ibin,(line(ibin,j),j=15,18) c read(8,*)iens,ibin,(line(ibin,j),j=3,ncol) d1(ibin) = line(ibin,3) d2(ibin) = line(ibin,4) d3(ibin) = line(ibin,5) d4(ibin) = line(ibin,6) id(ibin) = max(d1(ibin),d2(ibin),d3(ibin),d4(ibin)) 3 continue return end cccccccccccccccccccccccccccccccccccccccccccccccccccc c c c ccccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine initial(ifile) common /ini0/navg,nensemble,ivel,i_old,ntot,ical,nbt,nxy, 1 cheadbar,sheadbar,cpbar,spbar,crbar,srbar common /ini1/xbar,ybar,btxbar,btybar,btzbar,hbar,tbar,hsdbar,xship,yship common /ini2/c30,s30,c,fact,fact1,xsc_lat,pi,d2r double precision xsc_lat integer navg,nensemble,ivel,i_old,ntot,ical,nbt,nxy real cheadbar,sheadbar,cpbar,spbar,crbar,srbar, 1 xbar,ybar,btxbar,btybar,btzbar,hbar,tbar,hsdbar, 1 c30,s30,c,fact,fact1,pi,d2r,xship,yship c pi = 4.*atan(1.) d2r = pi/180. if (ifile.eq.1) then 999 write(6,*)'Enter beam angle: 20 for 20 deg. or 30 for 30 deg' c read(5,*)angle angle = 30. 998 write(6,*)'Enter speed of sound to be used in (m/s)' c read(5,*)c c = 1500 if (c.gt.1600 .or. c.lt.1400) then write(6,*)'Are you sure about c=',c,'m/s? 1-yes, 0-no' read(5,*)ic if (ic.eq.0) goto 998 end if c c30 = cos(angle*pi/180.) s30 = sin(angle*pi/180.) end if c convert tilt fact = 360./65536. c convert temperature fact1 = 50./4096. c convert lat to cm xsc_lat = 60.*1852.*100. c navg = 0 nensemble = 0 ivel = 0 i_old = 1 ntot = 0 ical = 0 nbt = 0 nxy = 0 cheadbar = 0. sheadbar = 0. cpbar = 0. spbar = 0. crbar = 0. srbar = 0. xbar = 0. ybar = 0. xship = 0. yship = 0. btxbar = 0. btybar = 0. btzbar = 0. hbar = 0. tbar = 0. hsdbar = 0. return end ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c "nav_scr" screens the nav data according to an algorithmn c originally developed in "boot_strap.f" c c 6/21/93 amue c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc subroutine nav_scr(n,t,x,y,ipass) parameter (nn=99000) real t(*),x(*),y(*),xx(nn),yy(nn) integer ipass if (n.gt.nn) then write(6,*)'increase dimensions "nav_scr"' stop end if c pi = 4.*atan(1.) dt = (t(n)-t(1))/float(n) write(6,101)t(1)/60.,t(n)/60.,dt write(4,101)t(1)/60.,t(n)/60.,dt 101 format(/'start and end time (min): ',2f10.0/ 1 'avg. time between ensembles (sec) ',f10.3/) id1 = 10 id2 = 20 c c 10 m/s ship speed corresponds to d1_crit, d2_crit meters c d1_crit = 10.*dt*float(id1) d2_crit = 10.*dt*float(id2) write(6,*) write(6,*)'id1,id2,d1_crit,d2_crit',id1,id2,d1_crit,d2_crit ipass = 0 ifail = 0 xsc = 60.*1852. do 4 i=id2+1,n-id2 arg = pi*y(i)/180. ysc = xsc*cos(arg) dx1m = abs(x(i)-x(i-id1))*xsc dx1p = abs(x(i)-x(i+id1))*xsc c dx2m = abs(x(i)-x(i-id2))*xsc dx2p = abs(x(i)-x(i+id2))*xsc c dy1m = abs(y(i)-y(i-id1))*ysc dy1p = abs(y(i)-y(i+id1))*ysc c dy2m = abs(y(i)-y(i-id2))*ysc dy2p = abs(y(i)-y(i+id2))*ysc c dx = max(dx1m,dx1p,dx2m,dx2p) dy = max(dy1m,dy1p,dy2m,dy2p) c if ( (dx1p.lt.d1_crit .and. dx1m.lt.d1_crit) .and. 1 (dy1p.lt.d1_crit .and. dy1m.lt.d1_crit) .and. 1 (dx2p.lt.d2_crit .and. dx2m.lt.d2_crit) .and. 1 (dy2p.lt.d2_crit .and. dy2m.lt.d2_crit)) then yy(i) = y(i) xx(i) = x(i) ipass = ipass+1 iflag = 0 else ddt = t(i-1)-t(i-id1) ddx = (xx(i-1)-xx(i-id1))/ddt ddy = (yy(i-1)-yy(i-id1))/ddt xx(i) = xx(i-id1)+ddx*id1*dt yy(i) = yy(i-id1)+ddy*id1*dt iflag = 999 ifail = ifail+1 end if write(99,105)i,t(i),xx(i)*xsc,yy(i)*ysc,dx,dy,iflag 4 continue ipfail = float(ifail)/float(n)*100. write(6,*)'n,ipass.ifail,% failing ',n,ipass,ifail,ipfail write(4,*)'n,ipass.ifail,% failing ',n,ipass,ifail,ipfail write(4,*) l = 0 do 9 i=id2+1,n-id2 x(i) = xx(i) y(i) = yy(i) 9 continue n = l 105 format(i6,f10.3,2f11.5,2f15.2,i5) return end