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


Python EclFile.close方法代码示例

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


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

示例1: test_fwrite

# 需要导入模块: from ert.ecl import EclFile [as 别名]
# 或者: from ert.ecl.EclFile import close [as 别名]
 def test_fwrite( self ):
     #work_area = TestArea("python/ecl_file/fwrite")
     with TestAreaContext("python/ecl_file/fwrite"):
         rst_file = EclFile(self.test_file)
         fortio = FortIO("ECLIPSE.UNRST", FortIO.WRITE_MODE)
         rst_file.fwrite(fortio)
         fortio.close()
         rst_file.close()
         self.assertFilesAreEqual("ECLIPSE.UNRST", self.test_file)
开发者ID:JacobStoren,项目名称:ResInsight,代码行数:11,代码来源:test_ecl_file.py

示例2: test_save

# 需要导入模块: from ert.ecl import EclFile [as 别名]
# 或者: from ert.ecl.EclFile import close [as 别名]
    def test_save(self):
        #work_area = TestArea("python/ecl_file/save")
        with TestAreaContext("python/ecl_file/save", store_area=False) as work_area:
            work_area.copy_file(self.test_file)
            rst_file = EclFile("ECLIPSE.UNRST", flags=EclFileFlagEnum.ECL_FILE_WRITABLE)
            swat0 = rst_file["SWAT"][0]
            swat0.assign(0.75)
            rst_file.save_kw(swat0)
            rst_file.close()
            self.assertFilesAreNotEqual("ECLIPSE.UNRST",self.test_file)

            rst_file1 = EclFile(self.test_file)
            rst_file2 = EclFile("ECLIPSE.UNRST", flags=EclFileFlagEnum.ECL_FILE_WRITABLE)

            swat1 = rst_file1["SWAT"][0]
            swat2 = rst_file2["SWAT"][0]
            swat2.assign(swat1)

            rst_file2.save_kw(swat2)
            self.assertTrue(swat1.equal(swat2))
            rst_file1.close()
            rst_file2.close()

            # Random failure ....
            self.assertFilesAreEqual("ECLIPSE.UNRST", self.test_file)
开发者ID:JacobStoren,项目名称:ResInsight,代码行数:27,代码来源:test_ecl_file.py

示例3: test_kw_write

# 需要导入模块: from ert.ecl import EclFile [as 别名]
# 或者: from ert.ecl.EclFile import close [as 别名]
    def test_kw_write(self):
        with TestAreaContext("python/ecl_kw/writing"):

            data = [random.random() for i in range(10000)]

            kw = EclKW("TEST", len(data), EclTypeEnum.ECL_DOUBLE_TYPE)
            i = 0
            for d in data:
                kw[i] = d
                i += 1

            fortio = FortIO("ECL_KW_TEST", FortIO.WRITE_MODE)
            kw.fwrite(fortio)
            fortio.close()

            fortio = FortIO("ECL_KW_TEST")

            kw2 = EclKW.fread(fortio)

            self.assertTrue(kw.equal(kw2))

            ecl_file = EclFile("ECL_KW_TEST", flags=EclFileFlagEnum.ECL_FILE_WRITABLE)
            kw3 = ecl_file["TEST"][0]
            self.assertTrue(kw.equal(kw3))
            ecl_file.save_kw(kw3)
            ecl_file.close()

            fortio = FortIO("ECL_KW_TEST", FortIO.READ_AND_WRITE_MODE)
            kw4 = EclKW.fread(fortio)
            self.assertTrue(kw.equal(kw4))
            fortio.seek(0)
            kw4.fwrite(fortio)
            fortio.close()

            ecl_file = EclFile("ECL_KW_TEST")
            kw5 = ecl_file["TEST"][0]
            self.assertTrue(kw.equal(kw5))
开发者ID:flikka,项目名称:ert,代码行数:39,代码来源:test_ecl_kw.py


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