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


Python RectangularMesh._get_bounding_mesh方法代码示例

本文整理汇总了Python中nhlib.geo.mesh.RectangularMesh._get_bounding_mesh方法的典型用法代码示例。如果您正苦于以下问题:Python RectangularMesh._get_bounding_mesh方法的具体用法?Python RectangularMesh._get_bounding_mesh怎么用?Python RectangularMesh._get_bounding_mesh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nhlib.geo.mesh.RectangularMesh的用法示例。


在下文中一共展示了RectangularMesh._get_bounding_mesh方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_rectangular

# 需要导入模块: from nhlib.geo.mesh import RectangularMesh [as 别名]
# 或者: from nhlib.geo.mesh.RectangularMesh import _get_bounding_mesh [as 别名]
    def test_rectangular(self):
        lons = numpy.array(range(100)).reshape((10, 10))
        lats = numpy.negative(lons)

        mesh = RectangularMesh(lons, lats, depths=None)
        bounding_mesh = mesh._get_bounding_mesh()
        expected_lons = numpy.array([
            0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
            19, 29, 39, 49, 59, 69, 79, 89,
            99, 98, 97, 96, 95, 94, 93, 92, 91,
            90, 80, 70, 60, 50, 40, 30, 20, 10
        ])
        expected_lats = numpy.negative(expected_lons)
        self.assertTrue((bounding_mesh.lons == expected_lons).all())
        self.assertTrue((bounding_mesh.lats == expected_lats).all())
        self.assertIsNone(bounding_mesh.depths)

        depths = lons + 10
        mesh = RectangularMesh(lons, lats, depths)
        expected_depths = expected_lons + 10
        bounding_mesh = mesh._get_bounding_mesh()
        self.assertIsNotNone(bounding_mesh.depths)
        self.assertTrue((bounding_mesh.depths
                         == expected_depths.flatten()).all())

        bounding_mesh = mesh._get_bounding_mesh(with_depths=False)
        self.assertIsNone(bounding_mesh.depths)
开发者ID:pslh,项目名称:nhlib,代码行数:29,代码来源:mesh_test.py

示例2: test_single_column

# 需要导入模块: from nhlib.geo.mesh import RectangularMesh [as 别名]
# 或者: from nhlib.geo.mesh.RectangularMesh import _get_bounding_mesh [as 别名]
    def test_single_column(self):
        lons = numpy.array([[0], [1], [2], [3], [4], [5]])
        lats = numpy.array([[-1], [-2], [-3], [-4], [-5], [-6]])
        mesh = RectangularMesh(lons, lats, depths=None)
        bounding_mesh = mesh._get_bounding_mesh()
        self.assertTrue((bounding_mesh.lons == lons.flatten()).all())
        self.assertTrue((bounding_mesh.lats == lats.flatten()).all())
        self.assertIsNone(bounding_mesh.depths)

        depths = numpy.array([[10], [11], [12], [13], [14], [15]])
        mesh = RectangularMesh(lons, lats, depths)
        bounding_mesh = mesh._get_bounding_mesh()
        self.assertIsNotNone(bounding_mesh.depths)
        self.assertTrue((bounding_mesh.depths == depths.flatten()).all())

        bounding_mesh = mesh._get_bounding_mesh(with_depths=False)
        self.assertIsNone(bounding_mesh.depths)
开发者ID:pslh,项目名称:nhlib,代码行数:19,代码来源:mesh_test.py

示例3: test_single_row

# 需要导入模块: from nhlib.geo.mesh import RectangularMesh [as 别名]
# 或者: from nhlib.geo.mesh.RectangularMesh import _get_bounding_mesh [as 别名]
    def test_single_row(self):
        lons = numpy.array([[0, 1, 2, 3, 4, 5]])
        lats = numpy.array([[-1, -2, -3, -4, -5, -6]])
        mesh = RectangularMesh(lons, lats, depths=None)
        bounding_mesh = mesh._get_bounding_mesh()
        self.assertIsInstance(bounding_mesh, Mesh)
        self.assertTrue((bounding_mesh.lons == lons[0]).all())
        self.assertTrue((bounding_mesh.lats == lats[0]).all())
        self.assertIsNone(bounding_mesh.depths)

        depths = numpy.array([[10, 11, 12, 13, 14, 15]])
        mesh = RectangularMesh(lons, lats, depths)
        bounding_mesh = mesh._get_bounding_mesh()
        self.assertIsNotNone(bounding_mesh.depths)
        self.assertTrue((bounding_mesh.depths == depths[0]).all())

        bounding_mesh = mesh._get_bounding_mesh(with_depths=False)
        self.assertIsNone(bounding_mesh.depths)
开发者ID:pslh,项目名称:nhlib,代码行数:20,代码来源:mesh_test.py


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