#! /bin/sh
# Invert the data created by CSHOT
set -x

recordfile=record

echo "Run time information being stored in file:  $recordfile"
>$recordfile

################
cd inversion.dir	# where inversion files are
################

echo "Please standby. The inversion takes about 10 minutes"

(
	### Preprocessing
	/bin/rm -f DATA1
	cz1in <data1in

	/bin/rm -f PTRACES
	cz1

	### Inversion
	cxzcs

) > $recordfile 2>&1

sleep 20

/bin/mv -f $recordfile ..
echo "run time info now in file:  $recordfile"

### Strip the Fortran bytes
ftnstrip <reflect >reflect.strip; /bin/mv -f reflect.strip reflect
ftnstrip <reflectcos >reflectcos.strip; /bin/mv -f reflectcos.strip reflectcos

### Plot the sections
xmovie <reflect n1=301 n2=200 d1=30 d2=50 f2=0. perc=99.5 style=seismic \
	-geometry 560x430+50+570 \
	title=" Inversion (R)" \
	label1=" Depth(ft)"  label2=" Midpoint(ft)" &

xmovie <reflectcos n1=301 n2=200 d1=30 d2=50 f2=0. perc=99.5 style=seismic \
	-geometry 560x430+650+570 \
	title=" Inversion (R * cos)" \
	label1=" Depth(ft)"  label2=" Midpoint(ft)" &

exit 0
