class_docstr: Generic GRIB file handler.
class_docstr_tok: ["Generic","GRIB","file","handler","."]
docstr: Open grib file and do initial message parsing.
docstr_tok: ["Open","grib","file","and","do","initial","message","parsing","."]
code: def __init__(self, filename, filename_info, filetype_info):
      """Open grib file and do initial message parsing."""
      super(GRIBFileHandler, self).__init__(
          filename, filename_info, filetype_info
      )
  
      self._msg_datasets = {}
      self._start_time = None
      self._end_time = None
      try:
          with pygrib.open(self.filename) as grib_file:
              first_msg = grib_file.message(1)
              last_msg = grib_file.message(grib_file.messages)
              start_time = self._convert_datetime(
                  first_msg, "validityDate", "validityTime"
              )
              end_time = self._convert_datetime(
                  last_msg, "validityDate", "validityTime"
              )
              self._start_time = start_time
              self._end_time = end_time
              if "keys" not in filetype_info:
                  self._analyze_messages(grib_file)
                  self._idx = None
              else:
                  self._create_dataset_ids(filetype_info["keys"])
                  self._idx = pygrib.index(
                      self.filename, *filetype_info["keys"].keys()
                  )
      except (RuntimeError, KeyError):
          raise IOError(
              "Unknown GRIB file format: {}".format(self.filename)
          )
  
imports: import logging
  from datetime import datetime
  import dask.array
  import numpy
  import pygrib
  import xarray
  from pyproj import Proj
  from pyresample import geometry
  from satpy.dataset import DataQuery
  from satpy.readers.file_handlers import BaseFileHandler
  from satpy.utils import get_legacy_chunk_size
label_desc: Use image node_id 1 to create a new GRIBFileHandler object from inherited base classes: BaseFileHandler with example: obj = GRIBFileHandler(filename, filename_info, filetype_info)