Example #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=PeerMSR(),
                rupture_aspect_ratio=test_data.SET1_RUPTURE_ASPECT_RATIO,
                polygon=test_data.SET1_CASE11_SOURCE_POLYGON,
                area_discretization=30.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
        time_span = 1.0
        imts = {test_data.IMT: test_data.SET1_CASE11_IMLS}

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

        assert_hazard_curve_is(self,
                               s1hc,
                               test_data.SET1_CASE11_SITE1_POES,
                               tolerance=2e-3)
        assert_hazard_curve_is(self,
                               s2hc,
                               test_data.SET1_CASE11_SITE2_POES,
                               tolerance=2e-3)
        assert_hazard_curve_is(self,
                               s3hc,
                               test_data.SET1_CASE11_SITE3_POES,
                               tolerance=2e-3)
        assert_hazard_curve_is(self,
                               s4hc,
                               test_data.SET1_CASE11_SITE4_POES,
                               tolerance=2e-3)
Example #2
0
    def test_case_5(self):
        # only mfd differs from case 2
        sources = [
            SimpleFaultSource(
                source_id="fault1",
                name="fault1",
                tectonic_region_type=const.TRT.ACTIVE_SHALLOW_CRUST,
                mfd=test_data.SET1_CASE5_MFD,
                rupture_mesh_spacing=1.0,
                magnitude_scaling_relationship=PeerMSR(),
                rupture_aspect_ratio=test_data.SET1_RUPTURE_ASPECT_RATIO,
                upper_seismogenic_depth=test_data.SET1_CASE1TO9_UPPER_SEISMOGENIC_DEPTH,
                lower_seismogenic_depth=test_data.SET1_CASE1TO9_LOWER_SEISMOGENIC_DEPTH,
                fault_trace=test_data.SET1_CASE1TO9_FAULT_TRACE,
                dip=test_data.SET1_CASE1TO9_DIP,
                rake=test_data.SET1_CASE1TO9_RAKE,
            )
        ]
        sites = SiteCollection(
            [
                test_data.SET1_CASE1TO9_SITE1,
                test_data.SET1_CASE1TO9_SITE2,
                test_data.SET1_CASE1TO9_SITE3,
                test_data.SET1_CASE1TO9_SITE4,
                test_data.SET1_CASE1TO9_SITE5,
                test_data.SET1_CASE1TO9_SITE6,
                test_data.SET1_CASE1TO9_SITE7,
            ]
        )
        gsims = {const.TRT.ACTIVE_SHALLOW_CRUST: SadighEtAl1997()}
        truncation_level = 0
        time_span = 1.0
        imts = {test_data.IMT: test_data.SET1_CASE5_IMLS}

        curves = hazard_curves(sources, sites, imts, time_span, gsims, truncation_level)
        s1hc, s2hc, s3hc, s4hc, s5hc, s6hc, s7hc = curves[test_data.IMT]

        assert_hazard_curve_is(self, s1hc, test_data.SET1_CASE5_SITE1_POES, tolerance=1e-3)
        assert_hazard_curve_is(self, s2hc, test_data.SET1_CASE5_SITE2_POES, tolerance=1e-3)
        assert_hazard_curve_is(self, s3hc, test_data.SET1_CASE5_SITE3_POES, tolerance=1e-3)
        assert_hazard_curve_is(self, s4hc, test_data.SET1_CASE5_SITE4_POES, tolerance=1e-3)
        assert_hazard_curve_is(self, s5hc, test_data.SET1_CASE5_SITE5_POES, tolerance=1e-3)
        assert_hazard_curve_is(self, s6hc, test_data.SET1_CASE5_SITE6_POES, tolerance=1e-3)
        assert_hazard_curve_is(self, s7hc, test_data.SET1_CASE5_SITE7_POES, tolerance=1e-3)
Example #3
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 = PeerMSR(),
            rupture_aspect_ratio=test_data.SET1_RUPTURE_ASPECT_RATIO,
            polygon=test_data.SET1_CASE11_SOURCE_POLYGON,
            area_discretization=30.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
        time_span = 1.0
        imts = {test_data.IMT: test_data.SET1_CASE11_IMLS}

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

        assert_hazard_curve_is(self, s1hc, test_data.SET1_CASE11_SITE1_POES,
                               tolerance=2e-3)
        assert_hazard_curve_is(self, s2hc, test_data.SET1_CASE11_SITE2_POES,
                               tolerance=2e-3)
        assert_hazard_curve_is(self, s3hc, test_data.SET1_CASE11_SITE3_POES,
                               tolerance=2e-3)
        assert_hazard_curve_is(self, s4hc, test_data.SET1_CASE11_SITE4_POES,
                               tolerance=2e-3)
Example #4
0
    def test_case_5(self):
        # only mfd differs from case 2
        sources = [
            SimpleFaultSource(
                source_id='fault1',
                name='fault1',
                tectonic_region_type=const.TRT.ACTIVE_SHALLOW_CRUST,
                mfd=test_data.SET1_CASE5_MFD,
                rupture_mesh_spacing=1.0,
                magnitude_scaling_relationship=PeerMSR(),
                rupture_aspect_ratio=test_data.SET1_RUPTURE_ASPECT_RATIO,
                upper_seismogenic_depth=test_data.
                SET1_CASE1TO9_UPPER_SEISMOGENIC_DEPTH,
                lower_seismogenic_depth=test_data.
                SET1_CASE1TO9_LOWER_SEISMOGENIC_DEPTH,
                fault_trace=test_data.SET1_CASE1TO9_FAULT_TRACE,
                dip=test_data.SET1_CASE1TO9_DIP,
                rake=test_data.SET1_CASE1TO9_RAKE)
        ]
        sites = SiteCollection([
            test_data.SET1_CASE1TO9_SITE1, test_data.SET1_CASE1TO9_SITE2,
            test_data.SET1_CASE1TO9_SITE3, test_data.SET1_CASE1TO9_SITE4,
            test_data.SET1_CASE1TO9_SITE5, test_data.SET1_CASE1TO9_SITE6,
            test_data.SET1_CASE1TO9_SITE7
        ])
        gsims = {const.TRT.ACTIVE_SHALLOW_CRUST: SadighEtAl1997()}
        truncation_level = 0
        time_span = 1.0
        imts = {test_data.IMT: test_data.SET1_CASE5_IMLS}

        curves = hazard_curves(sources, sites, imts, time_span, gsims,
                               truncation_level)
        s1hc, s2hc, s3hc, s4hc, s5hc, s6hc, s7hc = curves[test_data.IMT]

        assert_hazard_curve_is(self,
                               s1hc,
                               test_data.SET1_CASE5_SITE1_POES,
                               tolerance=1e-3)
        assert_hazard_curve_is(self,
                               s2hc,
                               test_data.SET1_CASE5_SITE2_POES,
                               tolerance=1e-3)
        assert_hazard_curve_is(self,
                               s3hc,
                               test_data.SET1_CASE5_SITE3_POES,
                               tolerance=1e-3)
        assert_hazard_curve_is(self,
                               s4hc,
                               test_data.SET1_CASE5_SITE4_POES,
                               tolerance=1e-3)
        assert_hazard_curve_is(self,
                               s5hc,
                               test_data.SET1_CASE5_SITE5_POES,
                               tolerance=1e-3)
        assert_hazard_curve_is(self,
                               s6hc,
                               test_data.SET1_CASE5_SITE6_POES,
                               tolerance=1e-3)
        assert_hazard_curve_is(self,
                               s7hc,
                               test_data.SET1_CASE5_SITE7_POES,
                               tolerance=1e-3)