本文整理汇总了Python中openquake.hazardlib.site.SiteCollection.from_points方法的典型用法代码示例。如果您正苦于以下问题:Python SiteCollection.from_points方法的具体用法?Python SiteCollection.from_points怎么用?Python SiteCollection.from_points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openquake.hazardlib.site.SiteCollection
的用法示例。
在下文中一共展示了SiteCollection.from_points方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_from_points
# 需要导入模块: from openquake.hazardlib.site import SiteCollection [as 别名]
# 或者: from openquake.hazardlib.site.SiteCollection import from_points [as 别名]
def test_from_points(self):
lons = [10, -1.2]
lats = [20, -3.4]
depths = [30, -5.6]
req_params = 'vs30 vs30measured z1pt0 z2pt5 backarc'.split()
cll = SiteCollection.from_points(
lons, lats, depths, SiteModelParam(), req_params)
assert_eq(cll.vs30, [1.2, 1.2])
assert_eq(cll.vs30measured, [True, True])
assert_eq(cll.z1pt0, [3.4, 3.4])
assert_eq(cll.z2pt5, [5.6, 5.6])
assert_eq(cll.mesh.lons, [10, -1.1999999999999886])
assert_eq(cll.mesh.lats, [20, -3.4])
assert_eq(cll.mesh.depths, [30, -5.6])
assert_eq(cll.backarc, [False, False])
for arr in (cll.vs30, cll.z1pt0, cll.z2pt5):
self.assertIsInstance(arr, numpy.ndarray)
self.assertEqual(arr.dtype, float)
for arr in (cll.vs30measured, cll.backarc):
self.assertIsInstance(arr, numpy.ndarray)
self.assertEqual(arr.dtype, bool)
self.assertEqual(len(cll), 2)
# test split_in_tiles
tiles = cll.split_in_tiles(0)
self.assertEqual(len(tiles), 1)
tiles = cll.split_in_tiles(1)
self.assertEqual(len(tiles), 1)
tiles = cll.split_in_tiles(2)
self.assertEqual(len(tiles), 2)
示例2: test_from_points
# 需要导入模块: from openquake.hazardlib.site import SiteCollection [as 别名]
# 或者: from openquake.hazardlib.site.SiteCollection import from_points [as 别名]
def test_from_points(self):
lons = [10, -1.2]
lats = [20, -3.4]
cll = SiteCollection.from_points(lons, lats, [1, 2], SiteModelParam())
assert_eq(cll.vs30, [1.2, 1.2])
assert_eq(cll.vs30measured, [True, True])
assert_eq(cll.z1pt0, [3.4, 3.4])
assert_eq(cll.z2pt5, [5.6, 5.6])
assert_eq(cll.mesh.lons, [10, -1.2])
assert_eq(cll.mesh.lats, [20, -3.4])
assert_eq(cll.mesh.depths, None)
assert_eq(cll.backarc, [False, False])
for arr in (cll.vs30, cll.z1pt0, cll.z2pt5):
self.assertIsInstance(arr, numpy.ndarray)
self.assertEqual(arr.dtype, float)
for arr in (cll.vs30measured, cll.backarc):
self.assertIsInstance(arr, numpy.ndarray)
self.assertEqual(arr.flags.writeable, False)
self.assertEqual(arr.dtype, bool)
self.assertEqual(len(cll), 2)
# test split_in_tiles
tiles = cll.split_in_tiles(0)
self.assertEqual(len(tiles), 1)
tiles = cll.split_in_tiles(1)
self.assertEqual(len(tiles), 1)
tiles = cll.split_in_tiles(2)
self.assertEqual(len(tiles), 2)
示例3: test_normal
# 需要导入模块: from openquake.hazardlib.site import SiteCollection [as 别名]
# 或者: from openquake.hazardlib.site.SiteCollection import from_points [as 别名]
def test_normal(self):
lons = [10, -1.2]
lats = [20, -3.4]
maximum_distance = {"Subduction IntraSlab": 200}
sitecol = SiteCollection.from_points(lons, lats, SiteModelParam())
tile = Tile(sitecol, maximum_distance)
self.assertEqual(repr(tile), "<Tile -1 <= lon <= 10, -3 <= lat <= 20>")
src = make_point_source(1, 10)
self.assertTrue(src in tile)
示例4: test_cross_idl
# 需要导入模块: from openquake.hazardlib.site import SiteCollection [as 别名]
# 或者: from openquake.hazardlib.site.SiteCollection import from_points [as 别名]
def test_cross_idl(self):
lons = [-179.2, 178.0]
lats = [3.0, 4.0]
maximum_distance = {"Subduction IntraSlab": 200}
sitecol = SiteCollection.from_points(lons, lats, SiteModelParam())
tile = Tile(sitecol, maximum_distance)
self.assertEqual(repr(tile), "<Tile 178 <= lon <= 180, 3 <= lat <= 4>")
src = make_point_source(-179.3, 3.5)
self.assertTrue(src in tile)
src = make_point_source(178.2, 3.5)
self.assertTrue(src in tile)
示例5: setUpClass
# 需要导入模块: from openquake.hazardlib.site import SiteCollection [as 别名]
# 或者: from openquake.hazardlib.site.SiteCollection import from_points [as 别名]
def setUpClass(cls):
lons = numpy.array([-180, -178, 179, 180, 180], numpy.float32)
lats = numpy.array([-27, -28, -26, -30, -28], numpy.float32)
cls.sites = SiteCollection.from_points(lons, lats)