def plot_horizons(ax, horizons, slip=(0,0)): fault = data.world_xyz(data.fault) sec = Section() ax.set_ylim([-8, -1.5]) for hor in horizons: xyz = data.world_xyz(hor)[::100] xyz = inclined_shear(fault, xyz, slip, data.alpha) sec.plot(xyz, ax) sec.plot(fault, ax, color='red') plt.setp(ax.get_xticklabels(), visible=False)
def plot_horizons(ax, horizons, slip=(0, 0)): fault = data.world_xyz(data.fault) sec = Section() ax.set_ylim([-8, -1.5]) for hor in horizons: xyz = data.world_xyz(hor)[::100] xyz = inclined_shear(fault, xyz, slip, data.alpha) sec.plot(xyz, ax) sec.plot(fault, ax, color='red') plt.setp(ax.get_xticklabels(), visible=False)
def calculate_heave(slip, hor): """Calculates the average heave resulting from moving the given horizon (`hor`) by `slip` along the main fault.""" orig_xyz = data.world_xyz(hor)[::50] fault = data.world_xyz(data.fault) func = homogeneous_simple_shear.inclined_shear moved_xyz = func(fault, orig_xyz, slip, data.alpha, remove_invalid=False) diff = moved_xyz - orig_xyz mask = np.isfinite(diff) mask = mask[:,0] & mask[:,1] return diff[mask,:].mean(axis=0)
def setup_plot(self): tri = triangles(self.fault) fault = self.view_triangles(data.world_xyz(self.fault), tri) # fault = self.view_xyz_surface(data.world_xyz(self.fault)) if self.origxyz is not None: self.view_xyz_surface(self.origxyz) self.scene.mlab.orientation_axes() self.scene.mlab.outline(fault) return self.view_xyz_surface(self.horxyz)
def restore_horizons(func=invert_slip): """ Restore each of the uplifted horizons individually. "func" just allows overriding of the specific inversion (e.g. see "invert_slip_fixed_azimuth.py") without code duplication. """ # Note that we start each horizon at zero offset and restore independently guess = (0, 0) variances, planar_variances = [], [] slips, heaves = [], [] for hor in data.horizons[::-1]: hor_xyz = data.world_xyz(hor) # Downsample the horizon for faster runtime # (No need to include millions of points along the horizon's surface) hor_xyz = hor_xyz[::50] # Invert for the slip along the fault needed to restore the horizon # to horizontal. slip, metric = func(data.fault_xyz, hor_xyz, alpha=data.alpha, guess=guess, overlap_thresh=1, return_metric=True) heave = utilities.calculate_heave(slip, hor) variances.append(metric) planar_var = planar_variance(hor_xyz) planar_variances.append(planar_var) slips.append(slip) heaves.append(heave) # Note: We're plotting "metric / planar_var" to allow a direct # comparison of the quality of the fit between different horizons. print 'Restoring', hor.name print ' Roughness (lower is better):', metric / planar_var return slips, heaves, variances, planar_variances
def restore_horizons(func=invert_slip): """ Restore each of the uplifted horizons individually. "func" just allows overriding of the specific inversion (e.g. see "invert_slip_fixed_azimuth.py") without code duplication. """ # Note that we start each horizon at zero offset and restore independently guess = (0,0) variances, planar_variances = [], [] slips, heaves = [], [] for hor in data.horizons[::-1]: hor_xyz = data.world_xyz(hor) # Downsample the horizon for faster runtime # (No need to include millions of points along the horizon's surface) hor_xyz = hor_xyz[::50] # Invert for the slip along the fault needed to restore the horizon # to horizontal. slip, metric = func(data.fault_xyz, hor_xyz, alpha=data.alpha, guess=guess, overlap_thresh=1, return_metric=True) heave = utilities.calculate_heave(slip, hor) variances.append(metric) planar_var = planar_variance(hor_xyz) planar_variances.append(planar_var) slips.append(slip) heaves.append(heave) # Note: We're plotting "metric / planar_var" to allow a direct # comparison of the quality of the fit between different horizons. print 'Restoring', hor.name print ' Roughness (lower is better):', metric / planar_var return slips, heaves, variances, planar_variances
def forced_direction_inversion(fault, xyz, alpha, azimuth, **kwargs): azimuth = np.radians(90 - azimuth) dx, dy = np.cos(azimuth), np.sin(azimuth) direc = [[dx, dy], [dx, dy]] return invert_slip(fault, xyz, alpha, direc=direc, **kwargs) def visualize(slip, faultxyz, horxyz): fault = geoprobe.swfault('/data/nankai/data/swFaults/jdk_oos_splay_large_area_depth.swf') azimuth = np.degrees(np.arctan2(*slip[::-1])) azimuth = 90 - azimuth mag = np.linalg.norm(slip) / 1000 f = FaultModel(fault, horxyz, origxyz=horxyz, ve=3, azimuth=azimuth, slip=mag, alpha=data.alpha, calc_fault=faultxyz) f.configure_traits() fault = data.world_xyz(data.fault) for i, hor in enumerate(data.horizons[::-1]): print hor.name xyz = data.to_world(data.to_xyz(hor))[::50] slip, metric = invert_slip(fault, xyz, alpha=data.alpha, guess=(0,0), overlap_thresh=1, return_metric=True) # slip, metric = forced_direction_inversion(fault, xyz, data.alpha, data.fault_strike+90, # guess=guess, return_metric=True) visualize(slip, fault, xyz)
def dip(hor): x, y, z = data.world_xyz(hor).T strike, dip = geoprobe.utilities.points2strikeDip(x, y, -z) return strike, dip