Ejemplo n.º 1
0
 def test_dpp_parameter_ss3case_site_b(self):
     site_b = Point(10.639652, 45.333116, 0.)
     self.pp = projection_pp(site_b, self.normal, self.dist_to_plane,
                             self.origin)
     pd, e, idx_nxtp = directp(self.p0, self.p1, self.p2, self.p3,
                               self.hypocentre, self.origin, self.pp)
     fs, rd, r_hyp = average_s_rad(site_b, self.hypocentre, self.origin,
                                   self.pp, self.normal, self.dist_to_plane,
                                   e, self.p0, self.p1, self.delta_slip)
     c_prime = isochone_ratio(e, rd, r_hyp)
     # The value used for this test is from the DPP author Dr. Chiou
     # for the case, ss3, pure strike slip.
     self.assertAlmostEqual(fs, 0.9982396, delta=0.1)
     self.assertAlmostEqual(rd, 50., delta=0.1)
     self.assertAlmostEqual(r_hyp, 50.99, delta=0.1)
     self.assertAlmostEqual(e, 10., delta=0.1)
     self.assertAlmostEqual(c_prime, 0.8688245, delta=0.1)
Ejemplo n.º 2
0
 def test_dpp_parameter_ss3case_site_b(self):
     site_b = Point(10.639652, 45.333116, 0.)
     self.pp = projection_pp(site_b, self.normal, self.dist_to_plane,
                             self.origin)
     pd, e, idx_nxtp = directp(self.p0, self.p1, self.p2, self.p3,
                               self.hypocentre, self.origin, self.pp)
     fs, rd, r_hyp = average_s_rad(site_b, self.hypocentre, self.origin,
                                   self.pp, self.normal, self.dist_to_plane,
                                   e, self.p0, self.p1, self.delta_slip)
     c_prime = isochone_ratio(e, rd, r_hyp)
     # The value used for this test is from the DPP author Dr. Chiou
     # for the case, ss3, pure strike slip.
     self.assertAlmostEqual(fs, 0.9982396, delta=0.1)
     self.assertAlmostEqual(rd, 50., delta=0.1)
     self.assertAlmostEqual(r_hyp, 50.99, delta=0.1)
     self.assertAlmostEqual(e, 10., delta=0.1)
     self.assertAlmostEqual(c_prime, 0.8688245, delta=0.1)
Ejemplo n.º 3
0
 def test_dpp_parameter_ss3case_site_a(self):
     site_a = Point(10., 44.57, 0.)
     self.pp = projection_pp(site_a, self.normal, self.dist_to_plane,
                             self.origin)
     pd, e, idx_nxtp = directp(self.p0, self.p1, self.p2, self.p3,
                               self.hypocentre, self.origin, self.pp)
     fs, rd, r_hyp = average_s_rad(site_a, self.hypocentre, self.origin,
                                   self.pp, self.normal, self.dist_to_plane,
                                   e, self.p0, self.p1, self.delta_slip)
     c_prime = isochone_ratio(e, rd, r_hyp)
     # The value used for this test is from the DPP author Dr. Chiou
     # for the case, ss3, pure strike slip
     self.assertAlmostEqual(fs, 0.9931506, delta=0.1)
     self.assertAlmostEqual(rd, 70.4828, delta=0.1)
     self.assertAlmostEqual(r_hyp, 85.5862, delta=0.1)
     self.assertAlmostEqual(e, 15.1034495, delta=0.1)
     self.assertAlmostEqual(idx_nxtp, 0., delta=0.1)
     self.assertAlmostEqual(c_prime, 4., delta=0.1)
Ejemplo n.º 4
0
 def test_dpp_parameter_ss3case_site_a(self):
     site_a = Point(10., 44.57, 0.)
     self.pp = projection_pp(site_a, self.normal, self.dist_to_plane,
                             self.origin)
     pd, e, idx_nxtp = directp(self.p0, self.p1, self.p2, self.p3,
                               self.hypocentre, self.origin, self.pp)
     fs, rd, r_hyp = average_s_rad(site_a, self.hypocentre, self.origin,
                                   self.pp, self.normal, self.dist_to_plane,
                                   e, self.p0, self.p1, self.delta_slip)
     c_prime = isochone_ratio(e, rd, r_hyp)
     # The value used for this test is from the DPP author Dr. Chiou
     # for the case, ss3, pure strike slip
     self.assertAlmostEqual(fs, 0.9931506, delta=0.1)
     self.assertAlmostEqual(rd, 70.4828, delta=0.1)
     self.assertAlmostEqual(r_hyp, 85.5862, delta=0.1)
     self.assertAlmostEqual(e, 15.1034495, delta=0.1)
     self.assertAlmostEqual(idx_nxtp, 0., delta=0.1)
     self.assertAlmostEqual(c_prime, 4., delta=0.1)
Ejemplo n.º 5
0
    def get_dppvalue(self, site):
        """
        Get the directivity prediction value, DPP at
        a given site as described in Spudich et al. (2013).

        :param site:
            :class:`~openquake.hazardlib.geo.point.Point` object
            representing the location of the target site
        :returns:
            A float number, directivity prediction value (DPP).
        """

        origin = self.surface.get_resampled_top_edge()[0]
        dpp_multi = []
        index_patch = self.surface.hypocentre_patch_index(
            self.hypocenter, self.surface.get_resampled_top_edge(),
            self.surface.mesh.depths[0][0], self.surface.mesh.depths[-1][0],
            self.surface.get_dip())
        idx_nxtp = True
        hypocenter = self.hypocenter

        while idx_nxtp:

            # E Plane Calculation
            p0, p1, p2, p3 = self.surface.get_fault_patch_vertices(
                self.surface.get_resampled_top_edge(),
                self.surface.mesh.depths[0][0],
                self.surface.mesh.depths[-1][0],
                self.surface.get_dip(),
                index_patch=index_patch)

            [normal, dist_to_plane] = get_plane_equation(p0, p1, p2, origin)

            pp = projection_pp(site, normal, dist_to_plane, origin)
            pd, e, idx_nxtp = directp(p0, p1, p2, p3, hypocenter, origin, pp)
            pd_geo = origin.point_at((pd[0]**2 + pd[1]**2)**0.5, -pd[2],
                                     numpy.degrees(math.atan2(pd[0], pd[1])))

            # determine the lower bound of E path value
            f1 = geodetic_distance(p0.longitude, p0.latitude, p1.longitude,
                                   p1.latitude)
            f2 = geodetic_distance(p2.longitude, p2.latitude, p3.longitude,
                                   p3.latitude)

            if f1 > f2:
                f = f1
            else:
                f = f2

            fs, rd, r_hyp = average_s_rad(site, hypocenter, origin, pp, normal,
                                          dist_to_plane, e, p0, p1,
                                          self.rupture_slip_direction)
            cprime = isochone_ratio(e, rd, r_hyp)

            dpp_exp = cprime * numpy.maximum(e, 0.1 * f) *\
                numpy.maximum(fs, 0.2)
            dpp_multi.append(dpp_exp)

            # check if go through the next patch of the fault
            index_patch = index_patch + 1

            if (len(self.surface.get_resampled_top_edge()) <= 2) and (
                    index_patch >= len(self.surface.get_resampled_top_edge())):

                idx_nxtp = False
            elif index_patch >= len(self.surface.get_resampled_top_edge()):
                idx_nxtp = False
            elif idx_nxtp:
                hypocenter = pd_geo
                idx_nxtp = True

        # calculate DPP value of the site.
        dpp = numpy.log(numpy.sum(dpp_multi))

        return dpp
Ejemplo n.º 6
0
    def get_dppvalue(self, site):
        """
        Get the directivity prediction value, DPP at
        a given site as described in Spudich et al. (2013).

        :param site:
            :class:`~openquake.hazardlib.geo.point.Point` object
            representing the location of the target site
        :returns:
            A float number, directivity prediction value (DPP).
        """

        origin = self.surface.get_resampled_top_edge()[0]
        dpp_multi = []
        index_patch = self.surface.hypocentre_patch_index(
            self.hypocenter, self.surface.get_resampled_top_edge(),
            self.surface.mesh.depths[0][0], self.surface.mesh.depths[-1][0],
            self.surface.get_dip())
        idx_nxtp = True
        hypocenter = self.hypocenter

        while idx_nxtp:

            # E Plane Calculation
            p0, p1, p2, p3 = self.surface.get_fault_patch_vertices(
                self.surface.get_resampled_top_edge(),
                self.surface.mesh.depths[0][0],
                self.surface.mesh.depths[-1][0],
                self.surface.get_dip(), index_patch=index_patch)

            [normal, dist_to_plane] = get_plane_equation(
                p0, p1, p2, origin)

            pp = projection_pp(site, normal, dist_to_plane, origin)
            pd, e, idx_nxtp = directp(
                p0, p1, p2, p3, hypocenter, origin, pp)
            pd_geo = origin.point_at(
                (pd[0] ** 2 + pd[1] ** 2) ** 0.5, -pd[2],
                numpy.degrees(math.atan2(pd[0], pd[1])))

            # determine the lower bound of E path value
            f1 = geodetic_distance(p0.longitude,
                                   p0.latitude,
                                   p1.longitude,
                                   p1.latitude)
            f2 = geodetic_distance(p2.longitude,
                                   p2.latitude,
                                   p3.longitude,
                                   p3.latitude)

            if f1 > f2:
                f = f1
            else:
                f = f2

            fs, rd, r_hyp = average_s_rad(site, hypocenter, origin,
                                          pp, normal, dist_to_plane, e, p0,
                                          p1, self.rupture_slip_direction)
            cprime = isochone_ratio(e, rd, r_hyp)

            dpp_exp = cprime * numpy.maximum(e, 0.1 * f) *\
                numpy.maximum(fs, 0.2)
            dpp_multi.append(dpp_exp)

            # check if go through the next patch of the fault
            index_patch = index_patch + 1

            if (len(self.surface.get_resampled_top_edge())
                <= 2) and (index_patch >=
                           len(self.surface.get_resampled_top_edge())):

                idx_nxtp = False
            elif index_patch >= len(self.surface.get_resampled_top_edge()):
                idx_nxtp = False
            elif idx_nxtp:
                hypocenter = pd_geo
                idx_nxtp = True

        # calculate DPP value of the site.
        dpp = numpy.log(numpy.sum(dpp_multi))

        return dpp