本文整理汇总了Python中openquake.hazardlib.geo.surface.complex_fault.ComplexFaultSurface类的典型用法代码示例。如果您正苦于以下问题:Python ComplexFaultSurface类的具体用法?Python ComplexFaultSurface怎么用?Python ComplexFaultSurface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ComplexFaultSurface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: modify_set_geometry
def modify_set_geometry(self, edges, spacing):
"""
Modifies the complex fault geometry
"""
ComplexFaultSurface.check_fault_data(edges, spacing)
self.edges = edges
self.rupture_mesh_spacing = spacing
示例2: __init__
def __init__(
self,
source_id,
name,
tectonic_region_type,
mfd,
rupture_mesh_spacing,
magnitude_scaling_relationship,
rupture_aspect_ratio,
temporal_occurrence_model,
# complex fault specific parameters
edges,
rake,
):
super(ComplexFaultSource, self).__init__(
source_id,
name,
tectonic_region_type,
mfd,
rupture_mesh_spacing,
magnitude_scaling_relationship,
rupture_aspect_ratio,
temporal_occurrence_model,
)
NodalPlane.check_rake(rake)
ComplexFaultSurface.check_fault_data(edges, rupture_mesh_spacing)
self.edges = edges
self.rake = rake
示例3: test_mesh_spacing_more_than_two_widthss
def test_mesh_spacing_more_than_two_widthss(self):
edge1 = Line([Point(0, 0, 0), Point(0, 0.2, 0)])
edge2 = Line([Point(0, 0, 10), Point(0, 0.2, 20)])
with self.assertRaises(ValueError) as ar:
ComplexFaultSurface.from_fault_data([edge1, edge2],
mesh_spacing=30.1)
self.assertEqual(
str(ar.exception),
'mesh spacing 30.1 km is too big for mean width 15.0 km'
)
示例4: test_invalid_surface_polygon_topo
def test_invalid_surface_polygon_topo(self):
# intermediate edge has opposite strike than top and bottom
edges = [Line([Point(0, 0, -5), Point(0, 2, -5)]),
Line([Point(0, 2, 5), Point(0, 0, 5)])]
with self.assertRaises(ValueError) as cm:
ComplexFaultSurface.from_fault_data(edges, mesh_spacing=1)
self.assertEqual(
'Edges points are not in the right order',
str(cm.exception)
)
示例5: test_invalid_surface_polygon_case2
def test_invalid_surface_polygon_case2(self):
# inclined complex fault with top and bottom edges inverted
edges = [Line([Point(0, 0), Point(0, 2)]),
Line([Point(0.2, 2, 10), Point(0.6, 0, 10)])]
with self.assertRaises(ValueError) as cm:
ComplexFaultSurface.from_fault_data(edges, mesh_spacing=10)
self.assertEqual(
'Edges points are not in the right order',
str(cm.exception)
)
示例6: test_dip_left_of_fault_strike_case1
def test_dip_left_of_fault_strike_case1(self):
# checks that an error is raised when fault surface dips left of
# fault strike (i.e. does not obey to Aki & Richards convention)
# simple case of planar surface with strike 0 (pointing towards
# north) but with surface dipping to the west
edges = [Line([Point(0, 0), Point(0, 1)]),
Line([Point(-1, 0, 10), Point(-1, 1, 10)])]
with self.assertRaises(ValueError) as cm:
ComplexFaultSurface.from_fault_data(edges, mesh_spacing=10)
self.assertEqual(
'Surface does not conform with Aki & Richards convention',
str(cm.exception)
)
示例7: test_2
def test_2(self):
# this is a regression test. Reference values have been obtained
# by extracting mesh from complex surface.
edge1 = Line([Point(0, 0, 1), Point(0, 0.02, 1)])
edge2 = Line([Point(0.02, 0, 1.5), Point(0.02, 0.01, 1.5)])
edge3 = Line([Point(0, 0, 2), Point(0, 0.02, 2)])
surface = ComplexFaultSurface.from_fault_data([edge1, edge2, edge3],
mesh_spacing=1)
self.assert_mesh_is(surface=surface, expected_mesh=[
[(0.0, 0.0, 1.0),
(0.0, 0.01, 1.0),
(0.0, 0.02, 1.0)],
[(0.008, 0.0, 1.2),
(0.008, 0.008, 1.2),
(0.008, 0.016, 1.2)],
[(0.016, 0.0, 1.4),
(0.016, 0.006, 1.4),
(0.016, 0.012, 1.4)],
[(0.016, 0.0, 1.6),
(0.016, 0.006, 1.6),
(0.016, 0.012, 1.6)],
[(0.008, 0, 1.8),
(0.008, 0.008, 1.8),
(0.008, 0.016, 1.8)],
[(0.0, 0.0, 2.0),
(0.0, 0.01, 2.0),
(0.0, 0.02, 2.0)],
])
示例8: test_2
def test_2(self):
edge1 = Line([Point(0, 0, 1), Point(0, 0.02, 1)])
edge2 = Line([Point(0.02, 0, 0.5), Point(0.02, 0.01, 0.5)])
edge3 = Line([Point(0, 0, 2), Point(0, 0.02, 2)])
surface = ComplexFaultSurface.from_fault_data([edge1, edge2, edge3],
mesh_spacing=1)
self.assert_mesh_is(surface=surface, expected_mesh=[
[(0.00000000e+00, 0.00000000e+00, 1.00000000e+00),
(0.00000000e+00, 1.00000000e-02, 1.00000000e+00),
(0.00000000e+00, 2.00000000e-02, 1.00000000e+00)],
[(8.70732572e-03, 5.33152318e-19, 7.82316857e-01),
(8.67044753e-03, 7.83238825e-03, 7.83238813e-01),
(8.57984833e-03, 1.57100762e-02, 7.85503798e-01)],
[(1.74146514e-02, 1.06630462e-18, 5.64633714e-01),
(1.73408950e-02, 5.66477632e-03, 5.66477626e-01),
(1.71596963e-02, 1.14201520e-02, 5.71007595e-01)],
[(1.47979150e-02, 3.18525318e-19, 8.90156376e-01),
(1.48515919e-02, 6.28710212e-03, 8.86130608e-01),
(1.49871315e-02, 1.25064345e-02, 8.75965152e-01)],
[(7.39895749e-03, 7.71565830e-19, 1.44507819e+00),
(7.42579599e-03, 8.14355113e-03, 1.44306530e+00),
(7.49356586e-03, 1.62532174e-02, 1.43798258e+00)],
[(0.00000000e+00, 0.00000000e+00, 2.00000000e+00),
(0.00000000e+00, 1.00000000e-02, 2.00000000e+00),
(0.00000000e+00, 2.00000000e-02, 2.00000000e+00)],
])
示例9: test
def test(self):
edges = [Line([Point(-3.4, 5.5, 0), Point(-3.9, 5.3, 0)]),
Line([Point(-2.4, 4.6, 10), Point(-3.6, 4.9, 20)])]
polygon = ComplexFaultSurface.surface_projection_from_fault_data(edges)
elons = [-2.4, -3.6, -3.9, -3.4]
elats = [4.6, 4.9, 5.3, 5.5]
numpy.testing.assert_allclose(polygon.lons, elons)
numpy.testing.assert_allclose(polygon.lats, elats)
示例10: test_surface_crossing_international_date_line
def test_surface_crossing_international_date_line(self):
edge1 = Line([Point(179.95, 0., 0.), Point(-179.95, 0., 0.)])
edge2 = Line([Point(179.95, 0., 10.), Point(-179.95, 0., 10.)])
surface = ComplexFaultSurface.from_fault_data([edge1, edge2],
mesh_spacing=10.)
self.assert_mesh_is(surface=surface, expected_mesh=[
[(179.95, 0., 0.), (-179.95, 0., 0.)],
[(179.95, 0., 10.), (-179.95, 0., 10.)]
])
示例11: test_dip_left_of_fault_strike_topo
def test_dip_left_of_fault_strike_topo(self):
# when the fault is above sea level
edges = [
Line([
Point(0, 1, -1),
Point(0, 0, -1)
]),
Line([
Point(1, 1, 0),
Point(1, 0, 0)]
)]
with self.assertRaises(ValueError) as cm:
ComplexFaultSurface.from_fault_data(edges, mesh_spacing=1)
self.assertEqual(
'Surface does not conform with Aki & Richards convention',
str(cm.exception)
)
示例12: test_surface_with_variable_width
def test_surface_with_variable_width(self):
edges = [Line([Point(0.1, 0.1, 0),
Point(0.459729190252, 0.0999980290582, 0.0),
Point(0.819458380482, 0.0999960581553, 0.0)]),
Line([Point(0.1, 0.1, 20.0),
Point(0.459729190252, 0.0999980290582, 20.0),
Point(0.819458380482, 0.0999960581553, 43.0940107676)])]
surface = ComplexFaultSurface.from_fault_data(edges, mesh_spacing=5.0)
self.assertAlmostEqual(surface.get_width(), 26.0, places=0)
示例13: test_dip_90_self_intersection
def test_dip_90_self_intersection(self):
edges = [Line([Point(1, -2, 10), Point(2, -1.9, 10),
Point(3, -2.1, 10), Point(4, -2, 10)]),
Line([Point(1, -2, 20), Point(2, -1.9, 20),
Point(3, -2.1, 20), Point(4, -2, 20)])]
polygon = ComplexFaultSurface.surface_projection_from_fault_data(edges)
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)
示例14: test_dip_90_two_points
def test_dip_90_two_points(self):
edges = [Line([Point(2, 2, 10), Point(1, 1, 10)]),
Line([Point(2, 2, 20), Point(1, 1, 20)])]
polygon = ComplexFaultSurface.surface_projection_from_fault_data(edges)
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)
示例15: test_dip_90_three_points
def test_dip_90_three_points(self):
edges = [Line([Point(1, -20, 30), Point(1, -20.2, 30),
Point(2, -19.7, 30)]),
Line([Point(1, -20, 50), Point(1, -20.2, 50),
Point(2, -19.7, 50)])]
polygon = ComplexFaultSurface.surface_projection_from_fault_data(edges)
elons = [1, 1, 2]
elats = [-20.2, -20., -19.7]
numpy.testing.assert_allclose(polygon.lons, elons)
numpy.testing.assert_allclose(polygon.lats, elats)