Пример #1
0
# fetch sample SEGY data, near-offset marmousi data
url = "http://dl.dropboxusercontent.com/" \
      "s/i287ci4ww3w7gdt/marmousi_nearoffset.segy"
urllib.urlretrieve(url, 'marmousi_nearoffset.segy')
# We'll use the ObsPy library to load the SEGY data"
segyfile = segy.readSEGY('marmousi_nearoffset.segy')
# turn ObsPy Stream in a matrix of traces
# first dimension time, second dimension traces
ntraces = len(segyfile.traces)
nsamples = len(segyfile.traces[0].data)
mtraces = np.zeros((nsamples, ntraces))
i = 0
for tr in segyfile.traces:
    mtraces[:, i] = tr.data[:]
    i += 1
# make plots
mpl.figure()
mpl.subplot(2, 1, 1)
mpl.ylabel('time (seconds)')
mpl.title("Seismic wiggle plot", fontsize=13, family='sans-serif',
          weight='bold')
# plot using wiggle
mpl.seismic_wiggle(mtraces, scale=10**-4)
mpl.subplot(2, 1, 2)
mpl.ylabel('time (seconds)')
mpl.title("Seismic image plot", fontsize=13, family='sans-serif',
          weight='bold')
# plot using image
mpl.seismic_image(mtraces, aspect='auto')
mpl.show()
mpl.imshow(pvel[::-1], extent=area, alpha=0.25)
wavefield = mpl.imshow(np.zeros(shape), extent=area, vmin=-10**-7, vmax=10**-7, alpha=0.75, cmap=mpl.cm.gray_r)
mpl.points(stations, '.k')
mpl.ylim(area[2:][::-1])
mpl.xlabel('x (km)')
mpl.ylabel('z (km)')
mpl.m2km()
times = np.linspace(0, maxit*dt, maxit)
# the only way for getting the feedback response of the seimograms
global seismograms

# This function updates the plot every few timesteps
def animate(i):
    # Simulation will yield panels corresponding to P and S waves because
    # xz2ps=True
    t, ux, uz, xcomp, zcomp = simulation.next()
    mpl.title('time: %0.3f s' % (times[t]))
    # wavefield.set_array((p + s)[::-1])
    wavefield.set_data(uz[::-1])
    global seismograms
    seismograms = zcomp
    return wavefield, seismograms
anim = animation.FuncAnimation(fig, animate, frames=maxit/snapshot, interval=1)
mpl.show()
# turn the seismogram data in a numpy array
traces = np.array(seismograms)
parana_shot = utils.matrix2stream(traces, header={'delta': dt})
mpl.seismic_wiggle(parana_shot, ranges=[200, 220*dx], scale=2, color='b', normalize=True)
mpl.xlabel('offset (m)')
mpl.ylabel('time (ms)')
mpl.show()
Пример #3
0
vel_l = conv.depth_2_time(velocity, velocity, dt=2e-3, dz=1)
# and we'll assume the density is homogeneous
rho_l = 2200 * np.ones(np.shape(vel_l))
# With that, we can calculate the reflectivity model in time
rc = conv.reflectivity(vel_l, rho_l)
# and finally perform our convolution
synt = conv.convolutional_model(rc, 30, conv.rickerwave, dt=2e-3)

# We can use the utility function in fatiando.vis.mpl to plot the seismogram
fig, axes = plt.subplots(1, 2, figsize=(8, 5))

ax = axes[0]
ax.set_title("Velocity model (in depth)")
tmp = ax.imshow(velocity,
                extent=[0, n_traces, n_samples, 0],
                cmap="copper",
                aspect='auto',
                origin='upper')
fig.colorbar(tmp, ax=ax, pad=0, aspect=50)
ax.set_xlabel('Trace')
ax.set_ylabel('Depth (m)')

ax = axes[1]
ax.set_title("Synthetic seismogram")
mpl.seismic_wiggle(synt[:, ::20], dt=2.e-3, scale=1)
mpl.seismic_image(synt, dt=2.e-3, cmap="RdBu_r", aspect='auto')
ax.set_xlabel('Trace')
ax.set_ylabel('Time (s)')
plt.tight_layout()
plt.show()
Пример #4
0
One way to plot seismic data is using black and white wiggles.
Function :func:`fatiando.vis.mpl.seismic_wiggle` does exactly this.

"""
import numpy as np
import matplotlib.pyplot as plt
from fatiando.seismic import conv
from fatiando.vis.mpl import seismic_wiggle

# We need some data to plot, so let's generate some using the convolution model
# in fatiando.seismic.conv
n_samples, n_traces = 400, 20
dt = 2e-3  # the sampling interval
velocity = 1500 * np.ones((n_samples, n_traces))
# Our model will have a different velocity layer in the middle. This will cause
# a reflection on the top and one on the bottom (with reversed polarity).
velocity[150:300, :] = 2500
# For simplicity, we'll assume constant density when calculating the
# reflectivity.
rc = conv.reflectivity(velocity, 2000 * np.ones_like(velocity))
data = conv.convolutional_model(rc, f=30, wavelet=conv.rickerwave, dt=dt)

# Plot the data using wiggles
plt.figure(figsize=(6, 5))
plt.title("Seismic wiggles")
# The scale parameter makes the wiggles larger or smaller
seismic_wiggle(data, dt=dt, scale=3, color='k')
plt.ylabel('time (s)')
plt.xlabel('trace')
plt.show()
Пример #5
0
dt = 2e-3

# We need to convert the depth model we made above into time
vel_l = conv.depth_2_time(velocity, velocity, dt=dt, dz=1)
# and we'll assume the density is homogeneous
rho_l = 2200*np.ones(np.shape(vel_l))
# With that, we can calculate the reflectivity model in time
rc = conv.reflectivity(vel_l, rho_l)
# and finally perform our convolution
synt = conv.convolutional_model(rc, 30, conv.rickerwave, dt=dt)

# We can use the utility function in fatiando.vis.mpl to plot the seismogram
fig, axes = plt.subplots(1, 2, figsize=(8, 5))

ax = axes[0]
ax.set_title("Velocity model (in depth)")
tmp = ax.imshow(velocity, extent=[0, n_traces, n_samples, 0],
                cmap="copper", aspect='auto', origin='upper')
fig.colorbar(tmp, ax=ax, pad=0, aspect=50)
ax.set_xlabel('Trace')
ax.set_ylabel('Depth (m)')

ax = axes[1]
ax.set_title("Synthetic seismogram")
mpl.seismic_wiggle(synt[:, ::20], dt, scale=1)
mpl.seismic_image(synt, dt, cmap="RdBu_r", aspect='auto')
ax.set_xlabel('Trace')
ax.set_ylabel('Time (s)')
plt.tight_layout()
plt.show()
Пример #6
0
twtvmodel = np.zeros((len(twt), dnx))  # velocity model in time and discretized
for i in xrange(0, nx, disc):  # set the time re-sample velocity model
    twtvmodel[:, int(i / disc)] = np.interp(twt, twti[:, i], vmodel[:, i])
zimp = np.ones(
    twtvmodel.shape) * 1000. * twtvmodel  # create impedance z = rho*v
rc = (zimp[1:] - zimp[:-1]) / (zimp[1:] + zimp[:-1]
                               )  # calculate reflection coefs
fig = mpl.figure(figsize=(11, 7))  # plottings
mpl.subplots_adjust(right=0.98, left=0.11, hspace=0.4, top=0.93, bottom=0.13)
mpl.subplot2grid((3, 4), (0, 0), colspan=4)  # plot rc model
mpl.title("Zero-offset section reflection coefficients",
          fontsize=13,
          family='sans-serif',
          weight='bold')
rcs = utils.matrix2stream(rc.transpose(), header={'delta': dt})
mpl.seismic_wiggle(rcs, normalize=True, scale=1.5, ranges=[0, nx])  # rc model
wavelet = signal.ricker(255, 1 / (2 * f * dt))  # create wavelet
samples = signal.filtfilt(wavelet,
                          np.ones(len(wavelet)),
                          rc,
                          axis=0,
                          padlen=len(twt) - 2)  # convolve rc*wavelet
mpl.ylabel('twt (s)')
mpl.subplot2grid((3, 4), (1, 0), colspan=4)  # plot zero-offset traces
traces = utils.matrix2stream(samples.transpose(), header={'delta': dt})
mpl.seismic_image(traces,
                  cmap=mpl.pyplot.cm.jet,
                  aspect='auto',
                  ranges=[0, nx])
mpl.seismic_wiggle(traces, ranges=[0, nx], normalize=True)
mpl.ylabel('twt (s)')
Пример #7
0

# This function updates the plot every few timesteps
def animate(i):
    # Simulation will yield panels corresponding to P and S waves because
    # xz2ps=True
    t, ux, uz, xcomp, zcomp = simulation.next()
    mpl.title('time: %0.3f s' % (times[t]))
    # wavefield.set_array((p + s)[::-1])
    wavefield.set_data(uz[::-1])
    global seismograms
    seismograms = zcomp
    return wavefield, seismograms


anim = animation.FuncAnimation(fig,
                               animate,
                               frames=maxit / snapshot,
                               interval=1)
mpl.show()
# turn the seismogram data in a numpy array
traces = np.array(seismograms)
parana_shot = utils.matrix2stream(traces, header={'delta': dt})
mpl.seismic_wiggle(parana_shot,
                   ranges=[200, 220 * dx],
                   scale=2,
                   color='b',
                   normalize=True)
mpl.xlabel('offset (m)')
mpl.ylabel('time (ms)')
mpl.show()
Пример #8
0
rock_grid = 1500.*np.ones((n_samples, n_traces))
rock_grid[300:, :] = 2500.
# synthetic calculation
vel_l = conv.depth_2_time(rock_grid, rock_grid, dt=2.e-3, dz=1.)
rho_l = np.ones(np.shape(vel_l))
rc = conv.reflectivity(vel_l, rho_l)
synt = conv.convolutional_model(rc, 30., conv.rickerwave, dt=2.e-3)
# plot input model
plt.figure()
plt.subplot(3, 1, 1)
plt.ylabel('Depth (m)')
plt.title("Depth Vp model", fontsize=13, family='sans-serif', weight='bold')
plt.imshow(rock_grid, extent=[0, n_traces, n_samples, 0],
           cmap=mpl.pyplot.cm.bwr, aspect='auto', origin='upper')
# plot resulted seismogram using wiggle
plt.subplot(3, 1, 2)
mpl.seismic_wiggle(synt, dt=2.e-3)
mpl.seismic_image(synt, dt=2.e-3, cmap=mpl.pyplot.cm.jet, aspect='auto')
plt.ylabel('time (seconds)')
plt.title("Convolutional seismogram", fontsize=13, family='sans-serif',
          weight='bold')

# plot resulted seismogram using wiggle over Vp model
plt.subplot(3, 1, 3)
mpl.seismic_image(vel_l, dt=2.e-3, cmap=mpl.pyplot.cm.jet, aspect='auto')
mpl.seismic_wiggle(synt, dt=2.e-3)
plt.ylabel('time (seconds)')
plt.title("Convolutional seismogram over Vp model", fontsize=13,
          family='sans-serif', weight='bold')
plt.show()
Пример #9
0
One way to plot seismic data is using black and white wiggles.
Function :func:`fatiando.vis.mpl.seismic_wiggle` does exactly this.

"""
import numpy as np
import matplotlib.pyplot as plt
from fatiando.seismic import conv
from fatiando.vis.mpl import seismic_wiggle

# We need some data to plot, so let's generate some using the convolution model
# in fatiando.seismic.conv
n_samples, n_traces = 400, 20
dt = 2e-3    # the sampling interval
velocity = 1500*np.ones((n_samples, n_traces))
# Our model will have a different velocity layer in the middle. This will cause
# a reflection on the top and one on the bottom (with reversed polarity).
velocity[150:300, :] = 2500
# For simplicity, we'll assume constant density when calculating the
# reflectivity.
rc = conv.reflectivity(velocity, 2000*np.ones_like(velocity))
data = conv.convolutional_model(rc, f=30, wavelet=conv.rickerwave, dt=dt)

# Plot the data using wiggles
plt.figure(figsize=(6, 5))
plt.title("Seismic wiggles")
# The scale parameter makes the wiggles larger or smaller
seismic_wiggle(data, dt=dt, scale=3, color='k')
plt.ylabel('time (s)')
plt.xlabel('trace')
plt.show()
vmodel = utils.fromimage('pinchout.bmp', ranges=[2500., 3500.], shape=shp)
twti = np.cumsum(ds/vmodel, axis=0)*2  # calculate irregular sampled twt times
twt = np.arange(0, np.max(twti)+0.10, dt)  # new twt times re-sampled to 4 ms
dnx = int(nx/disc)
twtvmodel = np.zeros((len(twt), dnx))  # velocity model in time and discretized
for i in xrange(0, nx, disc):  # set the time re-sample velocity model
    twtvmodel[:, int(i/disc)] = np.interp(twt, twti[:, i], vmodel[:, i])
zimp = np.ones(twtvmodel.shape)*1000.*twtvmodel  # create impedance z = rho*v
rc = (zimp[1:]-zimp[:-1])/(zimp[1:]+zimp[:-1]) # calculate reflection coefs
fig = mpl.figure(figsize=(11, 7))  # plottings
mpl.subplots_adjust(right=0.98, left=0.11, hspace=0.4, top=0.93, bottom=0.13)
mpl.subplot2grid((3, 4), (0, 0), colspan=4)  # plot rc model
mpl.title("Zero-offset section reflection coefficients",
          fontsize=13, family='sans-serif', weight='bold')
rcs = utils.matrix2stream(rc.transpose(), header={'delta': dt})
mpl.seismic_wiggle(rcs, normalize=True, scale=1.5, ranges=[0, nx])  # rc model
wavelet = signal.ricker(255, 1/(2*f*dt))  # create wavelet
samples = signal.filtfilt(wavelet, np.ones(len(wavelet)),
                          rc, axis=0, padlen=len(twt)-2)  # convolve rc*wavelet
mpl.ylabel('twt (s)')
mpl.subplot2grid((3, 4), (1, 0), colspan=4)  # plot zero-offset traces
traces = utils.matrix2stream(samples.transpose(), header={'delta': dt}) 
mpl.seismic_image(traces, cmap=mpl.pyplot.cm.jet, aspect='auto', ranges=[0, nx])
mpl.seismic_wiggle(traces, ranges=[0, nx], normalize=True)
mpl.ylabel('twt (s)')
mpl.title("Zero-offset section amplitude",
          fontsize=13, family='sans-serif', weight='bold')
ax = mpl.subplot2grid((3, 4), (2, 0), colspan=4)  # plot vmodel
mpl.imshow(vmodel, extent=[0, nx, nz*ds, 0],
           cmap=mpl.pyplot.cm.bwr, aspect='auto', origin='upper')
ax.autoscale(False)
Пример #11
0
rho_l = np.ones(np.shape(vel_l))
rc = conv.reflectivity(vel_l, rho_l)
synt = conv.convolutional_model(rc, 30., conv.rickerwave, dt=2.e-3)
# plot input model
plt.figure()
plt.subplot(3, 1, 1)
plt.ylabel('Depth (m)')
plt.title("Depth Vp model", fontsize=13, family='sans-serif', weight='bold')
plt.imshow(rock_grid,
           extent=[0, n_traces, n_samples, 0],
           cmap=mpl.pyplot.cm.bwr,
           aspect='auto',
           origin='upper')
# plot resulted seismogram using wiggle
plt.subplot(3, 1, 2)
mpl.seismic_wiggle(synt, dt=2.e-3)
mpl.seismic_image(synt, dt=2.e-3, cmap=mpl.pyplot.cm.jet, aspect='auto')
plt.ylabel('time (seconds)')
plt.title("Convolutional seismogram",
          fontsize=13,
          family='sans-serif',
          weight='bold')

# plot resulted seismogram using wiggle over Vp model
plt.subplot(3, 1, 3)
mpl.seismic_image(vel_l, dt=2.e-3, cmap=mpl.pyplot.cm.jet, aspect='auto')
mpl.seismic_wiggle(synt, dt=2.e-3)
plt.ylabel('time (seconds)')
plt.title("Convolutional seismogram over Vp model",
          fontsize=13,
          family='sans-serif',