def slice_horizon(self, hor): """Slices a geoprobe horizon along the section line. Returns a sequence of distances along the section and a sequence of z-values.""" # Get only the portions of the section inside the horizon extents try: bounds = hor.bounds except AttributeError: hor.bounds = utilities.extents_to_poly(*hor.grid_extents) bounds = hor.bounds if not self.line.intersects(bounds): return np.array([]), np.array([]) inside = self.line.intersection(bounds) x, y = inside.xy # Extract the section xmin, xmax, ymin, ymax = hor.grid_extents x, y = x - xmin, y - ymin z, xi, yi = geoprobe.utilities.extract_section(hor.grid.T, x, y) # Put the distances back in to distance along the section line start, _ = self.project_onto(xi[0]+xmin, yi[0]+ymin) distance = np.hypot(self.dxw * np.diff(xi), self.dyw * np.diff(yi)) z = np.ma.squeeze(z) distance = np.cumsum(np.r_[start, distance]) distance = np.ma.masked_array(distance, z.mask) return distance, z
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)