本文整理汇总了Python中ecl.grid.EclGridGenerator.extract_subgrid方法的典型用法代码示例。如果您正苦于以下问题:Python EclGridGenerator.extract_subgrid方法的具体用法?Python EclGridGenerator.extract_subgrid怎么用?Python EclGridGenerator.extract_subgrid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ecl.grid.EclGridGenerator
的用法示例。
在下文中一共展示了EclGridGenerator.extract_subgrid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_subgrid_translation
# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import extract_subgrid [as 别名]
def test_subgrid_translation(self):
grid = GridGen.create_grid((4,4,4), (1,1,1), offset=0.5,
irregular=True, irregular_offset=True, concave=True,
translation=(10,10,0))
# Create grid with MAPAXES
mapaxes = EclKW("MAPAXES", 6, EclDataType.ECL_FLOAT)
for i, val in enumerate([1200, 1400, 2500, 2500, 3700, 4000]):
mapaxes[i] = val
grid = EclGrid.create(
grid.getDims(),
grid.export_zcorn(),
grid.export_coord(),
None,
mapaxes=mapaxes
)
for translation in [
(0,0,0),
(10, 10, 100),
(-1, -1, -1)
]:
subgrid = GridGen.extract_subgrid(
grid,
((0,3), (0,3), (0,3)),
translation=translation
)
self.assertEqual(grid.getDims(), subgrid.getDims())
translation = numpy.array(translation)
for gindex in range(grid.getGlobalSize()):
grid_corners = [
grid.getCellCorner(i, global_index=gindex)
for i in range(8)
]
subgrid_corners = [
subgrid.getCellCorner(i, global_index=gindex)
for i in range(8)
]
subgrid_corners = [
list(numpy.array(corner) - translation)
for corner in subgrid_corners
]
for gc, sc in zip(grid_corners, subgrid_corners):
self.assertAlmostEqualList(
gc,
sc,
msg="Failed to translate corners correctly." +
"Expected %s, was %s." % (gc, sc),
tolerance=10e-10
)
示例2: test_subgrid_extration
# 需要导入模块: from ecl.grid import EclGridGenerator [as 别名]
# 或者: from ecl.grid.EclGridGenerator import extract_subgrid [as 别名]
def test_subgrid_extration(self):
for _, _, grid in self.test_base[:-1:]:
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])
subgrid = GridGen.extract_subgrid(grid, ijk_bound)
self.assertEqual(sub_dims, subgrid.getDims()[:-1:])
self.assertSubgrid(grid, subgrid, ijk_bound)