def test_is_fortran_file(self): with TestAreaContext("python/fortio/guess"): kw1 = EclKW("KW" , 12345 , EclDataType.ECL_FLOAT) with openFortIO("fortran_file" , mode = FortIO.WRITE_MODE) as f: kw1.fwrite( f ) with open("text_file" , "w") as f: kw1.write_grdecl( f ) self.assertTrue( FortIO.isFortranFile( "fortran_file" )) self.assertFalse( FortIO.isFortranFile( "text_file" ))
def loadFromFile(cls , filename): """ Will inspect the @filename argument and create a new EclGrid instance. """ if FortIO.isFortranFile( filename ): return EclGrid( filename ) else: return EclGrid.loadFromGrdecl( filename )