head	1.3;
access;
symbols;
locks
	john:1.3; strict;
comment	@# @;


1.3
date	97.04.02.16.55.55;	author john;	state Exp;
branches;
next	1.2;

1.2
date	97.04.01.16.58.20;	author john;	state Exp;
branches;
next	1.1;

1.1
date	97.03.27.18.13.37;	author john;	state Exp;
branches;
next	;


desc
@velocity Analysis
@


1.3
log
@many updates, including instructions for picking
@
text
@#! /bin/sh
# Velocity analyses for the cmp gathers
# Authors: Dave Hale, Jack K. Cohen, with modifications by John Stockwell
# NOTE: Comment lines preceeding user input start with  ##
#set -x

## Set parameters
velpanel=modeldata
vpicks=stkvel.p1
normpow=0
slowness=0
cdpmin=1500
cdpmax=3500
dcdp=500
fold=12  # only have 12 shots, otherwise would be 64/2=32 for dsx=dgx

## Set velocity sampling and band pass filters
nv=120
dv=75.0
fv=4000.0
fold=12  # only have 12 shots, otherwise would be 64/2=32 for dsx=dgx
nout=501 # ns
dxout=0.004

## set filter values
f=1,10,100,120
amps=0,1,1,0

## number of contours in contour plot
nc=35

### Get header info
nout=`sugethw ns <$velpanel | sed 1q | sed 's/.*ns=//'`
dt=`sugethw dt <$velpanel | sed 1q | sed 's/.*dt=//'`
dxout=`bc -l <<END
	$dt / 1000000
END`


### Do the velocity analyses.
echo
echo
echo
echo
echo "            Instructions for Velocity Analysis."
echo
echo "  A contour semblance map will appear on the left of your screen."
echo "  A wiggle trace plot of the cdp panel being analysed will appear"
echo "  on the right as a aid in picking."
echo
echo "  Pick velocities by placing cursor on each peak in the"
echo "  semblance plot and typing 's'. Type 'q' when last peak is picked."
echo "  Note, this is 'blind' picking. You will not see any indication"
echo "  on the contour plot that a point has been picked."
echo
echo "  There will be a maximum of 4 peaks to be picked, as this is the"
echo "  number of reflectors in the model. However, for the far-offset"
echo "  CDP gathers, it may be difficult to pick all 4 peaks."
echo
echo "  A graph of the velocity function will appear, and a prompt to" 
echo "  hit the return key will be seen in this terminal window. You"
echo "  will be asked if your picks are ok. This gives you a chance"
echo "  to re-pick the velocities if you do not like the velocity function"
echo "  you have obtained."

pause


cdp=$cdpmin
while [ $cdp -le $cdpmax ]
do
	ok=false
	while [ $ok = false ]
	do
		echo "Starting velocity analysis for cdp $cdp"
		suwind < $velpanel key=cdp min=$cdp max=$cdp count=$fold > panel.$cdp 
		suxwigb < panel.$cdp title="CDP gather for cdp=$cdp" xbox=700 \
			 mpicks=mpicks.$cdp &
		sugain tpow=2 < panel.$cdp |
		sufilter f=$f amps=$amps |
		suvelan nv=$nv dv=$dv fv=$fv |
		suxcontour nc=$nc bclip=0.2 wclip=0.0 f2=$fv d2=$dv \
			units="semblance" blank=.5 \
			label1="Time (sec)" label2="Velocity (m/sec)" \
			title="Velocity Scan (semblance plot) for CMP $cdp" mpicks=mpicks.$cdp

		sort <mpicks.$cdp -n |
		mkparfile string1=tnmo string2=vnmo >par.$cdp

		echo "Putting up velocity function for cdp $cdp"
		sed <par.$cdp '
			s/tnmo/xin/
			s/vnmo/yin/
		' >unisam.p
		unisam nout=$nout fxout=0.0 dxout=$dxout \
			par=unisam.p method=spline |
		xgraph n=$nout nplot=1 d1=$dxout f1=0.0 \
			label1="Time (sec)" label2="Velocity (m/sec)" \
			title="Stacking Velocity Function: CMP $cdp" \
			grid1=solid grid2=solid \
			linecolor=2 style=seismic &

		pause

		echo -n "Picks OK? (y/n) " >/dev/tty
		read response
		case $response in
		n*) ok=false ;;
		*) ok=true ;;
		esac

	done </dev/tty
	cdp=`bc -l <<END
		$cdp + $dcdp
END`

done

set +x


### Combine the individual picks into a composite sunmo par file
echo "Editing pick files ..."
>$vpicks
echo -n "cdp=" >>$vpicks
cdp=$cdpmin
echo -n "$cdp" >>$vpicks
cdp=`bc -l <<END
	$cdp + $dcdp
END`
while [ $cdp -le $cdpmax ]
do
	echo -n ",$cdp" >>$vpicks
	cdp=`bc -l <<END
		$cdp + $dcdp
END`
done
echo >>$vpicks

cdp=$cdpmin
while [ $cdp -le $cdpmax ]
do
	cat par.$cdp >>$vpicks
	cdp=`bc -l <<END
		$cdp + $dcdp
END`
done


echo "sunmo par file: $vpicks is ready"


### Clean up
cdp=$cdpmin
while [ $cdp -le $cdpmax ]
do
	rm mpicks.$cdp par.$cdp
	cdp=`bc -l <<END
		$cdp + $dcdp
END`
done
rm unisam.p
@


1.2
log
@updated to be more friendly
@
text
@d49 1
a49 1
echo "  on the right of your screen."
d85 1
a85 1
			title="Velocity Scan for CMP $cdp" mpicks=mpicks.$cdp
@


1.1
log
@Initial revision
@
text
@d3 2
a4 2
# Authors: Dave, Jack
# NOTE: Comment lines preceeding user input start with  #!#
d41 27
a67 1
echo "Pick velocities by moving mouse and typing 's', type 'Q' when done"
d76 4
a79 2
		suwind < $velpanel key=cdp min=$cdp max=$cdp count=$fold |
		sugain tpow=2 |
d85 1
a85 2
			title="Velocity Scan for CMP $cdp" \
			cmap=hsv2 mpicks=mpicks.$cdp
@
