本文整理汇总了Python中ert.ecl.EclRegion类的典型用法代码示例。如果您正苦于以下问题:Python EclRegion类的具体用法?Python EclRegion怎么用?Python EclRegion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EclRegion类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_polygon
def test_polygon(self):
reg = EclRegion(self.grid, False)
(x,y,z) = self.grid.get_xyz( ijk=(10,10,0) )
dx = 0.1
dy = 0.1
reg.select_inside_polygon( [(x-dx,y-dy) , (x-dx,y+dy) , (x+dx,y+dy) , (x+dx,y-dy)] )
self.assertTrue( self.grid.nz == len(reg.global_list))
示例2: test_ecl_region_name
def test_ecl_region_name(self):
grid = EclGrid.createRectangular((10,20,30) , (1,1,1) )
region = EclRegion( grid , False )
with self.assertRaises(DeprecationWarning):
region.name = "NAME"
with self.assertRaises(DeprecationWarning):
region.get_name( )
示例3: test_kw_isub
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))
示例4: setUp
def setUp(self):
self.grid = EclGrid.create_rectangular( (10,10,10) , (1,1,1) )
self.kw = EclKW.create( "FAULTBLK" , self.grid.size , EclTypeEnum.ECL_INT_TYPE )
self.kw.assign( 1 )
reg = EclRegion( self.grid , False )
for k in range(self.grid.getNZ()):
reg.clear( )
reg.select_kslice( k , k )
self.kw.assign( k , mask = reg )
self.kw[ k * self.grid.getNX() * self.grid.getNY() + 7] = 177
示例5: test_local_field
def test_local_field(self):
with ErtTestContext('python/enkf/data/local_config', self.field_config) as test_context:
main = test_context.getErt()
local_config = main.getLocalConfig()
# Creating dataset
data_scale = local_config.createDataset('DATA_SCALE')
grid = local_config.getGrid()
ecl_reg = EclRegion(grid, False)
ecl_reg.select_islice(10, 20)
data_scale.addField('PERMX', ecl_reg)
self.assertEqual(1, len(data_scale))
示例6: test_heidrun
def test_heidrun(self):
root = self.createTestPath("Statoil/ECLIPSE/Heidrun")
grid = EclGrid( "%s/FF12_2013B2_AMAP_AOP-J15_NO62_MOVEX.EGRID" % root)
polygon = []
with open("%s/polygon.ply" % root) as fileH:
for line in fileH.readlines():
tmp = line.split()
polygon.append( (float(tmp[0]) , float(tmp[1])))
self.assertEqual( len(polygon) , 11 )
reg = EclRegion( grid , False )
reg.select_inside_polygon( polygon )
self.assertEqual( 0 , len(reg.global_list) % grid.nz)
示例7: test_equal
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 )
示例8: test_slice
def test_slice(self):
reg = EclRegion(self.grid, False)
reg.select_islice(0, 5)
OK = True
global_list = reg.global_list
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.ny * self.grid.nz * 6 == len(reg.global_list))
reg.select_jslice(7, 8, intersect=True)
OK = True
for gi in reg.global_list:
(i, j, k) = self.grid.get_ijk(global_index=gi)
if i > 5:
OK = False
if j < 7 or j > 8:
OK = False
self.assertTrue(OK)
self.assertTrue(2 * self.grid.nz * 6 == len(reg.global_list))
reg2 = EclRegion(self.grid, False)
reg2.select_kslice(3, 5)
reg &= reg2
OK = True
for gi in reg.global_list:
(i, j, k) = self.grid.get_ijk(global_index=gi)
if i > 5:
OK = False
if j < 7 or j > 8:
OK = False
if k < 3 or k > 5:
OK = False
self.assertTrue(OK)
self.assertTrue(2 * 3 * 6 == len(reg.getGlobalList()))
示例9: test_equal
def test_equal(self):
grid = EclGrid.createRectangular( (10,10,1) , (1,1,1))
kw_int = EclKW( "INT" , grid.getGlobalSize( ) , EclDataType.ECL_INT )
kw_float = EclKW( "FLOAT" , grid.getGlobalSize( ) , EclDataType.ECL_FLOAT )
kw_int[0:49] = 1
region = EclRegion(grid, False)
region.select_equal( kw_int , 1 )
glist = region.getGlobalList()
for g in glist:
self.assertEqual( kw_int[g] , 1 )
with self.assertRaises(ValueError):
region.select_equal( kw_float , 1 )
示例10: test_index_list
def test_index_list(self):
reg = EclRegion(self.grid, False)
reg.select_islice(0, 5)
active_list = reg.active_list
global_list = reg.global_list
示例11: test_layer
def test_layer(self):
region = EclRegion(self.grid, False)
layer = Layer( self.grid.getNX() , self.grid.getNY() + 1)
with self.assertRaises(ValueError):
region.selectFromLayer( layer , 0 , 1 )
layer = Layer( self.grid.getNX() , self.grid.getNY() )
layer[0,0] = 1
layer[1,1] = 1
layer[2,2] = 1
with self.assertRaises(ValueError):
region.selectFromLayer( layer , -1 , 1 )
with self.assertRaises(ValueError):
region.selectFromLayer( layer , self.grid.getNZ() , 1 )
region.selectFromLayer( layer , 0 , 2 )
glist = region.getGlobalList()
self.assertEqual(0 , len(glist))
region.selectFromLayer( layer , 0 , 1 )
glist = region.getGlobalList()
self.assertEqual(3 , len(glist))