本文整理汇总了Python中ecl.summary.EclSum.get_end_time方法的典型用法代码示例。如果您正苦于以下问题:Python EclSum.get_end_time方法的具体用法?Python EclSum.get_end_time怎么用?Python EclSum.get_end_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ecl.summary.EclSum
的用法示例。
在下文中一共展示了EclSum.get_end_time方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_run_default
# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.EclSum import get_end_time [as 别名]
def test_run_default(self):
with TestAreaContext(""):
self.case.fwrite()
# Too few arguments
with self.assertRaises(CallError):
subprocess.check_call([self.script])
# Too few arguments
with self.assertRaises(CallError):
subprocess.check_call([self.script, "CSV"])
# Invalid first arguments
with self.assertRaises(CallError):
subprocess.check_call([self.script, "DOES_NOT_EXIST", "OUTPUT"])
# Should run OK:
subprocess.check_call([self.script, "CSV", "OUTPUT"])
output_case = EclSum("OUTPUT")
self.assertEqual( output_case.get_data_start_time(), self.case.get_data_start_time())
self.assertEqual( output_case.get_end_time(), self.case.get_end_time())
with self.assertRaises(CallError):
subprocess.check_call([self.script, "CSV", "OUTPUT", "--refcase=does/not/exist"])
refcase = create_case( num_mini_step = 7, case = "REFCASE")
refcase.fwrite()
subprocess.check_call([self.script, "CSV", "OUTPUT", "--refcase=REFCASE"])
output_case = EclSum("OUTPUT")
self.assertEqual( output_case.get_data_start_time(), refcase.get_data_start_time())
self.assertEqual( output_case.get_end_time(), refcase.get_end_time())
time_points = output_case.alloc_time_vector(False)
t1 = output_case.alloc_time_vector(False)
t2 = refcase.alloc_time_vector(False)
self.assertEqual(t1,t2)
示例2: SumTest
# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.EclSum import get_end_time [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"))