Ejemplo n.º 1
0
    def test_case_11(self):
        hypocenter_probability = (Decimal(1) /
                                  len(test_data.SET1_CASE11_HYPOCENTERS))
        hypocenter_pmf = PMF([
            (hypocenter_probability, hypocenter)
            for hypocenter in test_data.SET1_CASE11_HYPOCENTERS
        ])
        # apart from hypocenter pmf repeats case 10
        sources = [
            AreaSource(
                source_id='area',
                name='area',
                tectonic_region_type=const.TRT.ACTIVE_SHALLOW_CRUST,
                mfd=test_data.SET1_CASE11_MFD,
                nodal_plane_distribution=PMF([(1, NodalPlane(0.0, 90.0,
                                                             0.0))]),
                hypocenter_distribution=hypocenter_pmf,
                upper_seismogenic_depth=0.0,
                lower_seismogenic_depth=10.0,
                magnitude_scaling_relationship=PointMSR(),
                rupture_aspect_ratio=test_data.SET1_RUPTURE_ASPECT_RATIO,
                temporal_occurrence_model=PoissonTOM(1.),
                polygon=test_data.SET1_CASE11_SOURCE_POLYGON,
                area_discretization=10.0,
                rupture_mesh_spacing=10.0)
        ]
        sites = SiteCollection([
            test_data.SET1_CASE11_SITE1, test_data.SET1_CASE11_SITE2,
            test_data.SET1_CASE11_SITE3, test_data.SET1_CASE11_SITE4
        ])
        gsims = {const.TRT.ACTIVE_SHALLOW_CRUST: SadighEtAl1997()}
        truncation_level = 0
        imts = {str(test_data.IMT): test_data.SET1_CASE11_IMLS}

        curves = calc_hazard_curves(sources, sites, imts, gsims,
                                    truncation_level)
        s1hc, s2hc, s3hc, s4hc = curves[str(test_data.IMT)]

        assert_hazard_curve_is(self,
                               s1hc,
                               test_data.SET1_CASE11_SITE1_POES,
                               atol=1e-4,
                               rtol=1e-1)
        assert_hazard_curve_is(self,
                               s2hc,
                               test_data.SET1_CASE11_SITE2_POES,
                               atol=1e-4,
                               rtol=1e-1)
        assert_hazard_curve_is(self,
                               s3hc,
                               test_data.SET1_CASE11_SITE3_POES,
                               atol=1e-4,
                               rtol=1e-1)
        assert_hazard_curve_is(self,
                               s4hc,
                               test_data.SET1_CASE11_SITE4_POES,
                               atol=1e-4,
                               rtol=1e-1)
Ejemplo n.º 2
0
def make_rupture(trt, mag, msr=PointMSR(), aspect_ratio=1.0, seismo=(10, 30),
                 nodal_plane_tup=(0, 90, 0), hc_tup=(0, 0, 20),
                 occurrence_rate=1, tom=None):
    hc = Point(*hc_tup)
    np = NodalPlane(*nodal_plane_tup)
    ps = object.__new__(PointSource)
    ps.magnitude_scaling_relationship = msr
    ps.upper_seismogenic_depth = seismo[0]
    ps.lower_seismogenic_depth = seismo[1]
    ps.rupture_aspect_ratio = aspect_ratio
    surface, nhc = ps._get_rupture_surface(mag, np, hc)
    rup = ParametricProbabilisticRupture(
        mag, np.rake, trt, hc, surface, occurrence_rate, tom)
    return rup