本文整理汇总了Python中ecl.summary.EclSum.resample方法的典型用法代码示例。如果您正苦于以下问题:Python EclSum.resample方法的具体用法?Python EclSum.resample怎么用?Python EclSum.resample使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ecl.summary.EclSum
的用法示例。
在下文中一共展示了EclSum.resample方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SumTest
# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.EclSum import resample [as 别名]
#.........这里部分代码省略.........
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 )
node = total.smspec_node("WGPR:NOT_21_D")
self.assertEqual( total.iget( "WGPR:NOT_21_D", 5) , node.default)
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())
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*")))
)
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())
)
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()))
def test_resample(self):
time_points = TimeVector()
start_time = self.ecl_sum.get_data_start_time()
end_time = self.ecl_sum.get_end_time()
delta = end_time - start_time
N = 25
time_points.initRange( CTime(start_time),
CTime(end_time),
CTime(int(delta.total_seconds()/(N - 1))))
time_points.append(CTime(end_time))
resampled = self.ecl_sum.resample( "OUTPUT_CASE", time_points )
for key in self.ecl_sum.keys():
self.assertIn( key, resampled )
self.assertEqual(self.ecl_sum.get_data_start_time(), resampled.get_data_start_time())
delta = self.ecl_sum.get_end_time() - resampled.get_end_time()
self.assertTrue( delta.total_seconds() <= 1 )
keys = ["FOPT", "FOPR", "BPR:15,28,1", "WGOR:OP_1"]
for key in keys:
for time_index,t in enumerate(time_points):
self.assertFloatEqual(resampled.iget( key, time_index), self.ecl_sum.get_interp_direct( key, t))
def test_summary_units(self):
self.assertEqual(self.ecl_sum.unit_system, EclUnitTypeEnum.ECL_METRIC_UNITS)
# The case loaded in this test originates in a simulation
# which was shut down brutally. This test verifies that we
# can create a valid ecl_sum instance from what we find.
def test_broken_case(self):
ecl_sum = EclSum( self.createTestPath("Statoil/ECLIPSE/SummaryFail3/COMBINED-AUTUMN2018_CARBSENS-0"))