Пример #1
0
shotnumber = 0

# Create bound thresholds (which will be updated)
bounds = [1e10, -1e10, 1e10, -1e10, 1e10, -1e10]

# Loop over each shot gather
for i in xrange(ngathers):
    outlines = []

    # Get the trace header for the first trace in this shot gather
    trhl0 = sf.trhead[sf.ensembles[shotnums[i]]]
    sx = trhl0['sx'] * scalco
    sy = trhl0['sy'] * scalco
    sz = trhl0['selev'] * scalel * zantithesis

    (nsx, nsy, nsz) = reduceToLocal(np.array([sx, sy, sz], ndmin=2), angle,
                                    basis)[0]

    # Append information about this shot to the running tally of all shot
    # locations; this is used to construct f.in
    shotlocs[0].append(nsx)
    shotlocs[1].append(nsy)
    shotlocs[2].append(nsz)

    outlines.append(format_string % (nsx, nsy, nsz, 0., 0., -1))

    tr0 = sf.ensembles[shotnums[i]]

    if (i == ngathers - 1):
        tr1 = sf.ntr - 1
    else:
        tr1 = sf.ensembles[shotnums[i + 1]]
Пример #2
0
traceX = np.array([float(trh['sx']) * scalco for trh in sfgeom.trhead])
traceY = np.array([float(trh['sy']) * scalco for trh in sfgeom.trhead])
traceZ = np.array([float(trh['selev']) * scalel for trh in sfgeom.trhead])

# Some working arrays
theones = np.ones((ntr, ns))
theslope = -np.arange(ns) * dz
coordarray = np.empty((ntr, ns, 3), dtype=np.float64)

# Create an array of coordinates of shape (ntr, ns, 3)
coordarray[:, :, 0] = (traceX * theones.T).T
coordarray[:, :, 1] = (traceY * theones.T).T
coordarray[:, :, 2] = (traceZ * theones.T).T + theslope * theones

# Reproject to the new coordinate system by rotating around the z-axis
newcoordarray = reduceToLocal(coordarray.reshape((ntr * ns, 3)), angle,
                              basis).reshape((ntr, ns, 3))

newxcoords = newcoordarray[:, :, 0]
newzcoords = newcoordarray[:, :, 2]

# Set up a bounding box for the original extent of the file and possibly a different
# bounding box for the output
interbox = [
    newxcoords.min(),
    newxcoords.max(),
    newzcoords.min(),
    newzcoords.max()
]
if (options.outbox == 'Auto'):
    outbox = interbox
else:
Пример #3
0
shotnumber = 0

# Create bound thresholds (which will be updated)
bounds = [1e10, -1e10, 1e10, -1e10, 1e10, -1e10]

# Loop over each shot gather
for i in xrange(ngathers):
    outlines = []

    # Get the trace header for the first trace in this shot gather
    trhl0 = sf.trhead[sf.ensembles[shotnums[i]]]
    sx = trhl0["sx"] * scalco
    sy = trhl0["sy"] * scalco
    sz = trhl0["selev"] * scalel * zantithesis

    (nsx, nsy, nsz) = reduceToLocal(np.array([sx, sy, sz], ndmin=2), angle, basis)[0]

    # Append information about this shot to the running tally of all shot
    # locations; this is used to construct f.in
    shotlocs[0].append(nsx)
    shotlocs[1].append(nsy)
    shotlocs[2].append(nsz)

    outlines.append(format_string % (nsx, nsy, nsz, 0.0, 0.0, -1))

    tr0 = sf.ensembles[shotnums[i]]

    if i == ngathers - 1:
        tr1 = sf.ntr - 1
    else:
        tr1 = sf.ensembles[shotnums[i + 1]]
Пример #4
0
traceX = np.array([float(trh['sx'])*scalco for trh in sfgeom.trhead])
traceY = np.array([float(trh['sy'])*scalco for trh in sfgeom.trhead])
traceZ = np.array([float(trh['selev'])*scalel for trh in sfgeom.trhead])

# Some working arrays
theones = np.ones((ntr,ns))
theslope = -np.arange(ns) * dz
coordarray = np.empty((ntr,ns,3), dtype=np.float64)

# Create an array of coordinates of shape (ntr, ns, 3)
coordarray[:,:,0] = (traceX * theones.T).T
coordarray[:,:,1] = (traceY * theones.T).T
coordarray[:,:,2] = (traceZ * theones.T).T + theslope * theones

# Reproject to the new coordinate system by rotating around the z-axis
newcoordarray = reduceToLocal(coordarray.reshape((ntr*ns,3)), angle, basis).reshape((ntr,ns,3))

newxcoords = newcoordarray[:,:,0]
newzcoords = newcoordarray[:,:,2]

# Set up a bounding box for the original extent of the file and possibly a different
# bounding box for the output
interbox = [newxcoords.min(), newxcoords.max(), newzcoords.min(), newzcoords.max()]
if (options.outbox == 'Auto'):
  outbox = interbox
else:
  outbox = np.array([np.float(item) for item in options.outbox.strip().split(',')])

# Determine the model size for the new output
nx = round((outbox[1] - outbox[0]) / cellsize) + 1
nz = round((outbox[3] - outbox[2]) / cellsize) + 1
Пример #5
0
vntr = sfvel.ntr
vns = sfvel.ns

scalco = float(strh0['scalco'])
if (scalco < 0):
  scalco = -1./scalco

scalel = float(strh0['scalel'])
if (scalel < 0):
  scalel = -1./scalel

coordarr = np.zeros((sntr,3), dtype=np.float32)

coordarr[:,0] = np.array([float(trh['sx'])*scalco for trh in sfstack.trhead])
coordarr[:,1] = np.array([float(trh['sy'])*scalco for trh in sfstack.trhead])

newcoordarr = reduceToLocal(coordarr, angle, basis)

velarr = sfvel[:]
outarr = np.zeros((sntr,sns))

vdx = (x1 - x0) / (vntr - 1)

for i in xrange(sntr):
  newx = newcoordarr[i, 0]
  vi = np.round((newx - x0) / vdx)
  outarr[i,:] = velarr[vi,:]

sfstack.writeSU(outfile + '.su', outarr)
os.system('< %s segyhdrs | segywrite endian=0 tape=%s'%(outfile + '.su', outfile))
Пример #6
0
scalco = float(strh0['scalco'])
if (scalco < 0):
    scalco = -1. / scalco

scalel = float(strh0['scalel'])
if (scalel < 0):
    scalel = -1. / scalel

coordarr = np.zeros((sntr, 3), dtype=np.float32)

coordarr[:,
         0] = np.array([float(trh['sx']) * scalco for trh in sfstack.trhead])
coordarr[:,
         1] = np.array([float(trh['sy']) * scalco for trh in sfstack.trhead])

newcoordarr = reduceToLocal(coordarr, angle, basis)

velarr = sfvel[:]
outarr = np.zeros((sntr, sns))

vdx = (x1 - x0) / (vntr - 1)

for i in xrange(sntr):
    newx = newcoordarr[i, 0]
    vi = np.round((newx - x0) / vdx)
    outarr[i, :] = velarr[vi, :]

sfstack.writeSU(outfile + '.su', outarr)
os.system('< %s segyhdrs | segywrite endian=0 tape=%s' %
          (outfile + '.su', outfile))
Пример #7
0
# Use SEGYFile internal to calculate shot-gather boundaries
sys.stdout.write('Calculating ensemble boundaries...\n')
sys.stdout.flush()
sf._calcEnsembles()

# Find the number of ensembles, and order them by occurrence in the SEG-Y file
ngathers = len(sf.ensembles)
ordering = np.argsort(sf.ensembles.values())
shotnums = np.array(sf.ensembles.keys())[ordering]

# Assume that SEG-Y file is set up for position-consistent receivers
nrecs = sf.ensembles[shotnums[1]]

rectrh = np.array([(float(trh['gx'])*scalco,float(trh['gy'])*scalco,zantithesis*float(trh['gelev'])*scalel) for trh in sf.trhead[:nrecs]], dtype=np.float32)
newrectrh = reduceToLocal(rectrh, angle, basis)

reclines = []
for i in xrange(len(rectrh)):
  reclines.append(output_format%(i+1,newrectrh[i,0],newrectrh[i,1],newrectrh[i,2],1.))

shottrh = np.array([(float(trh['sx'])*scalco,float(trh['sy'])*scalco,zantithesis*float(trh['selev'])*scalel) for trh in [sf.trhead[sf.ensembles[sn]] for sn in shotnums]])
newshottrh = reduceToLocal(shottrh, angle, basis)

shotlines = []
for i in xrange(ngathers):
  shotlines.append(output_format%(i+1,newshottrh[i,0],newshottrh[i,1],newshottrh[i,2],1.))

with open(shotout, 'w') as fp:
  fp.writelines(shotlines)