from rsf.proj import *
import rsf.recipes.channelsthin as channels
titles = {'t' : 'convolution (depth refl)',
'tt' : 'convolution (time refl)',
'f' : 'exploding reflector (depth refl)',
'ft' : 'exploding reflector (time refl)',
'c' : 'shot record',
'm' : 'convolution (depth refl)',
'mt' : 'convolution (time refl)',
'i' : 'exploding reflector (depth refl)',
'it' : 'exploding reflector (time refl)',
'j' : 'shot record'}
frq_list = [40]
time_list_2D = ['t','tt','f','ft','c']
depth_list_2D = ['m','mt','i','it','j']
time_list_3D = ['t','tt']
depth_list_3D = ['m','mt']
time_list_3D_slice = []
depth_list_3D_slice = []
from rsf.recipes.beg import server as private
grid_par = {'nx':360, 'dx':15, 'ox':0,
'ny':200, 'dy':15, 'oy':0,
'xy_pad':40}
res_grid_par = grid_par.copy()
res_grid_par['nz'] = 128
res_grid_par['dz'] = 2
res_grid_par['oz'] = -59
ovr_grid_par = grid_par.copy()
ovr_grid_par['nz'] = 64
ovr_grid_par['dz'] = 40
ovr_grid_par['oz'] = 158
geo_par = {
'as_width' : 0.8,
'as_shift' : 0.8,
'as_height0' : 0.5,
'as_height1' : 0.8,
'as_shape' : 1.2,
'bd_depth' : 0.8,
'bd_zshift' : -0.15,
'md_depth' : 1.2,
'md_zshift' : 0.10}
sand_par = {
'bd_sand' : 0.3,
'md_sand' : 0.2,
'as_sand' : 1.0,
'na_sand0' : 0.4,
'na_sand1' : 0.9}
bk_noise_par = {'taper_switch':1,
'std_dev': 0.03,
'alpha':1,
'oriu':[1,0,0],
'oriv':[0,1,0],
'oriw':[0,0,1],
'ru':1000,
'rv':1000,
'rw': 1}
sd_noise_par = {'taper_switch':1,
'std_dev':0.01,
'alpha':1,
'oriu':[1,0,0],
'oriv':[0,1,0],
'oriw':[0,0,1],
'ru':200,
'rv':200,
'rw': 1}
res_taper_par = { 'top_h' : 0,
'top_phi' : 0.3500,
'top_rho' : 1.6865,
'top_vp' : 1964.5730,
'top_vs' : 509.7961,
'bot_h' : 20,
'bot_phi' : 0.1554,
'bot_rho' : 2.3431,
'bot_vp' : 2429.1460,
'bot_vs' : 1019.5922}
ovr_taper_par = { 'top_h' : 2000,
'top_phi' : 0.3500,
'top_rho' : 1.6865,
'top_vp' : 1964.5730,
'top_vs' : 509.7961,
'bot_h' : 0,
'bot_phi' : 0.1554,
'bot_rho' : 2.3431,
'bot_vp' : 2429.1460,
'bot_vs' : 1019.5922}
memsize = 512
channels.make_reservoir ( memsize, private,
res_grid_par, geo_par,
sand_par, bk_noise_par, sd_noise_par,
res_taper_par)
channels.make_overburden (memsize, ovr_grid_par, bk_noise_par, ovr_taper_par)
def tplot2d(par,custom=""):
return '''
window |
grey scalebar=y labelrot=n pclip=100
label1=t label2=x %s
''' % (custom)
def zplot2d(par,custom=""):
return '''
window |
transp |
grey scalebar=y labelrot=n pclip=100
label1=z label2=x %s
''' % (custom)
def tplot3d(par,custom1="",custom2=""):
return '''
transp memsize=%d plane=13 |
byte bar=bar.rsf gainpanel=all pclip=99 %s |
grey3 scalebar=n bar=bar.rsf labelrot=n flat=y
frame1=%d frame2=%d frame3=80
point1=0.85 point2=0.90 screenratio=0.7 screenht=9
label1=y label2=x label3=t %s
''' % (memsize,custom1,par['ypad'],par['xpad'],custom2)
z_slice = res_grid_par['dz']*res_grid_par['nz']+res_grid_par['oz']-10
def zplot3d(par,custom1="",custom2=""):
return '''
byte bar=bar.rsf gainpanel=all pclip=99 %s |
grey3 scalebar=n bar=bar.rsf labelrot=n flat=y
frame1=%d frame2=%d frame3=%d
point1=0.85 point2=0.90 screenratio=0.7 screenht=9
label1=y label2=x label3=z %s
''' % (custom1,par['ypad'],par['xpad'],
z_slice/res_grid_par['dz'],custom2)
par = {
'nt':1000, 'ot':0, 'dt':0.005, 'kt':20,
'nw':501, 'ow':0,
'nx':res_grid_par['nx']+2*res_grid_par['xy_pad'],
'ny':res_grid_par['ny']+2*res_grid_par['xy_pad'],
'nz':res_grid_par['nz'],
'dx':res_grid_par['dx'],
'dy':res_grid_par['dy'],
'dz':res_grid_par['dz'],
'ox':0, 'oy':0, 'oz':0,
'verb':'y','eps':0.01,'nrmax':1,'dtmax':0.00005,
'tmx':16,'tmy':16,'pmx':0,'pmy':0,'misc':'incore=y'
}
par['dw']=1./(par['nt']*par['dt'])
par['xmin']=par['ox']
par['xmax']=par['ox'] + (par['nx']-1) * par['dx']
par['ymin']=par['oy']
par['ymax']=par['oy'] + (par['ny']-1) * par['dy']
par['zmin']=par['oz']
par['zmax']=par['oz'] + (par['nz']-1) * par['dz']
par['xpad']=par['nx']/2.
par['ypad']=par['ny']/2.
par['xsou']=par['ox'] + par['xpad'] * par['dx']
par['ysou']=par['oy'] + par['ypad'] * par['dy']
par['ft']=par['kt']*par['dt']
def flip():
return '''
transp memsize=250 plane=23 |
transp memsize=250 plane=12 |
reverse which=1 opt=i |
put label1=z label2=x label3=y
unit1=m unit2=m unit3=m
'''
Flow('vp0','res_vp_noise_taper',flip() )
Flow('vp1','ovr_vp_noise_taper',flip() )
Flow('ro0','res_rho_noise_taper',flip() )
Flow('ro1','ovr_rho_noise_taper',flip() )
Flow ('den','ro0','window n1=%(nz)d | put o1=0' % par)
Result('tden','den',
'transp plane=13 |'
+ zplot3d(par,'pclip=100 bias=2.1 allpos=y','title="density" color=j'))
Flow( 'vel','vp0', 'window n1=%(nz)d | put o1=0 o3=0' % par)
Result('tvel','vel',
'transp plane=13 |'
+ zplot3d(par,'pclip=100 bias=2297 allpos=y','title="velocity" color=j'))
Flow( 'ovb','vp1', 'window n1=%(nz)d | put o1=0 o3=0' % ovr_grid_par)
Result('tovb','ovb',
'transp plane=13 |'
+ zplot3d(par,'pclip=100 bias=1950 allpos=y',
'title="overburden velocity" frame3=%(nz)d color=j'
% ovr_grid_par))
z_rect = 120
Flow('slo','vel',
'''
math "output=1/input" |
transp memsize=250 plane=12 |
transp memsize=250 plane=23 |
put label1=x label2=y label3=z
unit1=m unit2=m unit3=m
''')
Result('tslo','slo',
'transp memsize=250 plane=12 |'
+ zplot3d(par,'pclip=100 bias=0.00034 allpos=y',
'title="slowness" color=j'))
Flow('slo-s','slo',
'smooth rect1=50 rect2=50 rect3=%d' % (z_rect/res_grid_par['dz']))
Result('tslo-s','slo-s',
'transp memsize=250 plane=12 |'
+ zplot3d(par,'pclip=100 bias=0.00034 allpos=y',
'title="smoothed slowness" color=j'))
Flow('ovs','ovb',
'''
math "output=1/input" |
transp memsize=250 plane=12 |
transp memsize=250 plane=23 |
put label1=x label2=y label3=z
''')
Result('tovs','ovs',
'transp memsize=250 plane=12 |'
+ zplot3d(par,'pclip=100 bias=0.00039 allpos=y',
'title="overburden slowness" frame3=%(nz)d color=j'
% ovr_grid_par))
Flow('ovs-s','ovs',
'smooth rect1=50 rect2=50 rect3=%d' % (z_rect/ovr_grid_par['dz']))
Result('tovs-s','ovs-s',
'transp memsize=250 plane=12 |'
+ zplot3d(par,'pclip=100 bias=0.00039 allpos=y',
'title="smoothed overburden slowness" frame3=%(nz)d color=j'
% ovr_grid_par))
dt_conv = 0.0025
t_window = 0.16
t_frame = 0.12/dt_conv
Flow('aim','vel den','math v=${SOURCES[0]} d=${SOURCES[1]} output=v*d', stdin=0)
Result('taim','aim',
'transp plane=13 |'
+ zplot3d(par,'pclip=100 bias=4.44 allpos=y',
'title="acoustic impedance" color=j'))
Flow('ait',['aim','vel'],
'depth2time velocity=${SOURCES[1]} dt=%g nt=%d | put label1=t unit1=s'
% (dt_conv,par['nt']) )
Result('tait','ait',
'window max1=%g |' % (t_window)
+ tplot3d(par,'pclip=100 bias=4.44 allpos=y',
'title="acoustic impedance" color=j frame3=%d' % (t_frame)))
Flow('ref','aim','ai2refl')
Result('tref','ref',
'transp plane=13 |'
+ zplot3d(par,'','title="reflectivity"'))
Flow('ret','ait','ai2refl')
Result('tret','ret',
'window max1=%g |' % (t_window)
+ tplot3d(par,'','title="reflectivity" frame3=%d' % (t_frame)))
Flow('r2d','ref','window squeeze=n n3=1 f3=140 | transp memsize=250 plane=12 | transp memsize=250 plane=23')
Flow('r3d','ref','window | transp memsize=250 plane=12 | transp memsize=250 plane=23')
Flow('rt2d','ret','window squeeze=n n3=1 f3=140')
Flow('rt3d','ret','window')
Flow('v2d','vel','window squeeze=n n3=1 f3=140')
Flow('v3d','vel','window')
Flow('o2d' ,'ovs' ,'window squeeze=n n2=1 f2=140')
Flow('o3d' ,'ovs' ,'window')
Flow('o2d-s','ovs-s','window squeeze=n n2=1 f2=140')
Flow('o3d-s','ovs-s','window')
Flow('s2d' ,'slo' ,'window squeeze=n n2=1 f2=140')
Flow('s3d' ,'slo' ,'window')
Flow('s2d-s','slo-s','window squeeze=n n2=1 f2=140')
Flow('s3d-s','slo-s','window')
for frq in frq_list:
Flow('wav_%d' % (frq),None,
'''
spike nsp=1 mag=1 k1=%d
unit2=m unit3=m
n1=%d d1=%g o1=0
n2=1 d2=%g o2=%g
n3=1 d3=%g o3=%g |
ricker1 frequency=%s |
put label1=t label2=x label3=y
''' % (par['kt'],par['nt'],par['dt'],
par['dx'],par['xsou'],par['dy'],par['ysou'],frq) )
Result('twav_%d' % (frq),'wav_%d' % (frq),
'window n1=50 | graph title="wavelet %dHz" wantaxis2=n' % (frq))
Flow('tfreq_%d' % (frq),None,'math n1=%g d1=%g o1=%g output="0" | math output="%g - (%g/10.0)*x1" | put n2=1 n3=1 | spray axis=4 n=54'%(300,par['dt'],par['ot'],frq,frq))
Flow('tphase',None,'math n1=%g d1=%g o1=%g output="0" | put n2=1 n3=1 | spray axis=4 n=54'%(300,par['dt'],par['ot']))
dt_conv = 0.0025
Flow('t3dpatch',['r3d','v3d'],
'''
transp memsize=250 plane=23 |
transp memsize=250 plane=12 |
depth2time velocity=${SOURCES[1]} dt=%g nt=%d | patch w=300,300,200 | put n4=54 n5=1 n6=1
''' % (dt_conv,par['nt']))
for frq in frq_list:
Flow('t2d_%d' % (frq),['r2d','v2d'],
'''
transp memsize=250 plane=23 |
transp memsize=250 plane=12 |
depth2time velocity=${SOURCES[1]} dt=%g nt=%d |
ricker1 frequency=%g | put label1=t unit1=s
''' % (dt_conv,par['nt'],frq) )
Flow('t3d_%dpatch' % (frq), 't3dpatch tfreq_%d tphase' % frq,
'''
ricker2 tfreq=${SOURCES[1]} tphase=${SOURCES[2]} | put label1=t unit1=s
''', split=[4,"omp"])
Flow('t3d_%d' % (frq), 't3d_%dpatch' % (frq), 'put n4=6 n5=3 n6=3 | patch inv=y weight=y n0=1000,440,280')
Flow('tt2d_%d' % (frq),'rt2d','ricker1 frequency=%d | put label1=t' % frq )
Flow('rt3dpatch','rt3d','patch w=300,300,200 | put n4=54 n5=1 n6=1')
Flow('tt3d_%dpatch' % (frq),'rt3dpatch tfreq_%d tphase'%frq,'ricker2 tfreq=${SOURCES[1]} tphase=${SOURCES[2]} | put label1=t', split=[4,"omp"])
Flow('tt3d_%d' % (frq), 'tt3d_%dpatch' % (frq), 'put n4=6 n5=3 n6=3 | patch inv=y weight=y n0=1000,440,280')
Flow('m2d_%d' % (frq),['t2d_%d' % (frq),'v2d'],
'''
time2depth velocity=${SOURCES[1]} dz=%(dz)g nz=%(nz)d |
transp memsize=250 plane=12 |
transp memsize=250 plane=23 |
put label3=z unit3=m
''' % par )
Flow('m3d_%d' % (frq),['t3d_%d' % (frq),'v3d'],
'''
time2depth velocity=${SOURCES[1]} dz=%(dz)g nz=%(nz)d |
transp memsize=250 plane=12 |
transp memsize=250 plane=23 |
put label3=z unit3=m
''' % par )
Flow('mt2d_%d' % (frq),['tt2d_%d' % (frq),'v2d'],
'''
time2depth velocity=${SOURCES[1]} dz=%(dz)g nz=%(nz)d |
transp memsize=250 plane=12 |
transp memsize=250 plane=23 |
put label3=z unit3=m
''' % par )
Flow('mt3d_%d' % (frq),['tt3d_%d' % (frq),'v3d'],
'''
time2depth velocity=${SOURCES[1]} dz=%(dz)g nz=%(nz)d |
transp memsize=250 plane=12 |
transp memsize=250 plane=23 |
put label3=z unit3=m
''' % par )
for i in depth_list_3D:
for frq in frq_list:
Result ('%s3d_%d' % (i,frq),'%s3d_%d' % (i,frq),
'transp plane=12 |'
+ zplot3d(par,'','title="Training data"'))
End() |