up [pdf]
from rsf.proj import *

SConscript('../fetch/SConstruct')

# get the stack created using seismic unix
Plot('sustack','../fetch/final_stack.rsf','grey title="su stack"',view=1)
Result('sustack3d','../fetch/final_stack.rsf',
       '''
       window n1=1000
       | byte gainpanel=all 
       | grey3 title="su stack" frame1=500 frame2=120 frame3=140
        ''')
Flow('sustack141','../fetch/final_stack.rsf','window n1=1000 n3=1 f3=141')
Result('sustack141',
       '''
       grey title='sustack line 141'
       ''')
Flow('sustackx121','../fetch/final_stack.rsf','window n1=1000 n2=1 f2=121')
Result('sustackx121',
       '''
       grey title='sustack xline 121'
       ''')

Flow(['mappedstack.rsf','mappedstack_hdr.rsf'],
     ['../fetch/npr3_gathers.rsf','../fetch/npr3_gathers_hdr.rsf'],
     '''
     sftahread verbose=1 input=${SOURCES[0]} 
     | sftahnmo 
       verbose=1
       tnmo=0,.617,.769,.913,1.027,1.196,1.767,3.010.00
       vnmo=9132.86,10764.47,10941.73,11235.75,11902.71,12580.03,14513.85,16982.86
     | sftahstack key=iline,xline verbose=1 ntaper=12
     | sftahwrite 
        verbose=1                           
        label2="xline" o2=1 n2=188 d2=1   
        label3="iline" o3=1 n3=345 d3=1   
        output=${TARGETS[0]}
        outheaders=${TARGETS[1]} 
     ''',stdout=0,stdin=0)

Plot('mappedstack','window n1=1000 j3=20 | grey title="tah stack"',view=1)
Result('mappedstack3d','mappedstack',
       '''
       window n1=1000
       | byte gainpanel=all 
       | grey3 title="tah stack" frame1=500 frame2=120 frame3=140
        ''')
Flow('mappedstack141','mappedstack','window n1=1000 n3=1 f3=141')
Result('mappedstack141',
       '''
       grey title='tahstack line 141'
       ''')
Flow('mappedstackx121','mappedstack','window n1=1000 n2=1 f2=121')
Result('mappedstackx121',
       '''
       grey title='tahstack xline 121'
       ''')
Flow('diff-su-tahstack','mappedstack141 sustack141',
      '''
      sfadd scale=1,-1 ${SOURCES[1]}
      ''')
Result('diff-su-tahstack',
       '''
       sfgrey title='mappedstack-sustack'
       ''')
Result('cat-diff-su-tahstack','diff-su-tahstack mappedstack141 sustack141',
       '''
       sfcat ${SOURCES[1:3]} | sfgrey title='mappedstack-sustack'
       ''')

# make the mapped gather in the middle data.
# sftahmakeskey hangs if you say key= instead of pkey=

Flow(['mappedgather.rsf','mappedgather_hdr.rsf'],
     ['../fetch/npr3_gathers.rsf','../fetch/npr3_gathers_hdr.rsf'],
     '''
     sftahread verbose=0 input=$SOURCE 
     | sftahmakeskey pkey=iline,xline skey=cdpt verbose=1 
     | sftahwrite 
        verbose=1                           
        label2="cdpt"  o2=1 n2=50  d2=1   
        label3="xline" o3=100 n3=5 d3=10   
        label4="iline" o4=100 n4=3  d4=50   
        output=$TARGET 
     ''',stdout=0,stdin=0)
#(sftahread input=mappedgather.rsf | sftahgethw key=iline,xline,cdpt,offset verbose=1 >/dev/null )|& more

Plot('mappedgather','grey title="tah gather"',view=1)
Plot('zoommappedgather','mappedgather',
     'sfwindow max1=2. | grey title="tah gather"',view=1)

Flow(['mappedgathernmo.rsf','mappedgathernmo_hdr.rsf'],
     ['mappedgather.rsf','mappedgather_hdr.rsf'],
     '''
     sftahread verbose=0 input=$SOURCE 
     | sftahnmo 
       verbose=1
       tnmo=0,.617,.769,.913,1.027,1.196,1.767,3.010.00
       vnmo=9132.86,10764.47,10941.73,11235.75,11902.71,12580.03,14513.85,16982.86
     | sftahwrite 
        verbose=1                           
        label2="cdpt"  o2=1 n2=50  d2=1   
        label3="xline" o3=100 n3=5 d3=10   
        label4="iline" o4=100 n4=3  d4=50   
        output=$TARGET 
      ''',stdout=0,stdin=0)
Plot('mappedgathernmo','grey title="tah nmo gather"',view=1)
Plot('zoommappedgathernmo','mappedgathernmo',
     'sfwindow max1=2. | grey title="tah nmo gather"',view=1)
Flow(['mappedgathershot.rsf','mappedgathershot_hdr.rsf',
      'mappedgathernmoshot.rsf','mappedgathernmoshot_hdr.rsf'],
     ['../fetch/npr3_gathers.rsf','../fetch/npr3_gathers_hdr.rsf'],
     '''
     sftahread verbose=0 input=$SOURCE 
     | sftahwrite 
        verbose=1                           
        label2="tracf"  o2=1 n2=863  d2=1   
        label3="fldr" o3=14 n3=9 d3=100   
        output=${TARGETS[0]}
     | sftahnmo 
       verbose=1  
       tnmo=0,.617,.769,.913,1.027,1.196,1.767,3.010.00
       vnmo=9132.86,10764.47,10941.73,11235.75,11902.71,12580.03,14513.85,16982.86
     | sftahwrite 
        verbose=1                           
        label2="tracf"  o2=1 n2=863  d2=1   
        label3="fldr" o3=14 n3=9 d3=100   
        output=${TARGETS[2]}
      ''',stdout=0,stdin=0)
Plot('zoommappedgathershot','mappedgathershot',
     'sfwindow max1=2. | grey title="tah gather shot"',view=1)
Plot('zoommappedgathernmoshot','mappedgathernmoshot',
     'sfwindow max1=2. | grey title="tah gather nmo shot"',view=1)

# from command line:
# wget http://s3.amazonaws.com/teapot/npr3_field.sgy
# ln -s /home/karl/data/TeapotDome/Prestack/npr3_field.sgy .

# (sftahread input=npr3_field.rsf | sftahgethw key=ep,fldr,tracf,offset,sx,sy >/dev/null) |& more
#sfheaderattr <npr3_field_hdr.rsf

Flow(['mappedfield.rsf','mappedfield_hdr.rsf'],
     ['../fetch/npr3_field.rsf','../fetch/npr3_field_hdr.rsf'],
     '''
     sftahread verbose=0 input=$SOURCE 
     | sftahwrite 
        verbose=1                           
        label2="tracf"  o2=1 n2=863  d2=1   
        label3="fldr" o3=14 n3=9 d3=100   
        output=$TARGET 
     ''',stdout=0,stdin=0)
#(sftahread input=mappedfield.rsf | sftahgethw key=iline,xline,cdpt,offset verbose=1 >/dev/null )|& more

Plot('mappedfield','grey title="tah field"',view=1)
Plot('zoommappedfield','mappedfield',
     'sfwindow max1=2. | grey title="tah field"',view=1)

Flow(['mappedfieldnmo.rsf','mappedfieldnmo_hdr.rsf'],
     ['mappedfield.rsf','mappedfield_hdr.rsf'],
     '''
     sftahread verbose=0 input=$SOURCE 
     | sftahnmo 
       verbose=1  
       tnmo=0,.617,.769,.913,1.027,1.196,1.767,3.010.00
       vnmo=9132.86,10764.47,10941.73,11235.75,11902.71,12580.03,14513.85,16982.86
     | sftahwrite 
        verbose=1                           
        label2="tracf"  o2=1 n2=863  d2=1   
        label3="fldr" o3=14 n3=9 d3=100   
        output=$TARGET 
     ''',stdout=0,stdin=0)
Plot('mappedfieldnmo','grey title="tah nmo field"',view=1)
Plot('zoommappedfieldnmo','mappedfieldnmo',
     'sfwindow max1=2. | grey title="tah nmo field"',view=1)

Flow(['mappedfieldsort.rsf','mappedfieldsort_hdr.rsf'],
     ['../fetch/npr3_field.rsf','../fetch/npr3_field_hdr.rsf'],
     '''
     sftahsort 
        input=$SOURCE 
        sort="iline:100,200,50  +xline:100,140,10 offset" 
        verbose=1  
     | sftahmakeskey pkey=iline,xline skey=cdpt verbose=1 
     | sftahwrite 
        verbose=1                           
        label2="cdpt"  o2=1 n2=50  d2=1   
        label3="xline" o3=100 n3=5 d3=10   
        label4="iline" o4=100 n4=3  d4=50   
        output=$TARGET 
     ''',stdout=0,stdin=0)
Plot('mappedfieldsort','grey title="tah field sort"',view=1)
Plot('zoommappedfieldsort','mappedfieldsort',
     'sfwindow max1=2. | grey title="tah field sort"',view=1)

Flow(['mappedfieldsortnmo.rsf','mappedfieldsortnmo_hdr.rsf'],
     ['mappedfieldsort.rsf','mappedfieldsort_hdr.rsf'],
     '''
     sftahread verbose=0 input=$SOURCE 
     | sftahnmo 
       verbose=1  
       tnmo=0,.617,.769,.913,1.027,1.196,1.767,3.010.00
       vnmo=9132.86,10764.47,10941.73,11235.75,11902.71,12580.03,14513.85,16982.86
     | sftahwrite 
        verbose=1                           
        label2="cdpt"  o2=1 n2=50  d2=1   
        label3="xline" o3=100 n3=5 d3=10   
        label4="iline" o4=100 n4=3  d4=50   
        output=$TARGET
     ''',stdout=0,stdin=0)

Plot('mappedfieldsortnmo','grey title="tah nmo fieldsort"',view=1)
Plot('zoommappedfieldsortnmo','mappedfieldsortnmo',
     'sfwindow max1=2. | grey title="tah nmo fieldsort"',view=1)

End()

sfgrey
sfbyte
sfgrey3
sfsegyread
sfheaderattr
sfwindow
sftahread
sftahnmo
sftahstack
sftahwrite
sfadd
sfcat
sftahmakeskey
sftahsort

http://s3.amazonaws.com/teapot/final_stack.rsf
http://s3.amazonaws.com/teapot/npr3_gathers.sgy
http://s3.amazonaws.com/teapot/npr3_field.sgy
http://s3.amazonaws.com/teapot/3dload_Teapot_Dome_3D.pdf
http://s3.amazonaws.com/teapot/teapot_processing.pdf