当前位置: 首页>>代码示例>>Python>>正文


Python EclSum.alloc_time_vector方法代码示例

本文整理汇总了Python中ecl.summary.EclSum.alloc_time_vector方法的典型用法代码示例。如果您正苦于以下问题:Python EclSum.alloc_time_vector方法的具体用法?Python EclSum.alloc_time_vector怎么用?Python EclSum.alloc_time_vector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ecl.summary.EclSum的用法示例。


在下文中一共展示了EclSum.alloc_time_vector方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_run_default

# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.EclSum import alloc_time_vector [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)
开发者ID:OPM,项目名称:ResInsight,代码行数:37,代码来源:test_summary_resample.py

示例2: test_restart_abs_path

# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.EclSum import alloc_time_vector [as 别名]
    def test_restart_abs_path(self):
        with TestAreaContext("restart_test"):
           history = create_case(case = "HISTORY")
           history.fwrite()

           pred_path = "prediction"
           create_prediction(history, pred_path)

           pred = EclSum(os.path.join(pred_path, "PREDICTION"))
           # The restart case has a maximum length of 72 characters, depending
           # on the path used for $TMP and so on we do not really know here if
           # the restart_case has been set or not.
           if pred.restart_case:
               self.assertTrue(isinstance(pred.restart_case, EclSum))
               self.assertEqual(pred.restart_case.case, os.path.join(os.getcwd(), history.case))
               self.assertEqual(pred.restart_step, history.last_report)

               length = pred.sim_length
               pred_times = pred.alloc_time_vector(False)
               hist_times = history.alloc_time_vector(False)

               for index in range(len(hist_times)):
                   self.assertEqual(hist_times[index], pred_times[index])
开发者ID:,项目名称:,代码行数:25,代码来源:

示例3: SumTest

# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.EclSum import alloc_time_vector [as 别名]

#.........这里部分代码省略.........
        del wells
        self.assertTrue(well1 == "OP_1")


    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 ))
开发者ID:OPM,项目名称:ResInsight,代码行数:69,代码来源:test_sum_statoil.py


注:本文中的ecl.summary.EclSum.alloc_time_vector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。