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


Python EclGrid.getNX方法代码示例

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


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

示例1: test_EGRID

# 需要导入模块: from ecl.grid import EclGrid [as 别名]
# 或者: from ecl.grid.EclGrid import getNX [as 别名]
 def test_EGRID( self ):
     grid = EclGrid(self.egrid_file())
     self.assertTrue(grid)
     dims = grid.getDims()
     self.assertEqual(dims[0] , grid.getNX())
     self.assertEqual(dims[1] , grid.getNY())
     self.assertEqual(dims[2] , grid.getNZ())
开发者ID:,项目名称:,代码行数:9,代码来源:

示例2: test_corner

# 需要导入模块: from ecl.grid import EclGrid [as 别名]
# 或者: from ecl.grid.EclGrid import getNX [as 别名]
    def test_corner(self):
        grid = EclGrid(self.egrid_file())
        nx = grid.getNX()
        ny = grid.getNY()
        nz = grid.getNZ()

        (x1,y1,z1) = grid.getCellCorner( 0 , ijk = (0,0,0))
        (x2,y2,z2) = grid.getLayerXYZ( 0 , 0 )
        self.assertEqual(x1,x2)
        self.assertEqual(y1,y2)
        self.assertEqual(z1,z2)

        (x1,y1,z1) = grid.getCellCorner( 0 , ijk = (0,1,0))
        (x2,y2,z2) = grid.getLayerXYZ( (nx + 1) , 0 )
        self.assertEqual(x1,x2)
        self.assertEqual(y1,y2)
        self.assertEqual(z1,z2)

        (x1,y1,z1) = grid.getCellCorner( 1 , ijk = (nx - 1,0,0))
        (x2,y2,z2) = grid.getLayerXYZ( nx , 0 )
        self.assertEqual(x1,x2)
        self.assertEqual(y1,y2)
        self.assertEqual(z1,z2)

        (x1,y1,z1) = grid.getCellCorner( 4 , ijk = (0,0,nz-1))
        (x2,y2,z2) = grid.getLayerXYZ( 0 , nz )
        self.assertEqual(x1,x2)
        self.assertEqual(y1,y2)
        self.assertEqual(z1,z2)

        (x1,y1,z1) = grid.getCellCorner( 7 , ijk = (nx-1,ny-1,nz-1))
        (x2,y2,z2) = grid.getLayerXYZ( (nx + 1)*(ny + 1) - 1 , nz )
        self.assertEqual(x1,x2)
        self.assertEqual(y1,y2)
        self.assertEqual(z1,z2)



        with self.assertRaises(IndexError):
            grid.getLayerXYZ( -1 , 0 )

        with self.assertRaises(IndexError):
            grid.getLayerXYZ( (nx + 1)*(ny + 1) , 0 )

        with self.assertRaises(IndexError):
            grid.getLayerXYZ( 0 , -1 )

        with self.assertRaises(IndexError):
            grid.getLayerXYZ( 0 , nz + 1 )
开发者ID:,项目名称:,代码行数:51,代码来源:

示例3: RegionTest

# 需要导入模块: from ecl.grid import EclGrid [as 别名]
# 或者: from ecl.grid.EclGrid import getNX [as 别名]

#.........这里部分代码省略.........
        global_list = reg.getGlobalList()
        self.assertEqual(global_list.parent(), reg)

        for gi in global_list:
            (i, j, k) = self.grid.get_ijk(global_index=gi)
            if i > 5:
                OK = False
        self.assertTrue(OK)
        self.assertTrue(self.grid.getNY() * self.grid.getNZ() * 6 == len(reg.getGlobalList()))

        reg.select_jslice(7, 8, intersect=True)
        OK = True
        for gi in reg.getGlobalList():
            (i, j, k) = self.grid.get_ijk(global_index=gi)
            if i > 5:
                OK = False

            if j < 7 or j > 8:
                OK = False

        self.assertTrue(OK)
        self.assertTrue(2 * self.grid.getNZ() * 6 == len(reg.getGlobalList()))

        reg2 = EclRegion(self.grid, False)
        reg2.select_kslice(3, 5)
        reg &= reg2
        OK = True
        for gi in reg.getGlobalList():
            (i, j, k) = self.grid.get_ijk(global_index=gi)
            if i > 5:
                OK = False

            if j < 7 or j > 8:
                OK = False

            if k < 3 or k > 5:
                OK = False

        self.assertTrue(OK)
        self.assertTrue(2 * 3 * 6 == len(reg.getGlobalList()))



    def test_index_list(self):
        reg = EclRegion(self.grid, False)
        reg.select_islice(0, 5)
        active_list = reg.getActiveList()
        global_list = reg.getGlobalList()



    def test_polygon(self):
        reg = EclRegion(self.grid, False)
        (x,y,z) = self.grid.get_xyz( ijk=(10,10,0) )
        dx = 0.1
        dy = 0.1
        reg.select_inside_polygon( [(x-dx,y-dy) , (x-dx,y+dy) , (x+dx,y+dy) , (x+dx,y-dy)] )
        self.assertTrue( self.grid.getNZ() == len(reg.getGlobalList()))


    def test_heidrun(self):
        root = self.createTestPath("Statoil/ECLIPSE/Heidrun")
        grid = EclGrid( "%s/FF12_2013B2_AMAP_AOP-J15_NO62_MOVEX.EGRID" % root)

        polygon = []
        with open("%s/polygon.ply" % root) as fileH:
            for line in fileH.readlines():
                tmp = line.split()
                polygon.append( (float(tmp[0]) , float(tmp[1])))
        self.assertEqual( len(polygon) , 11 )

        reg = EclRegion( grid , False )
        reg.select_inside_polygon( polygon )
        self.assertEqual( 0 , len(reg.getGlobalList()) % grid.getNZ())


    def test_layer(self):
        region = EclRegion(self.grid, False)
        layer = Layer( self.grid.getNX() , self.grid.getNY() + 1)
        with self.assertRaises(ValueError):
            region.selectFromLayer( layer , 0 , 1 )

        layer = Layer( self.grid.getNX() , self.grid.getNY() )
        layer[0,0] = 1
        layer[1,1] = 1
        layer[2,2] = 1

        with self.assertRaises(ValueError):
            region.selectFromLayer( layer , -1 , 1 )

        with self.assertRaises(ValueError):
            region.selectFromLayer( layer , self.grid.getNZ() , 1 )

        region.selectFromLayer( layer , 0 , 2 )
        glist = region.getGlobalList()
        self.assertEqual(0 , len(glist))

        region.selectFromLayer( layer , 0 , 1 )
        glist = region.getGlobalList()
        self.assertEqual(3 , len(glist))
开发者ID:OPM,项目名称:ResInsight,代码行数:104,代码来源:test_region_statoil.py


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