本文整理匯總了Python中ert.ecl.FortIO.writer方法的典型用法代碼示例。如果您正苦於以下問題:Python FortIO.writer方法的具體用法?Python FortIO.writer怎麽用?Python FortIO.writer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ert.ecl.FortIO
的用法示例。
在下文中一共展示了FortIO.writer方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_kw
# 需要導入模塊: from ert.ecl import FortIO [as 別名]
# 或者: from ert.ecl.FortIO import writer [as 別名]
def test_kw(self):
kw1 = EclKW.create("KW1", 2, EclTypeEnum.ECL_INT_TYPE)
kw2 = EclKW.create("KW2", 2, EclTypeEnum.ECL_INT_TYPE)
kw1[0] = 99
kw1[1] = 77
kw2[0] = 113
kw2[1] = 335
with TestAreaContext("python/fortio/write-kw"):
f = FortIO.writer("test", fmt_file=False)
kw1.fwrite(f)
f.close()
f = FortIO.open("test", mode="a")
kw2.fwrite(f)
f.close()
f = FortIO.open("test", fmt_file=False)
k1 = EclKW.fread(f)
k2 = EclKW.fread(f)
f.close()
self.assertTrue(k1.equal(kw1))
self.assertTrue(k2.equal(kw2))
示例2: test_fwrite
# 需要導入模塊: from ert.ecl import FortIO [as 別名]
# 或者: from ert.ecl.FortIO import writer [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.writer("ECLIPSE.UNRST")
rst_file.fwrite(fortio)
fortio.close()
rst_file.close()
self.assertFilesAreEqual("ECLIPSE.UNRST", self.test_file)
示例3: test_open_write
# 需要導入模塊: from ert.ecl import FortIO [as 別名]
# 或者: from ert.ecl.FortIO import writer [as 別名]
def test_open_write(self):
with TestAreaContext("python/fortio/write"):
f = FortIO.writer("newfile")
f.close()
self.assertTrue(True)