Пример #1
0
    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
0
    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
Пример #3
0
 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)
Пример #4
0
 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])
Пример #5
0
 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)
Пример #6
0
 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] )