def create_oqhazardlib_source(self, tom, mesh_spacing, area_discretisation, use_defaults=False): """ Converts the source model into an instance of the :class: openquake.hazardlib.source.area.AreaSource :param tom: Temporal Occurrence model as instance of :class: openquake.hazardlib.tom.TOM :param float mesh_spacing: Mesh spacing """ if not self.mfd: raise ValueError("Cannot write to hazardlib without MFD") return AreaSource( self.id, self.name, self.trt, self.mfd, mesh_spacing, conv.mag_scale_rel_to_hazardlib(self.mag_scale_rel, use_defaults), conv.render_aspect_ratio(self.rupt_aspect_ratio, use_defaults), tom, self.upper_depth, self.lower_depth, conv.npd_to_pmf(self.nodal_plane_dist, use_defaults), conv.hdd_to_pmf(self.hypo_depth_dist, use_defaults), self.geometry, area_discretisation)
def make_area_source(polygon, discretization, **kwargs): default_arguments = { 'source_id': 'source_id', 'name': 'area source name', 'tectonic_region_type': TRT.VOLCANIC, 'mfd': TruncatedGRMFD(a_val=3, b_val=1, min_mag=5, max_mag=7, bin_width=1), 'nodal_plane_distribution': PMF([(1, NodalPlane(1, 2, 3))]), 'hypocenter_distribution': PMF([(0.5, 4.0), (0.5, 8.0)]), 'upper_seismogenic_depth': 1.3, 'lower_seismogenic_depth': 10.0, 'magnitude_scaling_relationship': PeerMSR(), 'rupture_aspect_ratio': 1.333, 'polygon': polygon, 'area_discretization': discretization, 'rupture_mesh_spacing': 12.33, 'temporal_occurrence_model': PoissonTOM(50.) } default_arguments.update(kwargs) kwargs = default_arguments source = AreaSource(**kwargs) return source
Point(15.0, 15.2), PMF([(1.0, NodalPlane(0.0, 90.0, 0.0))]), PMF([(1.0, 5.0)])) AREA_POLY = Polygon([Point(14.95, 15.05), Point(15.05, 15.05), Point(15.05, 14.95), Point(14.95, 14.95)]) AREA_SOURCE = AreaSource("AREA000", "Area 000", "Active Shallow Crust", EvenlyDiscretizedMFD(5.0, 0.1, [1.0]), 1.0, PointMSR(), 1.0, PoissonTOM(1.0), 0., 40., PMF([(1.0, NodalPlane(0.0, 90.0, 0.0))]), PMF([(0.5, 5.0), (0.5, 15.0)]), AREA_POLY, 4.0) SIMPLE_TRACE = Line([Point(14.975, 15.0, 0.0), Point(15.025, 15.0, 0.0)]) SIMPLE_FAULT = SimpleFaultSource("SFLT000", "Simple Fault Source", "Active Shallow Crust", EvenlyDiscretizedMFD(7.0, 0.1, [1.0]), 1.0, PeerMSR(), 1.0,