本文整理汇总了Python中ecl.grid.EclGrid.find_cell方法的典型用法代码示例。如果您正苦于以下问题:Python EclGrid.find_cell方法的具体用法?Python EclGrid.find_cell怎么用?Python EclGrid.find_cell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ecl.grid.EclGrid
的用法示例。
在下文中一共展示了EclGrid.find_cell方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cell_containment
# 需要导入模块: from ecl.grid import EclGrid [as 别名]
# 或者: from ecl.grid.EclGrid import find_cell [as 别名]
def test_cell_containment(self):
grid_location = "local/ECLIPSE/faarikaal/faarikaal%d.EGRID"
well_location = "local/ECLIPSE/faarikaal/faarikaal%d.txt"
for i in range(1, 8):
grid_file = self.createTestPath(grid_location % i)
well_file = self.createTestPath(well_location % i)
grid = EclGrid(grid_file)
# Load well data
with open(well_file, "r") as f:
lines = [line.split() for line in f.readlines()]
points = [map(float, line[:3:]) for line in lines]
exp_cells = [tuple(map(int, line[3::])) for line in lines]
msg = "Expected point %s to be in cell %s, was in %s."
for point, exp_cell in zip(points, exp_cells):
reported_cell = grid.find_cell(*point)
self.assertEqual(
exp_cell,
reported_cell,
msg % (str(point), str(exp_cell), str(reported_cell))
)