當前位置: 首頁>>代碼示例>>Python>>正文


Python EclGridGenerator.extract_subgrid_data方法代碼示例

本文整理匯總了Python中ecl.grid.EclGridGenerator.extract_subgrid_data方法的典型用法代碼示例。如果您正苦於以下問題:Python EclGridGenerator.extract_subgrid_data方法的具體用法?Python EclGridGenerator.extract_subgrid_data怎麽用?Python EclGridGenerator.extract_subgrid_data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ecl.grid.EclGridGenerator的用法示例。


在下文中一共展示了EclGridGenerator.extract_subgrid_data方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_extract_grid_slice_spec

# 需要導入模塊: from ecl.grid import EclGridGenerator [as 別名]
# 或者: from ecl.grid.EclGridGenerator import extract_subgrid_data [as 別名]
    def test_extract_grid_slice_spec(self):
        dims = (4,4,4)
        zcorn = list(GridGen.create_zcorn(dims, (1,1,1), offset=0))
        coord = list(GridGen.create_coord(dims, (1,1,1)))

        ijk_bounds = generate_ijk_bounds(dims)
        for ijk in ijk_bounds:
            ijk = list(ijk)
            for i in range(3):
                if len(set(ijk[i])) == 1:
                    ijk[i] = ijk[i][0]

            GridGen.extract_subgrid_data(dims,
                                 coord, zcorn,
                                 ijk,
                                 decomposition_change=True)
開發者ID:OPM,項目名稱:ResInsight,代碼行數:18,代碼來源:test_grid_generator.py

示例2: test_translation

# 需要導入模塊: from ecl.grid import EclGridGenerator [as 別名]
# 或者: from ecl.grid.EclGridGenerator import extract_subgrid_data [as 別名]
    def test_translation(self):
        dims = (3,3,3)

        coord = GridGen.create_coord(dims, (1,1,1))
        zcorn = GridGen.create_zcorn(dims, (1,1,1), offset=0)
        grid = EclGrid.create(dims, zcorn, coord, None)

        ijk_bound = [(0, d-1) for d in dims]
        translation = (1, 2, 3)
        sub_coord, sub_zcorn, _ = GridGen.extract_subgrid_data(
                                                        dims,
                                                        coord,
                                                        zcorn,
                                                        ijk_bound,
                                                        translation=translation
                                                       )

        tgrid = EclGrid.create(dims, sub_zcorn, sub_coord, None)
        self.assertEqual(grid.getGlobalSize(), tgrid.getGlobalSize())

        for gi in range(grid.getGlobalSize()):
            translation = numpy.array(translation)
            corners = [grid.getCellCorner(i, gi) for i in range(8)]
            corners = [tuple(numpy.array(c)+translation) for c in corners]

            tcorners = [tgrid.getCellCorner(i, gi) for i in range(8)]

            self.assertEqual(corners, tcorners)
開發者ID:OPM,項目名稱:ResInsight,代碼行數:30,代碼來源:test_grid_generator.py

示例3: test_actnum_extraction

# 需要導入模塊: from ecl.grid import EclGridGenerator [as 別名]
# 或者: from ecl.grid.EclGridGenerator import extract_subgrid_data [as 別名]
    def test_actnum_extraction(self):
        dims = (4,4,4)

        coord = GridGen.create_coord(dims, (1,1,1))
        zcorn = GridGen.create_zcorn(dims, (1,1,1), offset=0)

        actnum = EclKW("ACTNUM", six.functools.reduce(operator.mul, dims),
                       EclDataType.ECL_INT)
        random.seed(1337)
        for i in range(len(actnum)):
            actnum[i] = random.randint(0, 1)

        grid = EclGrid.create(dims, zcorn, coord, actnum)

        ijk_bounds = generate_ijk_bounds(dims)
        for ijk_bound in ijk_bounds:
            if not decomposition_preserving(ijk_bound):
                continue

            sub = GridGen.extract_subgrid_data(
                                         dims,
                                         coord,
                                         zcorn,
                                         ijk_bound,
                                         actnum=actnum
                                       )

            sub_coord, sub_zcorn, sub_actnum = sub
            sub_dims = tuple([u-l+1 for l, u in ijk_bound])
            subgrid = EclGrid.create(sub_dims, sub_zcorn, sub_coord, sub_actnum)
            self.assertEqual(sub_dims, subgrid.getDims()[:-1:])
            self.assertSubgrid(grid, subgrid, ijk_bound)
開發者ID:OPM,項目名稱:ResInsight,代碼行數:34,代碼來源:test_grid_generator.py

示例4: test_extract_grid_invalid_bounds

# 需要導入模塊: from ecl.grid import EclGridGenerator [as 別名]
# 或者: from ecl.grid.EclGridGenerator import extract_subgrid_data [as 別名]
    def test_extract_grid_invalid_bounds(self):
        dims = (3,3,3)
        zcorn = list(GridGen.create_zcorn(dims, (1,1,1), offset=0))
        coord = list(GridGen.create_coord(dims, (1,1,1)))

        with self.assertRaises(ValueError):
            GridGen.extract_subgrid_data(dims, coord, zcorn, ((-1,0), (2,2), (2,2)))

        with self.assertRaises(ValueError):
            GridGen.extract_subgrid_data(dims, coord, zcorn, ((1,6), (2,2), (2,2)))

        with self.assertRaises(ValueError):
            GridGen.extract_subgrid_data(dims, coord, zcorn, ((1,2), (2,0), (2,2)))
開發者ID:OPM,項目名稱:ResInsight,代碼行數:15,代碼來源:test_grid_generator.py

示例5: test_validate_cells

# 需要導入模塊: from ecl.grid import EclGridGenerator [as 別名]
# 或者: from ecl.grid.EclGridGenerator import extract_subgrid_data [as 別名]
    def test_validate_cells(self):
        for coord, zcorn, grid in self.test_base:
            grid_dims = grid.getDims()[:-1:]
            ijk_bounds = generate_ijk_bounds(grid_dims)
            for ijk_bound in ijk_bounds:
                if not decomposition_preserving(ijk_bound):
                    continue

                sub_dims = tuple([u-l+1 for l, u in ijk_bound])
                sub_coord, sub_zcorn, _ = GridGen.extract_subgrid_data(
                                                    grid_dims,
                                                    coord,
                                                    zcorn,
                                                    ijk_bound
                                                    )

                subgrid = EclGrid.create(sub_dims, sub_zcorn, sub_coord, None)
                self.assertEqual(sub_dims, subgrid.getDims()[:-1:])
                self.assertSubgrid(grid, subgrid, ijk_bound)
開發者ID:OPM,項目名稱:ResInsight,代碼行數:21,代碼來源:test_grid_generator.py

示例6: test_extract_grid_decomposition_change

# 需要導入模塊: from ecl.grid import EclGridGenerator [as 別名]
# 或者: from ecl.grid.EclGridGenerator import extract_subgrid_data [as 別名]
    def test_extract_grid_decomposition_change(self):
        dims = (4,4,4)
        zcorn = list(GridGen.create_zcorn(dims, (1,1,1), offset=0))
        coord = list(GridGen.create_coord(dims, (1,1,1)))

        ijk_bounds = generate_ijk_bounds(dims)
        for ijk_bounds in ijk_bounds:
            if decomposition_preserving(ijk_bounds):
                GridGen.extract_subgrid_data(dims, coord, zcorn, ijk_bounds)
            else:
                with self.assertRaises(ValueError):
                    GridGen.extract_subgrid_data(dims, coord, zcorn, ijk_bounds)

            GridGen.extract_subgrid_data(dims,
                                 coord, zcorn,
                                 ijk_bounds,
                                 decomposition_change=True)
開發者ID:OPM,項目名稱:ResInsight,代碼行數:19,代碼來源:test_grid_generator.py


注:本文中的ecl.grid.EclGridGenerator.extract_subgrid_data方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。