本文整理汇总了Python中ecl.summary.EclSum.alloc_data_vector方法的典型用法代码示例。如果您正苦于以下问题:Python EclSum.alloc_data_vector方法的具体用法?Python EclSum.alloc_data_vector怎么用?Python EclSum.alloc_data_vector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ecl.summary.EclSum
的用法示例。
在下文中一共展示了EclSum.alloc_data_vector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SumTest
# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.EclSum import alloc_data_vector [as 别名]
#.........这里部分代码省略.........
def test_stringlist_reference(self):
sum = EclSum(self.case)
wells = sum.wells()
self.assertListEqual([well for well in wells], ['OP_1', 'OP_2', 'OP_3', 'OP_4', 'OP_5', 'WI_1', 'WI_2', 'WI_3'])
self.assertIsInstance(wells, StringList)
def test_stringlist_setitem(self):
sum = EclSum(self.case)
wells = sum.wells()
wells[0] = "Bjarne"
well0 = wells[0]
self.assertTrue(well0 == "Bjarne")
self.assertTrue(wells[0] == "Bjarne")
wells[0] = "XXX"
self.assertTrue(well0 == "Bjarne")
self.assertTrue(wells[0] == "XXX")
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)
def test_return_types(self):
self.assertIsInstance(self.ecl_sum.alloc_time_vector(True), TimeVector)
key_index = self.ecl_sum.get_general_var_index("FOPT")
self.assertIsInstance(self.ecl_sum.alloc_data_vector(key_index, True), DoubleVector)
def test_timeRange(self):
sum = EclSum(self.case)
with self.assertRaises(TypeError):
trange = sum.timeRange(interval = "1")
trange = sum.timeRange(interval = "1X")
trange = sum.timeRange(interval = "YY")
trange = sum.timeRange(interval = "MY")
with self.assertRaises(ValueError):
trange = sum.timeRange( start = datetime.datetime(2000,1,1) , end = datetime.datetime(1999,1,1) )
sim_start = datetime.datetime(2000, 1, 1, 0, 0, 0)
sim_end = datetime.datetime(2004, 12, 31, 0, 0, 0)
trange = sum.timeRange( interval = "1Y")
self.assertTrue( trange[0] == datetime.date( 2000 , 1 , 1 ))
self.assertTrue( trange[1] == datetime.date( 2001 , 1 , 1 ))
self.assertTrue( trange[2] == datetime.date( 2002 , 1 , 1 ))
self.assertTrue( trange[3] == datetime.date( 2003 , 1 , 1 ))
self.assertTrue( trange[4] == datetime.date( 2004 , 1 , 1 ))
self.assertTrue( trange[5] == datetime.date( 2005 , 1 , 1 ))
trange = sum.timeRange( interval = "1M")
self.assertTrue( trange[0] == datetime.date( 2000 , 1 , 1 ))
self.assertTrue( trange[-1] == datetime.date( 2005 , 1 , 1 ))
trange = sum.timeRange( start = datetime.date( 2002 , 1 , 15), interval = "1M")
self.assertTrue( trange[0] == datetime.date( 2002 , 1 , 1 ))
self.assertTrue( trange[-1] == datetime.date( 2005 , 1 , 1 ))
trange = sum.timeRange( start = datetime.date( 2002 , 1 , 15) , end = datetime.date( 2003 , 1 , 15), interval = "1M")
self.assertTrue( trange[0] == datetime.date( 2002 , 1 , 1 ))