本文整理汇总了Python中ert.ecl.EclSum.keys方法的典型用法代码示例。如果您正苦于以下问题:Python EclSum.keys方法的具体用法?Python EclSum.keys怎么用?Python EclSum.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ert.ecl.EclSum
的用法示例。
在下文中一共展示了EclSum.keys方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_segment
# 需要导入模块: from ert.ecl import EclSum [as 别名]
# 或者: from ert.ecl.EclSum import keys [as 别名]
def test_segment(self):
sum = EclSum(self.createTestPath("Statoil/ECLIPSE/Oseberg/F8MLT/F8MLT-F4"))
segment_vars = sum.keys("SOFR:F-8:*")
self.assertIn("SOFR:F-8:1", segment_vars)
for var in segment_vars:
tmp = var.split(":")
nr = int(tmp[2])
self.assertTrue(nr >= 0)
示例2: test_Heidrun
# 需要导入模块: from ert.ecl import EclSum [as 别名]
# 或者: from ert.ecl.EclSum import keys [as 别名]
def test_Heidrun(self):
sum = EclSum( self.createTestPath("Statoil/ECLIPSE/Heidrun/Summary/FF12_2013B3_CLEAN_RS"))
self.assertEqual( 452 , len(sum))
self.assertFloatEqual( 1.8533144e+8 , sum.get_last_value("FOPT"))
trange = sum.timeRange( start = datetime.date( 2015 , 1 , 1), interval = "1M")
self.assertTrue( trange[0] == datetime.date( 2016 , 2 , 1 ))
for t in trange:
sum.get_interp( "FOPT" , date = t )
with TestAreaContext("csv/export"):
sum.exportCSV("file.csv")
input_file = csv.DictReader( open("file.csv"))
for row in input_file:
keys = sum.keys( pattern = "W*")
keys |= sum.keys( pattern = "G")
for key in keys:
self.assertTrue( key in row )
break
示例3: test_restart_mapping
# 需要导入模块: from ert.ecl import EclSum [as 别名]
# 或者: from ert.ecl.EclSum import keys [as 别名]
def test_restart_mapping(self):
history = EclSum( self.createTestPath( "Statoil/ECLIPSE/SummaryRestart/iter-1/NOR-2013A_R007-0") )
total = EclSum( self.createTestPath( "Statoil/ECLIPSE/SummaryRestart/Prediction/NOR-2013A_R007_PRED-0") , include_restart = True)
history_dates = history.get_dates( )
total_dates = total.get_dates( )
for i in range(len(history_dates)):
self.assertEqual( history_dates[i] , total_dates[i] )
keys = history.keys( pattern = "W*")
for key in keys:
if key in total:
self.assertEqual( history.iget( key , 5 ) , total.iget( key , 5 ))
self.assertFalse( "WGPR:NOT_21_D" in history )
self.assertTrue( "WGPR:NOT_21_D" in total )
self.assertEqual( total.iget( "WGPR:NOT_21_D", 5) , 0) # Default value
示例4: EclSumVectorTest
# 需要导入模块: from ert.ecl import EclSum [as 别名]
# 或者: from ert.ecl.EclSum import keys [as 别名]
class EclSumVectorTest(ExtendedTestCase):
def setUp(self):
self.test_file = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.SMSPEC")
self.ecl_sum = EclSum(self.test_file)
def test_reportOnly_warns(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
vector = EclSumVector(self.ecl_sum, "FOPT", True)
assert len(w) == 1
assert issubclass(w[-1].category, DeprecationWarning)
def test_basic(self):
self.assertEqual(512, len(self.ecl_sum.keys()))
pfx = "EclSum(name"
self.assertEqual(pfx, repr(self.ecl_sum)[: len(pfx)])
it = iter(self.ecl_sum)
t = self.ecl_sum[it.next()] # EclSumVector
self.assertEqual(63, len(t))
self.assertEqual("BARSA", t.unit)
pfx = "EclSumVector(key = "
self.assertEqual(pfx, repr(t)[: len(pfx)])