def _create_rupture(distance, magnitude, tectonic_region_type=TRT.ACTIVE_SHALLOW_CRUST): # Return a rupture with a fixed geometry located at a given r_jb distance # from a site located at (0.0, 0.0). # parameter float distance: # Joyner and Boore rupture-site distance # parameter float magnitude: # Rupture magnitude # Find the point at a given distance lonp, latp = point_at(0.0, 0.0, 90., distance) mag = magnitude rake = 0.0 tectonic_region_type = tectonic_region_type hypocenter = Point(lonp, latp, 2.5) surface = PlanarSurface.from_corner_points( Point(lonp, -1, 0.), Point(lonp, +1, 0.), Point(lonp, +1, 5.), Point(lonp, -1, 5.)) surface = SimpleFaultSurface.from_fault_data( fault_trace=Line([Point(lonp, -1), Point(lonp, 1)]), upper_seismogenic_depth=0.0, lower_seismogenic_depth=5.0, dip=90.0, mesh_spacing=1.0) # check effective rupture-site distance from openquake.hazardlib.geo.mesh import Mesh mesh = Mesh(numpy.array([0.0]), numpy.array([0.0])) assert abs(surface.get_joyner_boore_distance(mesh)-distance) < 1e-2 return BaseRupture(mag, rake, tectonic_region_type, hypocenter, surface, NonParametricSeismicSource)
def make_aftershock_surface(aft_d, scale_relationship=WC1994, mesh_spacing=2.): rupture_area = scale_relationship().get_median_area( aft_d['Mw'], aft_d['rake']) length = (rupture_area * aft_d['aspect_ratio'])**0.5 width = length / aft_d['aspect_ratio'] mid_upper_lon, mid_upper_lat = point_at( aft_d['lon'], aft_d['lat'], aft_d['strike'] - 90, width * np.sin(np.radians(aft_d['dip']))) mid_lower_lon, mid_lower_lat = point_at( aft_d['lon'], aft_d['lat'], aft_d['strike'] + 90, width * np.sin(np.radians(aft_d['dip']))) ul_lon, ul_lat = point_at(mid_upper_lon, mid_upper_lat, aft_d['strike'] - 180, length / 2) ur_lon, ur_lat = point_at(mid_upper_lon, mid_upper_lat, aft_d['strike'], length / 2) ll_lon, ll_lat = point_at(mid_upper_lon, mid_upper_lat, aft_d['strike'] - 180, length / 2) lr_lon, lr_lat = point_at(mid_upper_lon, mid_upper_lat, aft_d['strike'], length / 2) upper_surface_depth = (aft_d['depth'] - width * np.cos(np.radians(aft_d['dip']))) if upper_surface_depth < 0: upper_surface_depth = 0. lower_surface_depth = (aft_d['depth'] + width * np.cos(np.radians(aft_d['dip']))) ul_corner = Point(ul_lon, ul_lat, upper_surface_depth) ll_corner = Point(ll_lon, ll_lat, lower_surface_depth) ur_corner = Point(ur_lon, ur_lat, upper_surface_depth) lr_corner = Point(lr_lon, lr_lat, lower_surface_depth) return PlanarSurface.from_corner_points(mesh_spacing, ul_corner, ur_corner, lr_corner, ll_corner)