def load_data():
    top = geoprobe.horizon('data/seismic/Horizons/seafloor.hzn')
    base = geoprobe.horizon('data/seismic/Horizons/channels.hzn')
    vol = geoprobe.volume('data/seismic/Volumes/example.vol')
    coh = geoprobe.volume('data/seismic/Volumes/coherence.vol')
    vol.data = vol.load()
    coh.data = coh.load()

    base = smooth_horizon(base)
    top = smooth_horizon(top)
    return vol, coh, base, top
def test_isopach():
    x, y = np.mgrid[50:100, 50:100]
    z1 = np.hypot(x - x.mean(), y - y.mean())
    z2 = 2 * z1

    hor1 = geoprobe.horizon(x=x.ravel(), y=y.ravel(), z=z1.ravel())
    hor2 = geoprobe.horizon(x=x.ravel(), y=y.ravel(), z=z2.ravel())

    iso = geoprobe.utilities.create_isopach(hor2, hor1)
    assert np.allclose(iso.x, x.ravel())
    assert np.allclose(iso.y, y.ravel())
    assert np.allclose(z2 - z1, iso.grid)
def test_isopach():
    x, y = np.mgrid[50:100, 50:100]
    z1 = np.hypot(x - x.mean(), y - y.mean())
    z2 = 2 * z1

    hor1 = geoprobe.horizon(x=x.ravel(), y=y.ravel(), z=z1.ravel())
    hor2 = geoprobe.horizon(x=x.ravel(), y=y.ravel(), z=z2.ravel())

    iso = geoprobe.utilities.create_isopach(hor2, hor1)
    assert np.allclose(iso.x, x.ravel())
    assert np.allclose(iso.y, y.ravel())
    assert np.allclose(z2 - z1, iso.grid)
def smooth_horizon(hor):
    z = hor.grid
    z = scipy.ndimage.median_filter(z.astype(float), 4)
    z = scipy.ndimage.gaussian_filter(z, 1.5)
    xmin, xmax, ymin, ymax = hor.grid_extents
    y, x = np.mgrid[ymin:ymax+1, xmin:xmax+1]
    return geoprobe.horizon(x.flatten(), y.flatten(), z.flatten())
def load_data():
    top = geoprobe.horizon('data/seismic/Horizons/channels.hzn')
    vol = geoprobe.volume('data/seismic/Volumes/example.vol')
    vol.data = vol.load()

    top = smooth_horizon(top)
    return vol, top
Example #6
0
    def seafloor_mute(self, seafloor, pad=0, color='white', value=None):
        """
        "Mute" (i.e. plot a filled polygon over) the seismic data above the
        seafloor.

        Parameters:
        -----------
            seafloor: string filename or geoprobe.horizon instance
                The seafloor horizon (or filename of one) to use.
            pad: number
                The vertical (above the seafloor) padding in z (time or depth)
                units between the actual horizon values and the bottom of the
                filled polygon.
            color: matplotlib color specifier (e.g. string or tuple of floats)
                The color of the filled polygon.
            value: number (default=None)
                If specified, the "color" kwarg is ignored, and self.colormap
                is used to choose the color based on the input "value".

        Returns:
        --------
            A matplotlib PolyCollection artist.
        """
        if isinstance(seafloor, basestring):
            seafloor = geoprobe.horizon(seafloor)
        dist, z = self.slice_horizon(seafloor)
        z -= pad
        if value is not None:
            color = self.im.cmap(self.im.norm(value))
        collection = self.ax.fill_between(dist, self.zmin, z, facecolor=color, 
                                          edgecolor='none')
        return collection
def plot_present_day(fig):
    topax = fig.add_subplot(6, 1, 1, aspect=2, adjustable='box')
    seafloor = geoprobe.horizon('/data/nankai/data/Horizons/jdk_seafloor.hzn')
    plot_horizons(topax, data.horizons + [seafloor])
    plt.setp(topax.get_xticklabels(), visible=True)
    topax.set_ylabel('Depth (km bsl)')
    topax.set_xlabel('Distance Along Section (km)')
    return topax
def plot_present_day(fig):
    topax = fig.add_subplot(6,1,1, aspect=2, adjustable='box')
    seafloor = geoprobe.horizon('/data/nankai/data/Horizons/jdk_seafloor.hzn')
    plot_horizons(topax, data.horizons + [seafloor])
    plt.setp(topax.get_xticklabels(), visible=True)
    topax.set_ylabel('Depth (km bsl)')
    topax.set_xlabel('Distance Along Section (km)')
    return topax
Example #9
0
def main():
    # Path to the example data dir relative to the location of this script.
    # This is just so that the script can be called from a different directory
    datadir = os.path.dirname(__file__) + '/data/'

    # Read an existing geoprobe horizon
    hor = geoprobe.horizon(datadir + 'Horizons/channels.hzn')

    print_info(hor)
    plot(hor)
def main():
    # Path to the example data dir relative to the location of this script.
    # This is just so that the script can be called from a different directory
    datadir = os.path.dirname(__file__) + '/data/'

    # Read an existing geoprobe horizon
    hor = geoprobe.horizon(datadir + 'Horizons/channels.hzn')

    print_info(hor)
    plot(hor)
Example #11
0
 def plot_horizon(self, hor, colormap=None):
     if isinstance(hor, basestring):
         hor = geoprobe.horizon(hor)
     if colormap is None:
         colormap = mpl.cm.jet
     hor.grid_extents = self.extents
     data = -hor.grid
     ls = utilities.Shader(azdeg=315, altdeg=45)
     rgb = ls.shade(data, cmap=colormap, mode='overlay')
     im = self.ax.imshow(rgb, extent=self.extents, origin='lower')
     return im
Example #12
0
 def plot_horizon(self, hor, colormap=None):
     if isinstance(hor, basestring):
         hor = geoprobe.horizon(hor)
     if colormap is None:
         colormap = mpl.cm.jet
     hor.grid_extents = self.extents
     data = -hor.grid
     ls = utilities.Shader(azdeg=315, altdeg=45)
     rgb = ls.shade(data, cmap=colormap, mode='overlay')
     im = self.ax.imshow(rgb, extent=self.extents, origin='lower')
     return im
Example #13
0
 def __init__(self, ax, vol, horizonname=None, extents=None, name=''):
     if extents is None:
         extents = [vol.xmin, vol.xmax, vol.ymin, vol.ymax]
     self.name = name
     self.extents = extents
     self.vol = vol
     self.ax = ax
     if horizonname is not None:
         self.base_hor = geoprobe.horizon(horizonname)
         self.base_hor.grid_extents = extents
         self.baseim = self.plot_horizon(self.base_hor)
     self.ax.axis(extents)
     self.ax.set_aspect(self.vol.dyW / self.vol.dxW)
     self.ax.set_title(name)
     self.bounds = utilities.extents_to_poly(*extents)
Example #14
0
 def __init__(self, ax, vol, horizonname=None, extents=None, name=''):
     if extents is None:
         extents = [vol.xmin, vol.xmax, vol.ymin, vol.ymax]
     self.name = name
     self.extents = extents
     self.vol = vol
     self.ax = ax
     if horizonname is not None:
         self.base_hor = geoprobe.horizon(horizonname)
         self.base_hor.grid_extents = extents
         self.baseim = self.plot_horizon(self.base_hor)
     self.ax.axis(extents)
     self.ax.set_aspect(self.vol.dyW / self.vol.dxW)
     self.ax.set_title(name)
     self.bounds = utilities.extents_to_poly(*extents)
Example #15
0
def xyz2hor(xyz):
    return geoprobe.horizon(*xyz.T)
Example #16
0
# These are in stratigraphic order from oldest to youngest
horizon_names = [
    'jdk_forearc_horizon_7.hzn',
    'jdk_forearc_horizon_6.hzn',
    'jdk_forearc_horizon_5.hzn',
    'jdk_forearc_horizon_4.hzn',
    'jdk_forearc_horizon_3.5.hzn',
    'jdk_forearc_horizon_3.hzn',
    'jdk_forearc_horizon_2.5.hzn',
    'jdk_forearc_horizon_2.hzn',
    'jdk_forearc_horizon_1.5.hzn',
    'jdk_forearc_horizon_1.hzn',
    ]

horizon_names = [os.path.join(basedir, 'Horizons', item) for item in horizon_names]
horizons = [geoprobe.horizon(item) for item in horizon_names]

gulick_names = ['7', '6', '5', '4', '3.5', '3', '2.5', '2', '1.5', '1']

# Best fit shear angle for inclined shear
alpha = 70


def to_xyz(hor):
    return np.vstack([hor.x, hor.y, hor.z]).T

def xyz2hor(xyz):
    return geoprobe.horizon(*xyz.T)

def to_world(points):
    points = np.atleast_2d(points)
Example #17
0
import geoprobe
import data
import utilities

from fault_kinematics import homogeneous_simple_shear

from process_bootstrap_results import get_result, load

fault = data.to_world(data.to_xyz(data.fault))
alpha = data.alpha

f, group = load()

for hor in data.horizons:
    print hor.name
    xyz = data.to_world(data.to_xyz(hor))

    slip = get_result(hor.name, group)

    restored = homogeneous_simple_shear.inclined_shear(fault, xyz, slip, alpha)

    print 'Resampling...'
    restored = data.to_model(restored)
    restored = utilities.grid_xyz(restored)
    new_hor = geoprobe.horizon(*restored.T)
    new_hor.write('restored_horizons/' + hor.name + '.hzn')

f.close()

from mayavi import mlab
import numpy as np
import geoprobe
import scipy.ndimage

hor = geoprobe.horizon('data/seismic/Horizons/channels.hzn')
vol = geoprobe.volume('data/seismic/Volumes/example.vol')
data = vol.load()

# Because we're not working in inline/crossline, convert to "pixel" coords.
z = hor.grid
z = vol.model2index(z, axis='z', int_conversion=False)

# Clip out some spikes and smooth the surface a bit...
z = scipy.ndimage.median_filter(z, 4)
z = scipy.ndimage.gaussian_filter(z, 1)

# Quirks due to the way hor.grid is defined...
mlab.surf(np.arange(z.shape[0]), np.arange(z.shape[1]), -z.T,
          colormap='gist_earth')

source = mlab.pipeline.scalar_field(data)
source.spacing = [1, 1, -1]

for axis in ['x', 'y']:
    plane = mlab.pipeline.image_plane_widget(source, 
                                    plane_orientation='{}_axes'.format(axis),
                                    slice_index=100, colormap='gray')
    plane.module_manager.scalar_lut_manager.reverse_lut = True

mlab.show()
Example #19
0
def xyz2hor(xyz):
    return geoprobe.horizon(*xyz.T)
Example #20
0
    'jdk_forearc_horizon_7.hzn',
    'jdk_forearc_horizon_6.hzn',
    'jdk_forearc_horizon_5.hzn',
    'jdk_forearc_horizon_4.hzn',
    'jdk_forearc_horizon_3.5.hzn',
    'jdk_forearc_horizon_3.hzn',
    'jdk_forearc_horizon_2.5.hzn',
    'jdk_forearc_horizon_2.hzn',
    'jdk_forearc_horizon_1.5.hzn',
    'jdk_forearc_horizon_1.hzn',
]

horizon_names = [
    os.path.join(basedir, 'Horizons', item) for item in horizon_names
]
horizons = [geoprobe.horizon(item) for item in horizon_names]

gulick_names = ['7', '6', '5', '4', '3.5', '3', '2.5', '2', '1.5', '1']

# Best fit shear angle for inclined shear
alpha = 70


def to_xyz(hor):
    return np.vstack([hor.x, hor.y, hor.z]).T


def xyz2hor(xyz):
    return geoprobe.horizon(*xyz.T)

Example #21
0
 def __init__(self, horizons, styles=None):
     self.horizons = [geoprobe.horizon(hor) for hor in horizons]
     if styles is None:
         styles = [dict() for _ in horizons]
     self.styles = styles
def top_texture(hor, vol):
    """Coherence extracted 50 meters below top horizon."""
    hor = geoprobe.horizon(hor.x, hor.y, hor.z + 50)
    hor.grid_extents = vol.xmin, vol.xmax, vol.ymin, vol.ymax
    return geoprobe.utilities.extractWindow(hor, vol, 0, 0)