up [pdf]
from rsf.proj import *

sys.path.insert(0,'..')
import sigsbee

sigsbee.getvel('vel','migvel')
Result('vel','grey color=j allpos=y bias=1.5 scalebar=y barreverse=y wanttitle=n')

sigsbee.getzo('zodata')
Result('zodata','grey title="Zero Offset" ')


# Interpolate velocity to a coarser grid

Flow('xpat','zodata','window n1=1')
Flow('vel2','vel xpat',
     '''
     transp | math output=1/input |
     remap1 pattern=${SOURCES[1]} | 
     math output=1/input 
     ''')
Result('vel2','grey color=j allpos=y bias=1.5 scalebar=y barreverse=y title="Migration Velocity" transp=n')
#Flow('vel22','vel2','scale dscale=0.5 | window j2=4') 
#Flow('vel22','vel2','scale dscale=0.5 | window j2=2') 
Flow('vel22','vel2','scale dscale=0.5')
Result('vel22','grey color=j allpos=y bias=1.5 title="Migration Velocity" transp=n')
Flow('zomig','zodata vel22',
     '''
     spline n1=6000 o1=0 d1=0.002 |
     reverse which=1 |
     transp |
     ffd0 nbt=40 nbb=39 nbl=50 nbr=50
     vel=${SOURCES[1]}
     ''')
#     ffd0 nbt=60 nbb=59 nbl=50 nbr=50
Result('zomig','grey title="Zero-Offset Migration" unit2=km transp=n')

sigsbee.getshots('shot')

#---------------- Plot Data ---------------#
Result('zero','shot',
       '''
       window  min2=0 max2=0 size2=1 |
       grey  pclip=98 color=I screenratio=1.5 gainpanel=a
       label2=Position label1=Time title= label3=  unit2=km unit1=s
       labelsz=3
       ''')
Result('shot499','shot',
       '''
       window n3=1 f3=499 |
       grey  pclip=99 color=I gainpanel=a wantframenum=y  unit1=s label1=Time
       label2=Offset unit2=km label3=Shot unit3=km title=
       screenratio=1.35 labelsz=3
       ''')
Flow('geo',None,
     '''
     echo n1=4 n2=500 data_format=ascii_int esize=4 in=geo
     | dd form=native
     ''')
nt=12057
dt=0.001
Flow('source',None,
     '''
     spike n1=%d d1=%g k1=56 |
     ricker1 frequency=20 
     '''%(nt,dt))
Result('source','graph  title="Source Wavelet" ')
for s in range(0,500):
    shot= 'DATA/shot_'+str(12+s*2)
    Flow(shot,'shot',
         '''
         window n3=1 f3=%d |
         spline n1=12001 d1=0.001 o1=0
         '''%(s))

End()

sfsegyread
sfwindow
sfmask
sfdd
sfmath
sfcat
sftransp
sfscale
sfput
sfgrey
sfheaderwindow
sfcut
sfreverse
sfcostaper
sfremap1
sfspline
sfffd0
sfintbin
sfmutter
sfspike
sfricker1
sfgraph

data/sigsbee/sigsbee2a_nfs.sgy
data/sigsbee/sigsbee2a_migvel.sgy