本文整理匯總了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)