#! /bin/sh

S=. #the directory where your data is

p1=9 p2=8
nc1=256 nc2=128
n1=750 n2=369
nt1=512 nt2=256
data=$S/model.su
trimfile=$S/trimfile.2p
infile=$S/model.2p
mrafile=$S/mramodel.2p
dfile=$S/dmodel.2p
dmrafile=$S/dmramodel.2p
reconfile=$S/reconmodel.2p
reconmrafile=$S/reconmramodel.2p
mraps=$S/mraMarmousi.ps
difps=$S/difMarmousi.ps
origps=$S/Marmousi.ps
reconps=$S/reconMarmousi.ps
trunc=0.003

sustrip < $data |
mrafxzwt > $mrafile \
n1=$n1 n2=$n2 \
trimfile=$trimfile \
verbose=1 nd=4 p1=$p1 p2=$p2 \
mralevel2=3 mralevel1=3 \
title="Model" \
dfile=$dfile \
dmrafile=$dmrafile \
reconfile=$reconfile \
reconmrafile=$reconmrafile \
trunc=$trunc

xmovie n1=$nt1 n2=$nt2 < $trimfile  \
	title="Part of The Marmousi Model" \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF1}+${HEIGHTOFF1} &

psimage n1=$nt1 n2=$nt2 < $trimfile \
	title="The Marmousi Model (Part)" \
	>$origps

psimage n1=$nt1 n2=$nt2 < $mrafile \
	title="MRA of the Model with DC overexposured" \
	perc=98 > $mraps  

psimage n1=$nt1 n2=$nt2 < $reconfile  \
	title="Reconstructed Model 17:1" > $reconps

psimage n1=$nt1 n2=$nt2 < $dfile \
	title="Model Difference" > $difps

echo ""
echo "You may now view the files: $origps, $mraps, $reconps, $difps "
echo "with your PostScript Previewer"

exit 0
