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

segy = 'stack_4500ms.sgy'

Fetch (segy, 'ggulch-gxt', server)

Flow ('stack tstack tstack.asc tstack.bin', segy,
      '''
      segyread tfile=${TARGETS[1]} hfile=${TARGETS[2]} bfile=${TARGETS[3]}
      ''')
Flow ('stack3','stack','intbin | put  label2=Inline label3=Crossline')
Flow ('gibson-stack','stack3',
      '''
      window min1=0.5 max1=1.5 |
          put o1=500 unit1=ms d1=2.0 d2=33.55 d3=33.55 unit2=m unit3=m o4=0 n4=1 d4=100 label4=offset unit4=m o2=0 o3=0
          ''')
Flow ('gibson-velmodel', None,
          '''
          math n1=308 output=1000 |
          put n1=2 n2=14 n3=11 n4=1 o1=500.0 o2=0.0 o3=0.0 o4=0.0 d1=1000.0 d2=1000.0 d3=1000.0 d4=1000.0 unit1=ms unit2=m unit3=m unit4=m
          ''')
Flow ('image3 dag3', 'gibson-stack gibson-velmodel',
          '''
          tmigda vel=${SOURCES[1]} dag=${TARGETS[1]}
          is3d=y isDipAz=n hmign=1
          iyo=3000 iyn=41 iyd=25
          ixo=1000 ixn=81 ixd=25
          dipn=81 dipo=-40 dipd=1
          sdipn=81 sdipo=-40 sdipd=1
          ''')
Flow ('dag3sq','dag3','mul ${SOURCES[0]}')
Flow ('taper','dag3 dag3sq','crssemb3d dataSq=${SOURCES[1]} xapp=3 yapp=3')
Flow ('weight','taper','mask min=0.05 max=1.0 | dd type=float | smooth rect1=5 rect2=5 rect3=5')
Flow ('data-clean','dag3 weight','mul ${SOURCES[1]}')
Flow ('image-clean','data-clean','stack | stack')
Result ('image3',
                '''
                put d1=0.001 o1=0.25 unit1=km label1=depth label2=inline label3=crossline
                d2=0.025 o2=1 unit2=km
                d3=0.025 o3=3 unit3=km |
                window max1=0.45 |
                sfbyte clip=80 | 
                sfgrey3 wanttitle=n title='"init image"' frame1=50 frame2=30 frame3=30
                ''')
Result ('image-clean',
                '''
                put d1=0.001 o1=0.25 unit1=km label1=depth label2=inline label3=crossline
                d2=0.025 o2=1 unit2=km
                d3=0.025 o3=3 unit3=km |
                window max1=0.45 |
                sfbyte clip=0.01 |
                sfgrey3 wanttitle=n title='"filtered image"' frame1=50 frame2=30 frame3=30
                ''')
Flow ('image3s dag3s', 'gibson-stack gibson-velmodel',
          '''
          tmigda vel=${SOURCES[1]} dag=${TARGETS[1]}
          is3d=y isDipAz=n hmign=1
          iyo=3000 iyn=41 iyd=25
          ixo=1000 ixn=81 ixd=25
          dipn=21 dipo=-10 dipd=1
          sdipn=21 sdipo=-10 sdipd=1
          ''')
Result ('image3s',
                '''
                put d1=0.001 o1=0.25 unit1=km label1=depth label2=inline label3=crossline
                d2=0.025 o2=1 unit2=km
                d3=0.025 o3=3 unit3=km |
                window max1=0.45 |
                sfbyte clip=60 |
                sfgrey3 wanttitle=n title='"short image"' frame1=50 frame2=30 frame3=30
                ''')

End()

sfsegyread
sfintbin
sfput
sfwindow
sfmath
sftmigda
sfmul
sfcrssemb3d
sfmask
sfdd
sfsmooth
sfstack
sfbyte
sfgrey3