當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。