当前位置: 首页>>代码示例>>Python>>正文


Python SiteCollection.from_points方法代码示例

本文整理汇总了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)
开发者ID:digitalsatori,项目名称:oq-engine,代码行数:35,代码来源:site_test.py

示例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)
开发者ID:amirj700,项目名称:oq-hazardlib,代码行数:33,代码来源:site_test.py

示例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)
开发者ID:treviallen,项目名称:oq-hazardlib,代码行数:11,代码来源:site_test.py

示例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)
开发者ID:treviallen,项目名称:oq-hazardlib,代码行数:13,代码来源:site_test.py

示例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)
开发者ID:digitalsatori,项目名称:oq-engine,代码行数:6,代码来源:site_test.py


注:本文中的openquake.hazardlib.site.SiteCollection.from_points方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。