本文整理汇总了Python中ecl.summary.EclSum.keys方法的典型用法代码示例。如果您正苦于以下问题:Python EclSum.keys方法的具体用法?Python EclSum.keys怎么用?Python EclSum.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ecl.summary.EclSum
的用法示例。
在下文中一共展示了EclSum.keys方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_write
# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.EclSum import keys [as 别名]
def test_write(self):
with TestAreaContext("my_space") as area:
intersect_summary = EclSum( self.createTestPath( "Statoil/ECLIPSE/SummaryRestart/iter-1/NOR-2013A_R007-0"), lazy_load=False )
self.assertIsNotNone(intersect_summary)
write_location = os.path.join(os.getcwd(), "CASE")
intersect_summary.fwrite(ecl_case=write_location)
reloaded_summary = EclSum(write_location)
self.assertEqual(intersect_summary.keys(), reloaded_summary.keys())
示例2: EclSumVectorTest
# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.EclSum import keys [as 别名]
class EclSumVectorTest(EclTest):
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
t = self.ecl_sum[next(it)] # EclSumVector
self.assertEqual(63, len(t))
self.assertEqual('BARSA', t.unit)
pfx = 'EclSumVector(key = '
self.assertEqual(pfx, repr(t)[:len(pfx)])
示例3: test_ix_case
# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.EclSum import keys [as 别名]
def test_ix_case(self):
intersect_summary = EclSum(self.createTestPath("Statoil/ECLIPSE/ix/summary/CREATE_REGION_AROUND_WELL"))
self.assertIsNotNone(intersect_summary)
self.assertTrue(
"HWELL_PROD" in
[intersect_summary.smspec_node(key).wgname for key in intersect_summary.keys()]
)
eclipse_summary = EclSum(self.createTestPath("Statoil/ECLIPSE/ix/summary/ECL100/E100_CREATE_REGION_AROUND_WELL"))
self.assertIsNotNone(eclipse_summary)
hwell_padder = lambda key : key if key.split(":")[-1] != "HWELL_PR" else key + "OD"
self.assertEqual(
intersect_summary.keys("WWCT*"),
list(map(hwell_padder, eclipse_summary.keys("WWCT*")))
)
示例4: test_segment
# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.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)
示例5: test_ix_write
# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.EclSum import keys [as 别名]
def test_ix_write(self):
for data_set in [
"Statoil/ECLIPSE/ix/summary/CREATE_REGION_AROUND_WELL",
"Statoil/ECLIPSE/ix/troll/IX_NOPH3_R04_75X75X1_GRID2.SMSPEC"
]:
with TestAreaContext("my_space" + data_set.split("/")[-1]) as area:
intersect_summary = EclSum(self.createTestPath(data_set), lazy_load=False)
self.assertIsNotNone(intersect_summary)
write_location = os.path.join(os.getcwd(), "CASE")
intersect_summary.fwrite(ecl_case=write_location)
reloaded_summary = EclSum(write_location)
self.assertEqual(
list(intersect_summary.keys()),
list(reloaded_summary.keys())
)
示例6: test_restart_mapping
# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.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
示例7: test_ix_caseII
# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.EclSum import keys [as 别名]
def test_ix_caseII(self):
troll_summary = EclSum( self.createTestPath("Statoil/ECLIPSE/ix/troll/IX_NOPH3_R04_75X75X1_GRID2.SMSPEC"))
self.assertIsNotNone(troll_summary)
self.assertTrue("WMCTL:Q21BH1" in list(troll_summary.keys()))
示例8: SumTest
# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.EclSum import keys [as 别名]
#.........这里部分代码省略.........
def test_dates( self ):
sum = self.ecl_sum
d = sum.dates
self.assertEqual(d[0], datetime.datetime(2000, 1, 1, 0, 0, 0))
self.assertEqual(d[62], datetime.datetime(2004, 12, 31, 0, 0, 0))
self.assertEqual(len(d), 63)
self.assertEqual(d[25], datetime.datetime(2001, 12, 1, 0, 0, 0))
self.assertEqual(sum.iget_date(25), datetime.datetime(2001, 12, 1, 0, 0, 0))
mpl_dates = sum.mpl_dates
self.assertAlmostEqual(mpl_dates[25], 730820)
days = sum.days
self.assertAlmostEqual(days[50], 1461)
self.assertEqual(sum.start_time, datetime.datetime(2000, 1, 1, 0, 0, 0))
self.assertEqual(sum.end_time, datetime.datetime(2004, 12, 31, 0, 0, 0))
self.assertTrue(sum.check_sim_time(datetime.datetime(2004, 12, 31, 0, 0, 0)))
self.assertEqual(sum.end_date , datetime.date(2004, 12, 31))
def test_dates2( self ):
sum = EclSum(self.createTestPath("Statoil/ECLIPSE/FF12/FF12_2013B3_AMAP2"))
self.assertEqual(sum.end_date , datetime.date(2045, 1, 1))
def test_keys(self):
sum = self.ecl_sum
self.assertRaises(KeyError, sum.__getitem__, "BJARNE")
v = sum["FOPT"]
self.assertEqual(len(v), 63)
def test_index(self):
sum = self.ecl_sum
index = sum.get_key_index("TCPUDAY")
self.assertEqual(index, 10239)
def test_report(self):
sum = self.ecl_sum
self.assertEqual(sum.get_report(date=datetime.date(2000, 10, 1)), 10)
self.assertEqual(sum.get_report(date=datetime.date(2000, 10, 3)), -1)
self.assertEqual(sum.get_report(date=datetime.date(1980, 10, 3)), -1)
self.assertEqual(sum.get_report(date=datetime.date(2012, 10, 3)), -1)
self.assertEqual(sum.get_report(days=91), 3)
self.assertEqual(sum.get_report(days=92), -1)
self.assertAlmostEqual(sum.get_interp("FOPT", days=91), sum.get_from_report("FOPT", 3))
self.assertEqual(sum.first_report, 1)
self.assertEqual(sum.last_report, 62)
self.assertEqual(sum.get_report_time(10), datetime.date(2000, 10, 1))
self.assertFloatEqual(sum.get_from_report("FOPT", 10), 6.67447e+06)
def test_fwrite(self):