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 """ return AreaSource( self.id, self.name, self.trt, conv.mfd_to_hazardlib(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 create_oqhazardlib_source(self, tom, mesh_spacing, use_defaults=False): """ Converts the point source model into an instance of the :class: openquake.hazardlib.source.point_source.PointSource :param bool use_defaults: If set to true, will use put in default values for magitude scaling relation, rupture aspect ratio, nodal plane distribution or hypocentral depth distribution where missing. If set to False then value errors will be raised when information is missing. """ return PointSource( self.id, self.name, self.trt, conv.mfd_to_hazardlib(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, self.geometry, conv.npd_to_pmf(self.nodal_plane_dist, use_defaults), conv.hdd_to_pmf(self.hypo_depth_dist, use_defaults))
def test_mfd_to_hazardlib_oq_hazardlib_tgr(self): """ Tests that the conversion to hazardlib formulation for the TGRMFD case """ output = conv.mfd_to_hazardlib(self.model_gr) self.assertIsInstance(output, mfd.truncated_gr.TruncatedGRMFD) self.assertAlmostEqual(output.b_val, self.model_gr.b_val) self.assertAlmostEqual(output.bin_width, self.model_gr.bin_width)
def test_mfd_to_hazardlib_nrmllib_tgr(self): """ Tests the conversion to hazardlib fomrulation for the models.TGRMFD case """ output = conv.mfd_to_hazardlib(models.TGRMFD(3.0, 1.0, 4.5, 6.5)) self.assertIsInstance(output, mfd.truncated_gr.TruncatedGRMFD) self.assertAlmostEqual(output.b_val, 1.0) self.assertAlmostEqual(output.bin_width, 0.1)
def test_mfd_to_hazardlib_nrmllib_ed(self): """ Tests the conversion to hazardlib fomrulation for the models.IncrementalMFD case """ output = conv.mfd_to_hazardlib(models.IncrementalMFD(4.5, 0.1, [6.5])) self.assertIsInstance(output, mfd.evenly_discretized.EvenlyDiscretizedMFD) self.assertAlmostEqual(output.min_mag, 4.5) self.assertAlmostEqual(output.bin_width, 0.1)
def test_mfd_to_hazardlib_oq_hazardlib_ed(self): """ Tests that the conversion to hazardlib formulation for the EvenlyDiscretizedMFD case """ output = conv.mfd_to_hazardlib(self.model_ed) self.assertIsInstance(output, mfd.evenly_discretized.EvenlyDiscretizedMFD) self.assertAlmostEqual(output.min_mag, self.model_gr.min_mag) self.assertAlmostEqual(output.bin_width, self.model_gr.bin_width)
def create_oqhazardlib_source(self, tom, mesh_spacing, use_defaults=False): """ Creates an instance of the source model as :class: openquake.hazardlib.source.complex_fault.ComplexFaultSource """ return ComplexFaultSource( self.id, self.name, self.trt, conv.mfd_to_hazardlib(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.fault_edges, self.rake)
def create_oqhazardlib_source(self, tom, mesh_spacing, use_defaults=False): """ Returns an instance of the :class: openquake.hazardlib.source.simple_fault.SimpleFaultSource :param tom: Temporal occurrance model :param float mesh_spacing: Mesh spacing """ return SimpleFaultSource( self.id, self.name, self.trt, conv.mfd_to_hazardlib(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, self.fault_trace, self.dip, self.rake)