Example #1
0
 def test_dip_90_self_intersection(self):
     polygon = SimpleFaultSurface.surface_projection_from_fault_data(
         Line([Point(1, -2), Point(2, -1.9), Point(3, -2.1), Point(4, -2)]),
         dip=90,
         upper_seismogenic_depth=10, lower_seismogenic_depth=20,
     )
     elons = [3., 1., 2., 4.]
     elats = [-2.1, -2., -1.9, -2.]
     numpy.testing.assert_allclose(polygon.lons, elons)
     numpy.testing.assert_allclose(polygon.lats, elats)
Example #2
0
 def test_dip_90_three_points(self):
     polygon = SimpleFaultSurface.surface_projection_from_fault_data(
         Line([Point(1, -20), Point(1, -20.2), Point(2, -19.7)]),
         dip=90,
         upper_seismogenic_depth=30, lower_seismogenic_depth=50,
     )
     elons = [1, 1, 2]
     elats = [-20.2, -20., -19.7]
     numpy.testing.assert_allclose(polygon.lons, elons)
     numpy.testing.assert_allclose(polygon.lats, elats)
Example #3
0
 def test_dip_90_two_points(self):
     polygon = SimpleFaultSurface.surface_projection_from_fault_data(
         Line([Point(2, 2), Point(1, 1)]),
         dip=90,
         upper_seismogenic_depth=10, lower_seismogenic_depth=20,
     )
     elons = [1.00003181, 0.99996821, 0.99996819, 1.99996819, 2.00003182,
              2.00003181]
     elats = [0.99996822, 0.99996819, 1.00003178, 2.0000318, 2.0000318,
              1.9999682]
     numpy.testing.assert_allclose(polygon.lons, elons)
     numpy.testing.assert_allclose(polygon.lats, elats)
Example #4
0
 def test_three_points(self):
     polygon = SimpleFaultSurface.surface_projection_from_fault_data(
         Line([Point(10, -20), Point(11, -20.2), Point(12, -19.7)]),
         dip=30,
         upper_seismogenic_depth=25.3, lower_seismogenic_depth=53.6,
     )
     elons = [11.13560807, 10.1354272, 10.06374285, 12.06361991,
              12.13515987]
     elats = [-21.02520738, -20.82520794, -20.3895235, -20.08952368,
              -20.52520878]
     numpy.testing.assert_allclose(polygon.lons, elons)
     numpy.testing.assert_allclose(polygon.lats, elats)
Example #5
0
 def test_dip_90_three_points(self):
     polygon = SimpleFaultSurface.surface_projection_from_fault_data(
         Line([Point(1, -20),
               Point(1, -20.2),
               Point(2, -19.7)]),
         dip=90,
         upper_seismogenic_depth=30,
         lower_seismogenic_depth=50,
     )
     elons = [1, 1, 2]
     elats = [-20.2, -20., -19.7]
     numpy.testing.assert_allclose(polygon.lons, elons)
     numpy.testing.assert_allclose(polygon.lats, elats)
Example #6
0
 def test_dip_90_self_intersection(self):
     polygon = SimpleFaultSurface.surface_projection_from_fault_data(
         Line([Point(1, -2),
               Point(2, -1.9),
               Point(3, -2.1),
               Point(4, -2)]),
         dip=90,
         upper_seismogenic_depth=10,
         lower_seismogenic_depth=20,
     )
     elons = [3., 1., 2., 4.]
     elats = [-2.1, -2., -1.9, -2.]
     numpy.testing.assert_allclose(polygon.lons, elons)
     numpy.testing.assert_allclose(polygon.lats, elats)
Example #7
0
 def test_dip_90_two_points(self):
     polygon = SimpleFaultSurface.surface_projection_from_fault_data(
         Line([Point(2, 2), Point(1, 1)]),
         dip=90,
         upper_seismogenic_depth=10,
         lower_seismogenic_depth=20,
     )
     elons = [
         1.00003181, 0.99996821, 0.99996819, 1.99996819, 2.00003182,
         2.00003181
     ]
     elats = [
         0.99996822, 0.99996819, 1.00003178, 2.0000318, 2.0000318, 1.9999682
     ]
     numpy.testing.assert_allclose(polygon.lons, elons)
     numpy.testing.assert_allclose(polygon.lats, elats)
Example #8
0
 def test_three_points(self):
     polygon = SimpleFaultSurface.surface_projection_from_fault_data(
         Line([Point(10, -20),
               Point(11, -20.2),
               Point(12, -19.7)]),
         dip=30,
         upper_seismogenic_depth=25.3,
         lower_seismogenic_depth=53.6,
     )
     elons = [
         11.13560807, 10.1354272, 10.06374285, 12.06361991, 12.13515987
     ]
     elats = [
         -21.02520738, -20.82520794, -20.3895235, -20.08952368, -20.52520878
     ]
     numpy.testing.assert_allclose(polygon.lons, elons)
     numpy.testing.assert_allclose(polygon.lats, elats)
Example #9
0
    def get_rupture_enclosing_polygon(self, dilation=0):
        """
        Uses :meth:`nhlib.geo.surface.simple_fault.SimpleFaultSurface.surface_projection_from_fault_data`
        for getting the fault's surface projection and then calls
        its :meth:`~nhlib.geo.polygon.Polygon.dilate` method passing
        in ``dilation`` parameter.

        See :meth:`superclass method
        <nhlib.source.base.SeismicSource.get_rupture_enclosing_polygon>`
        for parameter and return value definition.
        """
        polygon = SimpleFaultSurface.surface_projection_from_fault_data(
            self.fault_trace, self.upper_seismogenic_depth,
            self.lower_seismogenic_depth, self.dip)
        if dilation:
            return polygon.dilate(dilation)
        else:
            return polygon
Example #10
0
    def get_rupture_enclosing_polygon(self, dilation=0):
        """
        Uses :meth:`nhlib.geo.surface.simple_fault.SimpleFaultSurface.surface_projection_from_fault_data`
        for getting the fault's surface projection and then calls
        its :meth:`~nhlib.geo.polygon.Polygon.dilate` method passing
        in ``dilation`` parameter.

        See :meth:`superclass method
        <nhlib.source.base.SeismicSource.get_rupture_enclosing_polygon>`
        for parameter and return value definition.
        """
        polygon = SimpleFaultSurface.surface_projection_from_fault_data(
            self.fault_trace, self.upper_seismogenic_depth,
            self.lower_seismogenic_depth, self.dip
        )
        if dilation:
            return polygon.dilate(dilation)
        else:
            return polygon