#! /bin/sh
# Shell: Unisam 
# Example: unisam --- uniform sampling in 1 dimension
# Comment: unisam data format can be tough to achieve, I wrote a C
#	   program, mkparfile, to help with this.  This shell is
#	   an example of how to use it to unisam to ascii data.
#	   The particular jargon used is for graphing time-velocity picks.
# Author: Jack K. Cohen, 25 February 1993

data=mydata		# name of data file (created below)
parfile=unisam.p	# name of parameter file
method=spline		# see unisam self-doc for other valid entries
nt=500			# number of output points in fast dimension (here time)
ft=0.0			# output first point in fast dimension
dt=0.004		# output sampling interval in fast dimension

# make ascii data, here simulated time-velocity picks
echo "0.0 1500.0" >mydata
echo "0.2 1600.0" >>mydata
echo "0.5 1800.0" >>mydata
echo "0.9 2000.0" >>mydata
echo "1.15 1800.0" >>mydata
echo "1.4 2400.0" >>mydata
echo "2.0 3000.0" >>mydata

# call on the C program mkparfile to create a
# parameter file that unisam can grok
mkparfile <$data string1=xin string2=yin >$parfile

# unisam does the interpolation and feeds result to graphics program
unisam nout=$nt fxout=$ft dxout=$dt par=$parfile method=$method |
psgraph n=$nt f1=$ft d1=$dt nplot=1 \
	label1="Time (sec)" label2="Velocity (m/sec)" \
	title="Stacking Velocity Function" \
	grid1=solid grid2=solid \
	style=seismic |
open

# clean up (you may wish to suppress this in your application)
rm mydata unisam.p