class GribFile(eccodes.high_level.codesfile.CodesFile) A GRIB file handle meant for use in a context manager. Individual messages can be accessed using the ``next`` method. Of course, it is also possible to iterate over each message in the file:: >>> with GribFile(filename) as grib: ... # Print number of messages in file ... len(grib) ... # Open all messages in file ... for msg in grib: ... print(msg[key_name]) ... len(grib.open_messages) >>> # When the file is closed, any open messages are closed >>> len(grib.open_messages) |