本文整理汇总了Python中ert.ecl.EclFile.getFileType方法的典型用法代码示例。如果您正苦于以下问题:Python EclFile.getFileType方法的具体用法?Python EclFile.getFileType怎么用?Python EclFile.getFileType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ert.ecl.EclFile
的用法示例。
在下文中一共展示了EclFile.getFileType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from ert.ecl import EclFile [as 别名]
# 或者: from ert.ecl.EclFile import getFileType [as 别名]
def __init__(self , grid , filename , flags = 0):
"""Will open an Eclipse restart file.
The EclRestartFile class will open an eclipse restart file, in
unified or non unified format. The constructor will infer the
file type based on the filename, and will raise a ValueError
exception if the file type is not ECL_RESTART_FILE or
ECL_UNIFIED_RESTART_FILE.
The EclRestartFile will use a grid reference to create Ecl3DKw
instances for all the keyword elements which have either
'nactive' or 'nx*ny*nz' elements.
"""
file_type , report_step , fmt_file = EclFile.getFileType( filename )
if not file_type in [EclFileEnum.ECL_RESTART_FILE, EclFileEnum.ECL_UNIFIED_RESTART_FILE]:
raise ValueError("The input filename:%s does not correspond to a restart file - please follow the Eclipse naming conventions" % filename)
super(EclRestartFile , self).__init__( grid, filename , flags)
self.rst_headers = None
if file_type == EclFileEnum.ECL_RESTART_FILE:
self.is_unified = False
self.report_step = report_step
else:
self.is_unified = True
示例2: __init__
# 需要导入模块: from ert.ecl import EclFile [as 别名]
# 或者: from ert.ecl.EclFile import getFileType [as 别名]
def __init__(self , grid , filename , flags = 0):
file_type , report_step , fmt_file = EclFile.getFileType( filename )
if file_type == EclFileEnum.ECL_INIT_FILE:
super(EclInitFile , self).__init__( grid, filename , flags)
else:
raise ValueError("The input filename:%s does not correspond to a restart file - please follow the Eclipse naming conventions" % filename)
示例3: assertFileType
# 需要导入模块: from ert.ecl import EclFile [as 别名]
# 或者: from ert.ecl.EclFile import getFileType [as 别名]
def assertFileType(self , filename , expected):
file_type , step , fmt_file = EclFile.getFileType(filename)
self.assertEqual( file_type , expected[0] )
self.assertEqual( fmt_file , expected[1] )
self.assertEqual( step , expected[2] )