up [pdf]
from rsf.proj import *
from rsf.recipes.beg import server as private

Fetch('zovol.HH','jim',private)
Flow('zovol','zovol.HH','dd form=native | window min1=1.7 max1=2.2')

Fetch('zovel.HH','jim',private)
Flow('zovel','zovel.HH','dd form=native')

def plot3(title):
    return '''
    byte gainpanel=all |
    grey3 frame1=80 frame2=220 frame3=140
    title="%s"
    label1=Time unit1=s label2=In-line unit2=m label3=Cross-line unit3=m
    ''' % title

zplot = '''
byte gainpanel=all pclip=100 bias=2297 allpos=y |
grey3 wanttitle=n labelrot=n flat=y 
frame1=140 frame2=220 frame3=140
point1=0.85 point2=0.90 Xscreenratio=0.7 Xscreenht=9
label1=y unit1=m label2=x unit2=m label3=z unit3=m color=j
'''

Result('zovel',
       'transp memsize=512 plane=13 |' + zplot)

Result('zovol',plot3('Zero-Offset Data'))

Flow('zdip','zovol','dip rect1=10 rect2=40 rect3=40')

Flow('xdip','zdip','window n4=1')
Flow('ydip','zdip','window f4=1')

Flow('ydipt','ydip','transp memsize=500 plane=23')

Result('xdip',plot3('In-line Slope') + ' color=j')
Result('ydip',plot3('Cross-line Slope') + ' color=j')

Flow('zpwd','zovol zdip','pwd dip=${SOURCES[1]}')

Flow('xpwd','zpwd','window n4=1')
Flow('ypwd','zpwd','window f4=1')

Result('xpwd',plot3('Isolated Diffractions (In-line)'))
Result('ypwd',plot3('Isolated Diffractions (Cross-line)'))

Flow('shp','zovol xdip ydipt',
     '''
     pwsmooth dip=${SOURCES[1]} ns=1 |
     transp memsize=500 plane=23 |
     pwsmooth dip=${SOURCES[2]} ns=1 |
     transp memsize=500 plane=23 |
     add scale=-1,1 ${SOURCES[0]}
     ''')

Result('shp',plot3('Isolated Diffractions'))

Flow('ckx','shp','cosft sign2=1 sign3=1')
Flow('sto','ckx','pad beg1=680 | stolt nf=4 vel=1500 | window f1=680')
Flow('vlf','sto','spray axis=2 n=1 o=0 d=1 | fourvc nv=50 dv=40 v0=1500')
Flow('vlc','vlf',
     '''
     transp plane=23 memsize=500 |
     cosft sign2=-1 |
     transp plane=34 |
     cosft sign3=-1
     ''')
Flow('pat','vlc','patch w=201,440,280')

Flow('slo','zovel','math "output=1/input" | transp memsize=250 plane=12 | transp memsize=250 plane=23')

Flow('dat','zovol','fft1 | transp memsize=512 plane=12 | transp memsize=512 plane=23')

Fetch('over.HH','jim',private)
Flow('over','over.HH','dd form=native')

Flow('mig','dat slo over',
     '''
     zomig mode=d inv=y causal=y twoway=y --readwrite=y verb=y nrmax=1 dtmax=5e-05 eps=0.01 tmx=16 tmy=16 pmx=0 pmy=0 incore=y slo=${SOURCES[2]} |
     zomig mode=m inv=n --readwrite=y verb=y nrmax=1 dtmax=5e-05 eps=0.01 tmx=16 tmy=16 pmx=0 pmy=0 incore=y slo=${SOURCES[1]}
     ''')

Result('zomig','mig',
       '''
       transp memsize=512 plane=12 |
       byte gainpanel=all |
       grey3 wanttitle=n labelrot=n flat=y 
       frame1=140 frame2=220 frame3=140
       point1=0.85 point2=0.90 Xscreenratio=0.7 Xscreenht=9
       label1=y unit1=m label2=x unit2=m label3=z unit3=m 
       ''')


Flow('pwdat','xpwd','fft1 | transp memsize=512 plane=12 | transp memsize=512 plane=23')
Flow('pwmig','pwdat slo over',
     '''
     zomig mode=d inv=y causal=y twoway=y --readwrite=y verb=y nrmax=1 dtmax=5e-05 eps=0.01 tmx=16 tmy=16 pmx=0 pmy=0 incore=y slo=${SOURCES[2]} |
     zomig mode=m inv=n --readwrite=y verb=y nrmax=1 dtmax=5e-05 eps=0.01 tmx=16 tmy=16 pmx=0 pmy=0 incore=y slo=${SOURCES[1]}
     ''')
Result('pwmig',
       '''
       transp memsize=512 plane=12 |
       byte gainpanel=all |
       grey3 wanttitle=n labelrot=n flat=y 
       frame1=140 frame2=220 frame3=140
       point1=0.85 point2=0.90 Xscreenratio=0.7 Xscreenht=9
       label1=y unit1=m label2=x unit2=m label3=z unit3=m 
       ''')

End()

sfdd
sfwindow
sftransp
sfbyte
sfgrey3
sfdip
sfpwd
sfpwsmooth
sfadd
sfcosft
sfpad
sfstolt
sfspray
sffourvc
sfpatch
sfmath
sffft1
sfzomig