program acc_preproc c c program to read ASCII file of acceleration data, c convert to m/s**2 and write out as a flat file of c time, ax, ay, az c implicit real*4 (a-h,o-z) character*80 namein,nameout,cj parameter (nk=44) integer*4 iax(nk),iay(nk),iaz(nk) real*4 ax(nk),ay(nk),az(nk) data g0/9.81/ c c WDL # 25 c data sx,sy,sz/0.0350554,0.03652068,-0.03724678/ data ox,oy,oz/1661.048,2059.784,2040.014/ c c WDL # 26 c c data sx,sy,sz/0.0362557,0.03701535,-0.03713126/ data ox,oy,oz/1889.522,1877.029,2135.850/ c c uncalibrated c c data sx,sy,sz/1.,1.,1./ c data ox,oy,oz/0.,0.,0/ c c get values from command line c narg = iargc() if(narg.lt.2) then write(0,'(a)')' ' write(0,'(a)') & 'Usage: acc_preproc file.wdl file.txyz ' write(0,'(a)')' ' stop else call getarg(1,namein) call getarg(2,nameout) endif c c open the input file c li=5 open(unit=li,file=namein,err=9000) c c open the output file c lo=6 open(unit=lo,file=nameout,err=9001) c c read ther header information c read(li,*) read(li,*) read(li,*)cj,cj,iwdl write(0,*)'WDL Address ',iwdl read(li,*) read(li,*) read(li,*)cj,cj,cj,cj,ifreq write(0,*)'sampling rate ',ifreq read(li,*) read(li,*) read(li,*) read(li,*) read(li,*) read(li,*) c c read an ASCII record c irec=0 10 read(li,*,end=999,err=999)(iax(k),iay(k),iaz(k),k=1,nk) 102 format(132(i4,1x)) c c dump the data c do 100 k=1,nk time=irec/float(ifreq) ax(k)=sx*(iax(k)-ox) ay(k)=sy*(iay(k)-oy) az(k)=sz*(iaz(k)-oz) gave=sqrt(ax(k)*ax(k)+ay(k)*ay(k)+az(k)*az(k)) gcal=gave/g0 if(irec.gt.1) write(lo,*)time,ax(k),ay(k),az(k) irec=irec+1 100 continue c go to 10 c 999 continue write(0,'(a, i6)')' number of good records ', irec-2 c c close the files c close(li) close(lo) stop 9000 continue write(0,*)' could not open ',namein stop 9001 continue write(0,*)' could not open ',nameout end