CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC c c "bin3.f" reads binary ADCP data in single-byte pieces on a Mac PowerBook-G4 c for 2003 OS-75 kHz and BB-153 kHz data collected aboard the USCGC Healy. c c The binary file size is nn bytes and must be either set manually c or via control file that runs adcp.csh that may have c created this code. c c May-30-2003 Andreas Muenchow, University of Delaware c July-28-2003 modified at sea (amue) c Sept.-12-2003 accomodating BB and NB pulses for each ping CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC parameter (nn=10486428) integer*1 a(nn) integer*1 l,l1,l2,l3,l4 integer*4 i4,i3,ib integer*4 itime,imsec(4),isec(4),imin(4),ihrs(4),ntot integer nbytes,bytes_e,bytes_h,xlen,ppens,ibt_on,iping2_on integer zbin,zblk,vel(4),cor(4),int(4),pgd(4),sta1(4) integer zbin2,zblk2,vel2(4),cor2(4),int2(4),pgd2(4) integer bvel(4),bz(4),bcor(4),bint(4),bpgd(4),bb_switch c real*8 iavg(50,4) c double precision bam16,bam32,xlat,xlon character*60 input,output character*7 ic1,ic2,ic3 c bam32 = 180./2**31 bam16 = 180./2**15 c input = 'OS75050_000001.ENS' open(unit=99,file='adcp.log') c c adcp-short contains the TRUE configurations independent of any parameter settings c open(unit=79,file='adcp-short') c write(6,*) 'ADCP binary to ASCII ',input write(99,*) 'Processing ',input c c Ensemble time c open (unit=91,file='line1') c c deployment settings (configuration) c open (unit=92,file='line2') c c ADCP health (empty) c open (unit=93,file='line3') c c Pitch/Roll/Heading c open (unit=94,file='line4') c c Bottom tracking c open (unit=95,file='line5') open (unit=96,file='line6') c c Depth cell data c open (unit=97,file='l1') open (unit=98,file='l2') open (unit=89,file='l3') open (unit=88,file='l4') c c Navigation data (.ENS files) c open (unit=16,file='l-nav') c c open (unit=26,file=output) open (unit=10, file=input, form='unformatted', access='direct', recl=nn) read(10,rec=1)a close (10) c write(6,*)'Done reading file into memory' c c Header Data: a(6) is # of data fields c l = a(6) nfields = mod(l+256,256) bytes_h = 6+nfields*2 c c Header Data: # of bytes in ensemble c l1 = a(3) l2 = a(4) bytes_e = 2+mod(l1+256,256)+256*mod(l2+256,256) nensemble = nn/bytes_e-1 c nensemble = 1 c write(6,*)'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&' c write(6,*)'bytes in header: ',bytes_h c write(6,*)'bytes in ensemble: ',bytes_e c write(6,*)'number of ensemble:',nensemble c write(6,*)'number of fields:',nfields c write(6,*)'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&' c c Header Data: starting byte position for each data field c ibt_1 = 0 ista_2 = 0 do 21 i=1,nfields l1 = a(2*i+5) l2 = a(2*i+6) ib = mod(l1+256,256)+256*mod(l2+256,256) c c identifyer for each block: c Set-up: 0:000 fixed leader c 0:128 variable leader c Profile Data: 0:001 velocity (0100) c 0:002 correlation c 0:003 intensity c 0:004 Pg c 0:005 Status c 0:006 Bottom Track c l1 = a(ib+1) l2 = a(ib+2) idd = mod(l1+256,256)+256*mod(l2+256,256) if (idd.eq.256) then write(99,*)i,' field number has identifyer:',idd,' velocity-1',ib ivel_1 = ib else if (idd.eq.2*256) then write(99,*)i,' field number has identifyer:',idd,' correlation-1',ib icor_1 = ib else if (idd.eq.3*256) then write(99,*)i,' field number has identifyer:',idd,' intensity-1',ib iint_1 = ib else if (idd.eq.4*256) then write(99,*)i,' field number has identifyer:',idd,' p-good-1',ib ipgd_1 = ib else if (idd.eq.5*256) then write(99,*)i,' field number has identifyer:',idd,' status-1',ib ista_1 = ib else if (idd.eq.6*256) then write(99,*)i,' field number has identifyer:',idd,' bottom-track-1',ib ibt_1 = ib else if (idd.eq.128) then write(99,*)i,' field number has identifyer:',idd,' variable leader-1',ib ivlead_1 = ib c second ping start else if (idd.eq.256+1) then write(99,*)i,' field number has identifyer:',idd,' velocity-2',ib ivel_2 = ib else if (idd.eq.2*256+1) then write(99,*)i,' field number has identifyer:',idd,' correlation-2',ib icor_2 = ib else if (idd.eq.3*256+1) then write(99,*)i,' field number has identifyer:',idd,' intensity-2',ib iint_2 = ib else if (idd.eq.4*256+1) then write(99,*)i,' field number has identifyer:',idd,' p-good-2',ib ipgd_2 = ib else if (idd.eq.5*256+1) then write(99,*)i,' field number has identifyer:',idd,' status-2',ib ista_2 = ib else if (idd.eq.6*256+1) then write(99,*)i,' field number has identifyer:',idd,' bottom-track-2',ib ibt_2 = ib else if (idd.eq.128+1) then write(99,*)i,' field number has identifyer:',idd,' variable leader-2',ib ivlead_2 = ib else if (idd.eq.1) then write(99,*)i,' field number has identifyer:',idd,' fixed leader-2',ib iflead_2 = ib c second ping end else if (idd.eq.0) then write(99,*)i,' field number has identifyer:',idd,' fixed leader-1',ib iflead_1 = ib else if (idd.eq.3*4096) then write(99,*)i,' field number has identifyer:',idd,' fixed attitude-1',ib ifat_1 = ib else if (idd.ge.12352 .and. idd.le.12540) then write(99,*)i,' field number has identifyer:',idd,' variable attitude-1',ib ivat_1 = ib else if (idd.eq.2*4096) then write(99,*)i,' field number has identifyer:',idd,' navigation-1',ib inav_1 = ib else c write(6,*)'Unknown field identifyer, modify code', idd stop end if 21 continue c c c bb_switch = 1 if (bb_switch.eq.1 .and. ivel_2.gt.0) ivel_1 = ivel_2 if (bb_switch.eq.1 .and. ipgd_2.gt.0) ipgd_1 = ipgd_2 if (bb_switch.eq.1 .and. iint_2.gt.0) iint_1 = iint_2 if (bb_switch.eq.1 .and. icor_2.gt.0) icor_1 = icor_2 if (bb_switch.eq.1 .and. iflead_2.gt.0) iflead_1 = iflead_2 if (bb_switch.eq.1 .and. ivlead_2.gt.0) ivlead_1 = ivlead_2 c c c c write(6,*)'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&' c c Fixed Leader Data: # of depth bins c l = a(iflead_1+3) ifware1 = mod(l+256,256) l = a(iflead_1+4) ifware2 = mod(l+256,256) l = a(iflead_1+5) icfg = mod(l+256,256) ic1 = 'down' iori = 1 ic2 = 'concave' ipat = 1 if (icfg.ge.128) then ic1 = 'up' iori = 0 icfg = icfg-128 end if if (icfg .ge. 64) then icfg = icfg-64 end if if (icfg . ge. 32) then icfg = icfg-32 end if if (icfg .ge. 16) then icfg = icfg-16 end if if (icfg .ge. 8) then ipat = 0 ic2 = 'convex' icfg = icfg-8 end if if (icfg.eq.0) ifreq = 75 if (icfg.eq.1) ifreq = 153 if (icfg.eq.2) ifreq = 307 if (icfg.eq.3) ifreq = 614 if (icfg.eq.4) ifreq = 1224 if (icfg.eq.5) ifreq = 2449 l = a(iflead_1+6) icfg = mod(l+256,256) if (icfg .ge. 128) then icfg = icfg-128 end if if (icfg .ge. 64) then icfg = icfg-64 end if if (icfg .ge. 32) then icfg = icfg-32 end if if (icfg .ge. 16) then icfg = icfg-16 end if if (icfg .ge. 8) then icfg = icfg-8 end if if (icfg .ge. 4) then icfg = icfg-4 end if if (icfg.eq.0) iang = 15 if (icfg.eq.1) iang = 20 if (icfg.eq.2) iang = 30 if (icfg.eq.3) iang = 99 l = a(iflead_1+10) nbin = mod(l+256,256) l1 = a(iflead_1+11) l2 = a(iflead_1+12) ppens = mod(l1+256,256)+256*mod(l2+256,256) l1 = a(iflead_1+13) l2 = a(iflead_1+14) zbin = mod(l1+256,256)+256*mod(l2+256,256) l1 = a(iflead_1+15) l2 = a(iflead_1+16) zblk = mod(l1+256,256)+256*mod(l2+256,256) l = a(iflead_1+26) cosys = mod(l+256,256) icfg = cosys ic3 = 'beam' if (icfg .ge. 128) then icfg = icfg-128 end if if (icfg .ge. 64) then icfg = icfg-64 end if if (icfg .ge. 32) then icfg = icfg-32 end if if (icfg .ge. 24) then icfg = icfg-16 ic3 = 'earth' else if (icfg .ge. 16) then icfg = icfg-16 ic3 = 'ship' end if if (icfg .ge. 8) then icfg = icfg-8 ic3 = 'inst.' end if l1 = a(iflead_1+33) l2 = a(iflead_1+34) zdis = mod(l1+256,256)+256*mod(l2+256,256) l1 = a(iflead_1+35) l2 = a(iflead_1+36) xlen = mod(l1+256,256)+256*mod(l2+256,256) c write(99,*)'Firmware ',ifware1,'.',ifware2 write(99,*)'System frequency ',ifreq write(99,*)'Co-ordinate system ',ic3 write(99,*)'Beam pattern ',ic2 Write(99,*)'Beam orientation ',ic1 write(99,*)'Beam angle ',iang write(99,*)'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&' write(99,*)'Distance to center bin ',zdis write(99,*)'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&' write(99,*)'WN-command (# of bins )',nbin write(99,*)'WP-command (pings/ens )',ppens write(99,*)'WS-command (bin length)',zbin write(99,*)'WT-command (TXD length)',xlen write(99,*)'WF-command (blanking )',zblk write(99,*)'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&' c write(6,*)'Firmware ',ifware1,'.',ifware2 c write(6,*)'System frequency ',ifreq c write(6,*)'Co-ordinate system ',ic3 c write(6,*)'Beam pattern ',ic2 c Write(6,*)'Beam orientation ',ic1 c write(6,*)'Beam angle ',iang c write(6,*)'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&' c write(6,*)'Distance to center bin-1 ',zdis c write(6,*)'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&' c write(6,*)'WN-command (# of bins )',nbin c write(6,*)'WP-command (pings/ens )',ppens c write(6,*)'WS-command (bin length)',zbin c write(6,*)'WT-command (TXD length)',xlen c write(6,*)'WF-command (blanking )',zblk c write(6,*)'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&' ibt_on = 0 iping2_on = 0 if (ibt_1 .gt. 1) then ibt_on = 1 end if if (ivel_2 .gt. 1) then iping2_on = 1 end if write(79,179) input,nensemble,nbin,zbin/100,zblk/100,zdis/100,ibt_on,iping2_on 179 format(a60,i7,i4,i3,i3,f6.2,i2,i2) idum = 2 c c Variable Profile Data: c do 22 k=1,nensemble c c Variable Leader Data: c idate = ivlead_1+(k-1)*bytes_e c c Ensemble Number: c l1 = a(idate+3) l2 = a(idate+4) iens = mod(l1+256,256)+256*mod(l2+256,256) c c Ensemble Time: c l = a(idate+5) iyea = mod(l+256,256) l = a(idate+6) imon = mod(l+256,256) l = a(idate+7) iday = mod(l+256,256) l = a(idate+8) ihrs(4) = mod(l+256,256) l = a(idate+9) imin(4) = mod(l+256,256) l = a(idate+10) isec(4) = mod(l+256,256) write(91,191)iens,imon,iday,ihrs(4),imin(4),isec(4) 191 format(i10,6i3) id2 = 2 idum = 0 write(92,192)iens,idum,idum,idum,ppens,nbin,zbin,xlen,zblk,idum,idum,idum,id2,idum,iori,ipat,ifreq 192 format(i10,3i3,i5,i3,2i5,i7,4i3,2i3,2i5) c c Attitude Sensors: c l1 = a(idate+19) l2 = a(idate+20) ihdg = mod(l1+256,256)+256*mod(l2+256,256) l1 = a(idate+21) l2 = a(idate+22) ipit = mod(l1+256,256)+256*mod(l2+256,256) l1 = a(idate+23) l2 = a(idate+24) irol = mod(l1+256,256)+256*mod(l2+256,256) l1 = a(idate+27) l2 = a(idate+28) item = mod(l1+256,256)+256*mod(l2+256,256) l = a(idate+32) isdh = mod(l+256,256) l = a(idate+33) isdp = mod(l+256,256) l = a(idate+34) isdr = mod(l+256,256) c write(26,101)iens,iyea,imon,iday,ihrs(4),imin(4),isec(4),ihdg,ipit,irol,item,isdh,isdp,isdr write(94,194)iens,ipit,irol,ihdg,isdp,isdr,isdh,item 194 format(i10,7i8) 22 continue 101 format(i6,i4,5i3,7i6) c if (ifat_1.gt.0) then c write(6,*) 'processing fixed attitude data' write(99,*)'processing fixed attitude data' l1 = a(ifat_1+1) l2 = a(ifat_1+2) id1 = mod(l1+256,256) id2 = mod(l2+256,256) end if c c Velocity Data c if (ivel_1.gt.0) then c write(6,*)'processing velocity data' write(99,*)'processing velocity data' do 32 k=1,nensemble ivel0 = ivel_1+(k-1)*bytes_e-8 do 33 ibin=1,nbin ivel1 = ivel0+ibin*8 do 34 j=1,4 ivel = ivel1+j*2 l1 = a(ivel+1) l2 = a(ivel+2) c c use sign of most significant bit c vel(j) = mod(l1+256,256)+256*l2 if(vel(j).eq.-32768) vel(j) = 99999 34 continue write(97,197)k,ibin,(vel(j),j=1,4) 197 format(i10,i4,4i7) 33 continue 32 continue end if c c Correlation c if (icor_1.gt.0) then c write(6,*)'processing correlation data' do 42 k=1,nensemble icor0 = icor_1+(k-1)*bytes_e-4+1 do 43 ibin=1,nbin icor1 = icor0+ibin*4 do 44 j=1,4 icor = icor1+j l = a(icor+1) cor(j) = mod(l+256,256) 44 continue write(98,197)k,ibin,(cor(j),j=1,4) 43 continue 42 continue end if c c Intensity c if (iint_1.gt.0) then c write(6,*)'processing echo intensity data' write(99,*)'processing echo intensity data' do 52 k=1,nensemble iint0 = iint_1+(k-1)*bytes_e-4+1 do 53 ibin=1,nbin iint1 = iint0+ibin*4 do 54 j=1,4 iint = iint1+j l = a(iint+1) int(j) = mod(l+256,256) 54 continue write(89,197)k,ibin,(int(j),j=1,4) 53 continue 52 continue end if c c Pgood c if (ipgd_1.gt.0) then c write(6,*)'processing Pgood' write(99,*)'processing Pgood' do 62 k=1,nensemble ipgd0 = ipgd_1+(k-1)*bytes_e-4+1 do 63 ibin=1,nbin ipgd1 = ipgd0+ibin*4 do 64 j=1,4 ipgd = ipgd1+j l = a(ipgd+1) pgd(j) = mod(l+256,256) 64 continue write(88,197)k,ibin,(pgd(j),j=1,4) 63 continue 62 continue c write(26,102)iens,ibin,(vel(j),j=1,4),(cor(j),j=1,4),(int(j),j=1,4),(pgd(j),j=1,4) 102 format(i6,i4,4i8,12i4) end if c c Bottom Track: c if (ibt_1.gt.0) then cc write(6,*)'processing bottom track data' write(99,*)'processing bottom track data' do 72 k=1,nensemble ibt0 = ibt_1+(k-1)*bytes_e l1 = a(ibt0+3) l2 = a(ibt0+4) ibtpens = mod(l1+256,256)+256*mod(l2+256,256) do 74 j=1,4 ibz1 = ibt0+15+2*j ibz2 = ibt0+77+j ibvel = ibt0+23+2*j ibcor = ibt0+32+j ibpgd = ibt0+40+j l1 = a(ibz1) l2 = a(ibz1+1) l3 = a(ibz2) bz(j) = mod(l1+256,256)+256*(mod(l2+256,256)+256*mod(l3+256,256)) l1 = a(ibvel) l2 = a(ibvel+1) bvel(j) = mod(l1+256,256)+256*l2 l = a(ibpgd) bpgd(j) = mod(l+256,256) if (bpgd(j).lt.100) then bz(j) = -1 bvel(j) = 99999 end if l = a(ibcor) bcor(j) = mod(l+256,256) 74 continue write(95,195)k,(bcor(j),j=1,4),(bpgd(j),j=1,4) write(96,195)k,(bvel(j),j=1,4),(bz(j),j=1,4) 195 format(i10,8i8) 72 continue else c c write dummy BT data for osadcp.f c bz(1) = -1 bz(2) = -1 bz(3) = -1 bz(4) = -1 do 73 k=1,nensemble write(95,195)k,(bcor(j),j=1,4),(bpgd(j),j=1,4) write(96,195)k,(bvel(j),j=1,4),(bz(j),j=1,4) 73 continue end if if (ivat_1.gt.0) then c write(6,*)'processing variable Attitude data' write(99,*)'processing variable Attitude data' l1 = a(ivat_1+1) l2 = a(ivat_1+2) id1 = mod(l1+256,256)+256*mod(l2+256,256) c write(6,*)'vat',id1 do 82 k=1,nensemble ivat0 = ivat_1+(k-1)*bytes_e kk = 0 do 83 j=3,97,12 kk = kk+1 l1 = a(ivat0+j) l2 = a(ivat0+j+1) ihdg1 = mod(l1+256,256)+256*mod(l2+256,256) l1 = a(ivat0+j+2) l2 = a(ivat0+j+3) ipit1 = mod(l1+256,256)+256*mod(l2+256,256) l1 = a(ivat0+j+4) l2 = a(ivat0+j+5) irol1 = mod(l1+256,256)+256*mod(l2+256,256) c write(36,*)k,kk,ihdg1,ipit1,irol1 83 continue 82 continue end if c c status c if (ista_1.gt.0) then c write(6,*)'processing Status data' write(99,*)'processing Status data' c c do 93 k=1,nensemble c ista0 = ista_1+(k-1)*bytes_e-4+1 c do 65 ibin=1,nbin c ista1 = ista0+ibin*4 c do 66 j=1,4 c ista = ista1+j c l = a(ista+1) c sta1(j) = mod(l+256,256) 66 continue c write(6,*)k,ibin,(sta1(j),j=1,4) 65 continue 93 continue end if c c Navigation c if (inav_1.gt.0) then c write(6,*)'processing Navigation data' write(99,*)'processing Navigation data' i2 = 256 i3 = i2*256 i4 = i3*256 do 92 k=1,nensemble inav0 = inav_1+(k-1)*bytes_e l1 = a(inav0+51) l2 = a(inav0+52) l3 = a(inav0+53) l4 = a(inav0+54) iens = mod(l1+256,256)+mod(l2+256,256)*i2 iens = iens+mod(l3+256,256)*i3+mod(l4+256,256)*i4 c l = a(inav0+3) iday = mod(l+256,256) l = a(inav0+4) imon = mod(l+256,256) c UTC previous ping: l1 = a(inav0+7) l2 = a(inav0+8) l3 = a(inav0+9) l4 = a(inav0+10) c UTC last ping: c l1 = a(inav0+23) c l2 = a(inav0+24) c l3 = a(inav0+25) c l4 = a(inav0+26) itime = mod(l1+256,256)+mod(l2+256,256)*i2 itime = itime+mod(l3+256,256)*i3+mod(l4+256,256)*i4 imsec(1) = mod(itime,10000) itime = (itime-imsec(1))*0.0001 isec(1) = mod(itime,60) itime = (itime-isec(1))/60 imin(1) = mod(itime,60) itime = (itime-imin(1))/60 ihrs(1) = mod(itime,24) c PC offset l1 = a(inav0+11) l2 = a(inav0+12) l3 = a(inav0+13) l4 = a(inav0+14) itime = mod(l1+256,256)+mod(l2+256,256)*i2 itime = itime+mod(l3+256,256)*i3+mod(l4+256,256)*i4 imsec(2) = mod(itime,1000) itime = (itime-imsec(2))*0.001 isec(2) = mod(itime,60) itime = (itime-isec(2))/60 imin(2) = mod(itime,60) itime = (itime-imin(2))/60 ihrs(2) = mod(itime,24) c lat previous ping c l1 = a(inav0+15) c l2 = a(inav0+16) c l3 = a(inav0+17) c l4 = a(inav0+18) c lat present ping l1 = a(inav0+27) l2 = a(inav0+28) l3 = a(inav0+29) l4 = a(inav0+30) ilat = mod(l1+256,256)+mod(l2+256,256)*i2 ilat = ilat+mod(l3+256,256)*i3+mod(l4+256,256)*i4 xlat = ilat*bam32 c lat previous ping c l1 = a(inav0+19) c l2 = a(inav0+20) c l3 = a(inav0+21) c l4 = a(inav0+22) c lon present ping l1 = a(inav0+31) l2 = a(inav0+32) l3 = a(inav0+33) l4 = a(inav0+34) ilon = mod(l1+256,256)+mod(l2+256,256)*i2 ilon = ilon+mod(l3+256,256)*i3+mod(l4+256,256)*i4 xlon = ilon*bam32 c Ship Speed l1 = a(inav0+41) l2 = a(inav0+42) ispd = mod(l1+256,256)+mod(l2+256,256)*256 c Ship Dir l1 = a(inav0+43) l2 = a(inav0+44) idir = mod(l1+256,256)+mod(l2+256,256)*256 dir = idir*bam16 c ADCP time l1 = a(inav0+59) l2 = a(inav0+60) l3 = a(inav0+61) l4 = a(inav0+62) itime = mod(l1+256,256)+mod(l2+256,256)*i2 itime = itime+mod(l3+256,256)*i3+mod(l4+256,256)*i4 imsec(3) = mod(itime,100) itime = (itime-imsec(3))*0.01 isec(3) = mod(itime,60) itime = (itime-isec(3))/60 imin(3) = mod(itime,60) itime = (itime-imin(3))/60 ihrs(3) = mod(itime,24) c Pitch l1 = a(inav0+63) l2 = a(inav0+64) ipit = mod(l1+256,256)+mod(l2+256,256)*256 pit = ipit*bam16 c Roll l1 = a(inav0+65) l2 = a(inav0+66) irol = mod(l1+256,256)+mod(l2+256,256)*256 rol = irol*bam16 c Heading l1 = a(inav0+67) l2 = a(inav0+68) ihdg = mod(l1+256,256)+mod(l2+256,256)*256 hdg = ihdg*bam16 write(16,182)iens,imon,iday,ihrs(3),imin(3),isec(3),imsec(3),hdg,-xlon,-xlat,ispd,dir 182 format(i9,6i3,f8.2,2f14.8,i6,f8.2) c182 format(i9,3(3i3,i5),f8.2,2f14.8,i6,f8.2) 92 continue end if stop end