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


Python EclGridGenerator.createRectangular方法代码示例

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


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

示例1: test_create

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
    def test_create(self):
        with self.assertRaises(ValueError):
            grid = GridGen.createRectangular( (10,20,30) , (1,1,1) , actnum = [0,1,1,2])

        with self.assertRaises(ValueError):
            grid = GridGen.createRectangular( (10,20,30) , (1,1,1) , actnum = IntVector(initial_size = 10))
        grid = GridGen.createRectangular( (10,20,30) , (1,1,1) ) # actnum=None -> all active
        self.assertEqual( grid.getNumActive( ) , 30*20*10)
        actnum = IntVector(default_value = 1 , initial_size = 6000)
        actnum[0] = 0
        actnum[1] = 0
        grid = GridGen.createRectangular( (10,20,30) , (1,1,1) , actnum = actnum)
        self.assertEqual( grid.getNumActive( ) , 30*20*10 - 2)
开发者ID:,项目名称:,代码行数:15,代码来源:

示例2: test_numpy3D

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
 def test_numpy3D(self):
     nx = 10
     ny = 7
     nz = 5
     grid = GridGen.createRectangular((nx,ny,nz) , (1,1,1))
     kw = EclKW( "SWAT" , nx*ny*nz , EclDataType.ECL_FLOAT )
     numpy_3d = grid.create3D( kw )
开发者ID:,项目名称:,代码行数:9,代码来源:

示例3: test_oom_grid

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
    def test_oom_grid(self):
        nx = 2000
        ny = 2000
        nz = 2000

        with self.assertRaises(MemoryError):
            grid = GridGen.createRectangular( (nx,ny,nz), (1,1,1))
开发者ID:,项目名称:,代码行数:9,代码来源:

示例4: test_output_units

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
    def test_output_units(self):
        n = 10
        a = 1
        grid = GridGen.createRectangular( (n,n,n), (a,a,a))

        with TestAreaContext("python/ecl_grid/units"):
            grid.save_EGRID( "CASE.EGRID" , output_unit = EclUnitTypeEnum.ECL_FIELD_UNITS )
            f = EclFile("CASE.EGRID")
            g = f["GRIDUNIT"][0]
            self.assertEqual( g[0].strip( ) , "FEET" )
            g2 = EclGrid("CASE.EGRID")
            self.assertFloatEqual( g2.cell_volume( global_index = 0 ) , 3.28084*3.28084*3.28084)


            grid.save_EGRID( "CASE.EGRID" )
            f = EclFile("CASE.EGRID")
            g = f["GRIDUNIT"][0]
            self.assertEqual( g[0].strip( ) , "METRES" )

            grid.save_EGRID( "CASE.EGRID" , output_unit = EclUnitTypeEnum.ECL_LAB_UNITS)
            f = EclFile("CASE.EGRID")
            g = f["GRIDUNIT"][0]
            self.assertEqual( g[0].strip() , "CM" )
            g2 = EclGrid("CASE.EGRID")
            self.assertFloatEqual( g2.cell_volume( global_index = 0 ) , 100*100*100 )
开发者ID:,项目名称:,代码行数:27,代码来源:

示例5: test_compressed_copy

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
 def test_compressed_copy(self):
     nx = 10
     ny = 10
     nz = 10
     grid = GridGen.createRectangular( (nx,ny,nz) , (1,1,1) )
     kw1 = EclKW("KW" , 1001 , EclDataType.ECL_INT )
     with self.assertRaises(ValueError):
         cp = grid.compressedKWCopy( kw1 )
开发者ID:,项目名称:,代码行数:10,代码来源:

示例6: test_dims

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
    def test_dims(self):
        grid = GridGen.createRectangular( (10,20,30) , (1,1,1) )
        self.assertEqual( grid.getNX() , 10 )
        self.assertEqual( grid.getNY() , 20 )
        self.assertEqual( grid.getNZ() , 30 )
        self.assertEqual( grid.getGlobalSize() , 30*10*20 )

        self.assertEqual( grid.getDims() , (10,20,30,6000) )
开发者ID:,项目名称:,代码行数:10,代码来源:

示例7: test_dxdydz

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
    def test_dxdydz(self):
        nx = 10
        ny = 10
        nz = 10
        grid = GridGen.createRectangular( (nx,ny,nz) , (2,3,4) )

        (dx,dy,dz) = grid.getCellDims( active_index = 0 )
        self.assertEqual( dx , 2 )
        self.assertEqual( dy , 3 )
        self.assertEqual( dz , 4 )
开发者ID:,项目名称:,代码行数:12,代码来源:

示例8: test_cell_corner_containment

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
    def test_cell_corner_containment(self):
        n = 4
        d = 10
        grid = GridGen.createRectangular( (n, n, n), (d, d, d))

        for x, y, z in itertools.product(range(0, n*d+1, d), repeat=3):
            self.assertEqual(
                    1,
                    [grid.cell_contains(x, y, z, i) for i in range(n**3)].count(True)
                    )
开发者ID:,项目名称:,代码行数:12,代码来源:

示例9: test_cell_corner_containment_compatability

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
    def test_cell_corner_containment_compatability(self):
        grid = GridGen.createRectangular( (3,3,3), (1,1,1) )

        for x, y, z in itertools.product(range(4), repeat=3):
            for i in range(27):
                if grid.cell_contains(x, y, z, i):
                    self.assertEqual(
                            CORNER_HOME[(x,y,z)],
                            i
                            )
开发者ID:,项目名称:,代码行数:12,代码来源:

示例10: test_truncated_file

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
    def test_truncated_file(self):
        grid = GridGen.createRectangular( (10,20,30) , (1,1,1) )
        with TestAreaContext("python/ecl_grid/truncated"):
            grid.save_EGRID( "TEST.EGRID")

            size = os.path.getsize( "TEST.EGRID")
            with open("TEST.EGRID" , "r+") as f:
                f.truncate( size / 2 )

            with self.assertRaises(IOError):
                EclGrid("TEST.EGRID")
开发者ID:,项目名称:,代码行数:13,代码来源:

示例11: test_posXY1

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
    def test_posXY1(self):
        nx = 4
        ny = 1
        nz = 1
        grid = GridGen.createRectangular( (nx,ny,nz) , (1,1,1) )
        (i,j) = grid.findCellXY( 0.5 , 0.5, 0 )
        self.assertEqual(i , 0)
        self.assertEqual(j , 0)

        (i,j) = grid.findCellXY( 3.5 , 0.5, 0 )
        self.assertEqual(i , 3)
        self.assertEqual(j , 0)
开发者ID:,项目名称:,代码行数:14,代码来源:

示例12: test_len

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
    def test_len(self):
        nx = 10
        ny = 11
        nz = 12
        actnum = EclKW( "ACTNUM" , nx*ny*nz , EclDataType.ECL_INT )
        actnum[0] = 1
        actnum[1] = 1
        actnum[2] = 1
        actnum[3] = 1

        grid = GridGen.createRectangular( (nx,ny,nz) , (1,1,1), actnum = actnum)
        self.assertEqual( len(grid) , nx*ny*nz )
        self.assertEqual( grid.getNumActive( ) , 4 )
开发者ID:,项目名称:,代码行数:15,代码来源:

示例13: test_node_pos

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
    def test_node_pos(self):
        grid = GridGen.createRectangular( (10,20,30) , (1,1,1) )
        with self.assertRaises(IndexError):
            grid.getNodePos(-1,0,0)

        with self.assertRaises(IndexError):
            grid.getNodePos(11,0,0)

        p0 = grid.getNodePos(0,0,0)
        self.assertEqual( p0 , (0,0,0))

        p7 = grid.getNodePos(10,20,30)
        self.assertEqual( p7 , (10,20,30))
开发者ID:,项目名称:,代码行数:15,代码来源:

示例14: test_cell_face_containment

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
    def test_cell_face_containment(self):
        n = 4
        d = 10
        grid = GridGen.createRectangular( (n, n, n), (d, d, d))

        for x, y, z in itertools.product(range(d//2, n*d, d), repeat=3):
            for axis, direction in itertools.product(range(3), [-1, 1]):
                p = [x, y, z]
                p[axis] = p[axis] + direction*d/2
                self.assertEqual(
                        1,
                        [grid.cell_contains(p[0], p[1], p[2], i) for i in range(n**3)].count(True)
                    )
开发者ID:,项目名称:,代码行数:15,代码来源:

示例15: test_repr_and_name

# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import createRectangular [as 别名]
 def test_repr_and_name(self):
     grid = GridGen.createRectangular((2,2,2), (10,10,10), actnum=[0,0,0,0,1,1,1,1])
     pfx = 'EclGrid('
     rep = repr(grid)
     self.assertEqual(pfx, rep[:len(pfx)])
     self.assertEqual(type(rep), type(''))
     self.assertEqual(type(grid.getName()), type(''))
     with TestAreaContext("python/ecl_grid/repr"):
         grid.save_EGRID("CASE.EGRID")
         g2 = EclGrid("CASE.EGRID")
         r2 = repr(g2)
         self.assertEqual(pfx, r2[:len(pfx)])
         self.assertEqual(type(r2), type(''))
         self.assertEqual(type(g2.getName()), type(''))
开发者ID:,项目名称:,代码行数:16,代码来源:


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