Example #1
0
    def setUp(self):
        super(PointSourceSourceFilterTestCase, self).setUp()
        self.sitecol = SiteCollection(self.SITES)

        self.source1 = make_point_source(
            mfd=EvenlyDiscretizedMFD(min_mag=5,
                                     bin_width=1,
                                     occurrence_rates=[1]),
            rupture_aspect_ratio=1.9,
            upper_seismogenic_depth=0,
            lower_seismogenic_depth=18.5,
            magnitude_scaling_relationship=PeerMSR(),
            nodal_plane_distribution=PMF([
                (0.5, NodalPlane(strike=1, dip=2, rake=3)),
                (0.5, NodalPlane(strike=1, dip=20, rake=3)),
            ]),
            location=Point(2.0, 0.0),
        )
        self.source2 = make_point_source(
            mfd=EvenlyDiscretizedMFD(min_mag=6.5,
                                     bin_width=1,
                                     occurrence_rates=[1]),
            rupture_aspect_ratio=0.5,
            upper_seismogenic_depth=0,
            lower_seismogenic_depth=18.5,
            magnitude_scaling_relationship=PeerMSR(),
            nodal_plane_distribution=PMF([
                (0.5, NodalPlane(strike=1, dip=10, rake=3)),
                (0.5, NodalPlane(strike=1, dip=20, rake=3)),
            ]),
            location=Point(2.0, 0.0),
        )
Example #2
0
 def test(self):
     evenly_discretized = EvenlyDiscretizedMFD(
         min_mag=0.2, bin_width=0.3, occurrence_rates=[2.1, 2.4, 5.3]
     )
     self.assertEqual(evenly_discretized.get_annual_occurrence_rates(),
                      [(0.2, 2.1), (0.5, 2.4), (0.8, 5.3)])
     self.assertEqual(evenly_discretized.get_min_mag(), 0.2)
Example #3
0
 def test_occurrence_rate_rescaling(self):
     mfd = EvenlyDiscretizedMFD(min_mag=4,
                                bin_width=1,
                                occurrence_rates=[3])
     polygon = Polygon([
         Point(0, 0),
         Point(0, -0.2248),
         Point(-0.2248, -0.2248),
         Point(-0.2248, 0)
     ])
     source = self.make_area_source(polygon, discretization=10, mfd=mfd)
     self.assertIs(source.mfd, mfd)
     ruptures = list(source.iter_ruptures(PoissonTOM(1)))
     self.assertEqual(len(ruptures), 4)
     for rupture in ruptures:
         self.assertNotEqual(rupture.occurrence_rate, 3)
         self.assertEqual(rupture.occurrence_rate, 3.0 / 4.0)
Example #4
0
    def setUp(self):
        class FakeSource(SeismicSource):
            iter_ruptures = None
            get_rupture_enclosing_polygon = None

        self.source_class = FakeSource
        mfd = EvenlyDiscretizedMFD(min_mag=3,
                                   bin_width=1,
                                   occurrence_rates=[5, 6, 7])
        self.source = FakeSource('source_id',
                                 'name',
                                 const.TRT.VOLCANIC,
                                 mfd=mfd,
                                 rupture_mesh_spacing=2,
                                 magnitude_scaling_relationship=PeerMSR(),
                                 rupture_aspect_ratio=1)
        self.sitecol = SiteCollection(self.SITES)
Example #5
0
    def test_7_many_ruptures(self):
        source_id = name = 'test7-source'
        trt = TRT.VOLCANIC
        mag1 = 4.5
        mag2 = 5.5
        mag1_rate = 9e-3
        mag2_rate = 9e-4
        hypocenter1 = 9.0
        hypocenter2 = 10.0
        hypocenter1_weight = Decimal('0.8')
        hypocenter2_weight = Decimal('0.2')
        nodalplane1 = NodalPlane(strike=45, dip=90, rake=0)
        nodalplane2 = NodalPlane(strike=0, dip=45, rake=10)
        nodalplane1_weight = Decimal('0.3')
        nodalplane2_weight = Decimal('0.7')
        upper_seismogenic_depth = 2
        lower_seismogenic_depth = 16
        rupture_aspect_ratio = 2
        rupture_mesh_spacing = 0.5
        location = Point(0, 0)
        magnitude_scaling_relationship = PeerMSR()
        tom = PoissonTOM(time_span=50)

        mfd = EvenlyDiscretizedMFD(min_mag=mag1,
                                   bin_width=(mag2 - mag1),
                                   occurrence_rates=[mag1_rate, mag2_rate])
        nodal_plane_distribution = PMF([(nodalplane1_weight, nodalplane1),
                                        (nodalplane2_weight, nodalplane2)])
        hypocenter_distribution = PMF([(hypocenter1_weight, hypocenter1),
                                       (hypocenter2_weight, hypocenter2)])
        point_source = PointSource(
            source_id, name, trt, mfd, rupture_mesh_spacing,
            magnitude_scaling_relationship, rupture_aspect_ratio,
            upper_seismogenic_depth, lower_seismogenic_depth, location,
            nodal_plane_distribution, hypocenter_distribution)
        actual_ruptures = list(point_source.iter_ruptures(tom))
        self.assertEqual(len(actual_ruptures), 8)
        expected_ruptures = {
            (mag1, nodalplane1.rake, hypocenter1): (
                # probabilistic rupture's occurrence rate
                9e-3 * 0.3 * 0.8,
                # rupture surface corners
                planar_surface_test_data.TEST_7_RUPTURE_1_CORNERS),
            (mag2, nodalplane1.rake, hypocenter1):
            (9e-4 * 0.3 * 0.8,
             planar_surface_test_data.TEST_7_RUPTURE_2_CORNERS),
            (mag1, nodalplane2.rake, hypocenter1):
            (9e-3 * 0.7 * 0.8,
             planar_surface_test_data.TEST_7_RUPTURE_3_CORNERS),
            (mag2, nodalplane2.rake, hypocenter1):
            (9e-4 * 0.7 * 0.8,
             planar_surface_test_data.TEST_7_RUPTURE_4_CORNERS),
            (mag1, nodalplane1.rake, hypocenter2):
            (9e-3 * 0.3 * 0.2,
             planar_surface_test_data.TEST_7_RUPTURE_5_CORNERS),
            (mag2, nodalplane1.rake, hypocenter2):
            (9e-4 * 0.3 * 0.2,
             planar_surface_test_data.TEST_7_RUPTURE_6_CORNERS),
            (mag1, nodalplane2.rake, hypocenter2):
            (9e-3 * 0.7 * 0.2,
             planar_surface_test_data.TEST_7_RUPTURE_7_CORNERS),
            (mag2, nodalplane2.rake, hypocenter2):
            (9e-4 * 0.7 * 0.2,
             planar_surface_test_data.TEST_7_RUPTURE_8_CORNERS)
        }
        for actual_rupture in actual_ruptures:
            expected_occurrence_rate, expected_corners = expected_ruptures[(
                actual_rupture.mag, actual_rupture.rake,
                actual_rupture.hypocenter.depth)]
            self.assertTrue(isinstance(actual_rupture, ProbabilisticRupture))
            self.assertEqual(actual_rupture.occurrence_rate,
                             expected_occurrence_rate)
            self.assertIs(actual_rupture.temporal_occurrence_model, tom)
            self.assertEqual(actual_rupture.tectonic_region_type, trt)
            surface = actual_rupture.surface

            tl, tr, br, bl = expected_corners
            self.assertEqual(tl, surface.top_left)
            self.assertEqual(tr, surface.top_right)
            self.assertEqual(bl, surface.bottom_left)
            self.assertEqual(br, surface.bottom_right)
Example #6
0
# rigidity = 3e10 # N/m^2
# fault_length = 25.0 * 1e3 # m
# fault_width = 12.0 * 1e3 # m
#
# The total seismic moment rate can be computed as:
#
# seismic_moment_rate = rigidity * fault_length * fault_width * slip_rate
#
# From which we can derived the incremental a value:
#
# a_incremental = log10(seismic_moment_rate) - (1.5 + b_value) * magnitude - 9.05
#
# and finally the rate:
#
# rate = 10 ** (a_incremental + b_value * magnitude)
SET1_CASE2_MFD = EvenlyDiscretizedMFD(min_mag=6.0, bin_width=0.01,
                                      occurrence_rates=[0.0160425168864])
SET1_CASE1TO9_RAKE = 0

# page A-3
SET1_CASE1TO9_FAULT_TRACE = Line([Point(-122.0, 38.0),
                                  Point(-122.0, 38.22480)])

# page A-17
SET1_CASE1TO9_UPPER_SEISMOGENIC_DEPTH = 0.0
SET1_CASE1TO9_LOWER_SEISMOGENIC_DEPTH = 12.0
SET1_CASE1TO9_DIP = 90

# page A-3
SET1_CASE1TO9_SITE1 = Site(
    location=Point(-122.000, 38.113), vs30=800.0, vs30measured=True,
    z1pt0=1.0, z2pt5=2.0
Example #7
0
 def test(self):
     evenly_discretized = EvenlyDiscretizedMFD(
         min_mag=0.2, bin_width=0.3, occurrence_rates=[2.1, 2.4, 5.3])
     self.assertEqual(evenly_discretized.get_annual_occurrence_rates(),
                      [(0.2, 2.1), (0.5, 2.4), (0.8, 5.3)])
     self.assertEqual(evenly_discretized.get_min_mag(), 0.2)
Example #8
0
 def test_zero_rate(self):
     evenly_discretized = EvenlyDiscretizedMFD(min_mag=1,
                                               bin_width=2,
                                               occurrence_rates=[4, 0, 5])
     self.assertEqual(evenly_discretized.get_annual_occurrence_rates(),
                      [(1, 4), (3, 0), (5, 5)])
Example #9
0
 def test_zero_min_mag(self):
     mfd = EvenlyDiscretizedMFD(min_mag=0,
                                bin_width=1,
                                occurrence_rates=[1])
     self.assertEqual(mfd.get_annual_occurrence_rates(), [(0, 1)])
     self.assertEqual(mfd.get_min_mag(), 0)
Example #10
0
 def test_zero_rate(self):
     evenly_discretized = EvenlyDiscretizedMFD(
         min_mag=1, bin_width=2, occurrence_rates=[4, 0, 5]
     )
     self.assertEqual(evenly_discretized.get_annual_occurrence_rates(),
                      [(1, 4), (3, 0), (5, 5)])
Example #11
0
 def test_zero_min_mag(self):
     mfd = EvenlyDiscretizedMFD(min_mag=0, bin_width=1,
                                occurrence_rates=[1])
     self.assertEqual(mfd.get_annual_occurrence_rates(), [(0, 1)])
     self.assertEqual(mfd.get_min_mag(), 0)
Example #12
0
 def setUp(self):
     super(SeismicSourceGetAnnOccRatesTestCase, self).setUp()
     self.source.mfd = EvenlyDiscretizedMFD(min_mag=3,
                                            bin_width=1,
                                            occurrence_rates=[5, 0, 7, 0])