本文整理汇总了Python中ecl.grid.EclGrid.get_ijk方法的典型用法代码示例。如果您正苦于以下问题:Python EclGrid.get_ijk方法的具体用法?Python EclGrid.get_ijk怎么用?Python EclGrid.get_ijk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ecl.grid.EclGrid
的用法示例。
在下文中一共展示了EclGrid.get_ijk方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RegionTest
# 需要导入模块: from ecl.grid import EclGrid [as 别名]
# 或者: from ecl.grid.EclGrid import get_ijk [as 别名]
class RegionTest(EclTest):
def setUp(self):
case = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE")
self.grid = EclGrid(case)
self.rst_file = EclFile("%s.UNRST" % case)
self.init_file = EclFile("%s.INIT" % case)
def test_kw_imul(self):
P = self.rst_file["PRESSURE"][5]
fipnum = self.init_file["FIPNUM"][0]
fipnum_copy = fipnum.deep_copy()
reg = EclRegion(self.grid, False)
reg.select_more(P, 260)
fipnum.mul(-1, mask=reg)
self.assertFalse(fipnum.equal(fipnum_copy))
fipnum.mul(-1, mask=reg)
self.assertTrue(fipnum.equal(fipnum_copy))
def test_equal(self):
reg1 = EclRegion(self.grid , False)
reg2 = EclRegion(self.grid , False)
self.assertTrue( reg1 == reg2 )
reg1.select_islice(4 , 6)
self.assertFalse( reg1 == reg2 )
reg2.select_islice(4,7)
self.assertFalse( reg1 == reg2 )
reg1.select_islice(7,7)
self.assertTrue( reg1 == reg2 )
def test_kw_idiv(self):
P = self.rst_file["PRESSURE"][5]
fipnum = self.init_file["FIPNUM"][0]
fipnum_copy = fipnum.deep_copy()
reg = EclRegion(self.grid, False)
reg.select_more(P, 260)
fipnum.div(-1, mask=reg)
self.assertFalse(fipnum.equal(fipnum_copy))
fipnum.div(-1, mask=reg)
self.assertTrue(fipnum.equal(fipnum_copy))
def test_kw_iadd(self):
P = self.rst_file["PRESSURE"][5]
fipnum = self.init_file["FIPNUM"][0]
fipnum_copy = fipnum.deep_copy()
reg = EclRegion(self.grid, False)
reg.select_more(P, 260)
fipnum.add(1, mask=reg)
self.assertFalse(fipnum.equal(fipnum_copy))
reg.invert()
fipnum.add(1, mask=reg)
fipnum.sub(1)
self.assertTrue(fipnum.equal(fipnum_copy))
def test_kw_isub(self):
P = self.rst_file["PRESSURE"][5]
fipnum = self.init_file["FIPNUM"][0]
fipnum_copy = fipnum.deep_copy()
reg = EclRegion(self.grid, False)
reg.select_more(P, 260)
fipnum.sub(1, mask=reg)
self.assertFalse(fipnum.equal(fipnum_copy))
fipnum.add(1, mask=reg)
self.assertTrue(fipnum.equal(fipnum_copy))
def test_slice(self):
reg = EclRegion(self.grid, False)
reg.select_islice(0, 5)
OK = True
global_list = reg.getGlobalList()
self.assertEqual(global_list.parent(), reg)
for gi in global_list:
(i, j, k) = self.grid.get_ijk(global_index=gi)
if i > 5:
OK = False
self.assertTrue(OK)
self.assertTrue(self.grid.getNY() * self.grid.getNZ() * 6 == len(reg.getGlobalList()))
reg.select_jslice(7, 8, intersect=True)
OK = True
for gi in reg.getGlobalList():
(i, j, k) = self.grid.get_ijk(global_index=gi)
if i > 5:
OK = False
#.........这里部分代码省略.........