Return to SIOSEIS examples      Go to the list of SIOSEIS processes.      Go to SIOSEIS introduction.
       EW0210 SIOSEIS scripts - vpick (velocity spectra)



#! /bin/csh -f
if( $#argv < 4 ) then
    echo "vpick: pick velocities from gathers and create sioseis vtp file."
    echo "Usage: vpick display input-file output-file start_rpnum [ rpnum_inc end_rpnum]"
    exit 1
endif

set DISPLAY = $1
set FILE = $2
set MATFILE = vpick.mat      # must terminate with .mat for Matlab
set VPICKFILE = $3
set START_RPNUM = $4
setenv DISPLAY=$DISPLAY

if( $#argv < 5 ) then
    set RPNUM_INC = 1
else
    set RPNUM_INC = $5
endif

if( $#argv < 6 ) then
    set END_RPNUM = $START_RPNUM
else
    set END_RPNUM = $6
endif

set rpnum = $START_RPNUM
while ( $rpnum <= $END_RPNUM )
sioseis << eof
noecho procs diskin mute filter agc plot velan prout END

diskin
 secs 6 fno $rpnum lno $rpnum allno no forgat 1
 ipath $FILE END END

filter pass 10 80 dbdrop 48 ftype 0 end end
agc winlen .5 END END
mute   fno 1 lno 999999 addwb yes 
     xtp 480 0 1500 0. 1600 .2 6000 3. end end

prout
    fno 0 lno 99999 ftr 0 ltr 99999 END
END

 velan
    vels 1400 10 2000 nrp 1 type spec winlen .048 opath $MATFILE
    END
 END

plot
   nibs 75 stime 0 nsecs 6 scalar -1 trpin 20 vscale 2.5 def 0.1
   srpath sunfil ftag 1 taginc 1000 ann fanno fanno $rpnum END
 END

 END
eof

xloadimage -r 90 sunfil &


#  Use Matlab Version 4.2c (Nov 23 1994) or newer or else change
#  getline to ginput, which does not have a line connecting the picks.

matlab  -nosplash -display $DISPLAY<< eof1
fid = fopen( '$VPICKFILE', 'a' );
load $MATFILE;
n = size(vel);nt = n(1);
nv = n(2);
rpno = vel(1,1);
st = vel(2,1);
dt = vel(3,1);
sv = vel(4,1);
dv = vel(5,1);
vel(1,1) = 0;vel(2,1) = 0;vel(3,1) = 0;vel(4,1) = 0;vel(5,1) = 0;
x = sv:dv:sv+nv*dv-dv;
y = -st:-dt:-(st+nt*dt-dt);
contour(x,y,vel,10)
title 'rp $rpnum';
hold on;
xx=[];
yy=[];
n = 0;
but = 1;
while but == 1
   [xi,yi,button] = ginput(1);
   if button == 3;
      n = n + 1;
      xx(n,1) = xi;
      yy(n,1) = yi;
      plot(xx,yy,'k-')
   end
   if button == 2;
      plot(xx,yy,'w-')
      xx(n,1) = xx(n-1,1);
      yy(n,1) = yy(n-1,1);
      n = n - 1;
      plot(xx,yy,'k-')
   end
   if button == 1;
      but = 0;
   end
end
pause
n = size(xx);
fprintf(fid,'  fno %.0f vtp ',$rpnum);
for i = 1:n(1);
   fprintf(fid,'%.0f %.3f ',xx(i),-yy(i));
end;
fprintf(fid,'end\n');
status = fclose(fid);
quit
eof1

@ rpnum = $rpnum + $RPNUM_INC

end
Return to SIOSEIS examples      Go to the list of SIOSEIS processes.      Go to SIOSEIS introduction.