#! /bin/sh

dt=0.004              # time sample interval in ray tracing             
nt=401        # number of time samples in ray tracing           
                                                                        
fz=0                   #first depth sample in velocity                  
nz=488        # number of depth samples in velocity             
dz=5         #depth interval in velocity                      
fx=0          #         first lateral sample in velocity                
nx=768        # number of lateral samples in velocity           
dx=5         #lateral interval in velocity        
nxs=20
dxs=192
marmmodel=$CWPROOT/src/demos/Velocity_Profiles/Marmousi/marmhard.dat.gz

# generate the smooth Marmousi model
zcat $marmmodel | a2b n1=1  |
unisam2 nx2=384 dx2=2 fx2=0 n2=768 d2=1 f2=0 nx1=122 \
dx1=4 fx1=0 n1=488 d1=1 f1=0 method=linear > marmhard.bin

smooth2 n1=488 n2=768 r1=20 r2=20 < marmhard.bin > marmsmooth.bin


ximage < marmsmooth.bin n1=488 n2=768 title="Marmousi Model" wbox=768 hbox=244 &

# use rayt2d to generate traveltime tables from the interpolated Marmousi model
rayt2d dt=$dt nt=$nt  fz=$fz nz=$nz dz=$dz fx=$fx nx=$nx dx=$dx \
nxs=$nxs dxs=$dxs vfile=marmsmooth.bin tfile=marmsmooth.time.bin 

# view traveltime tables with xmovie
suaddhead < marmsmooth.time.bin ns=$nz | sushw key=dt a=1 | sugain trap=1 |
suxmovie n1=$nz n2=$nx loop=1 title="interpolated frame=%g" width=768 height=244 &

exit 0
