class_docstr: Reader class for SEVIRI L2 products in GRIB format.
docstr: Get dataset using the parameter_number key in dataset_info.
  
  In a previous version of the reader, the attributes (nrows, ncols, ssp_lon) and projection information
  (pdict and area_dict) were computed while initializing the file handler. Also the code would break out from
  the While-loop below as soon as the correct parameter_number was found. This has now been revised becasue the
  reader would sometimes give corrupt information about the number of messages in the file and the dataset
  dimensions within a given message if the file was only partly read (not looping over all messages) in an earlier
  instance.
docstr_tok: ["Get","dataset","using","the","parameter_number","key","in","dataset_info",".","In","a","previous","version","of","the","reader",",","the","attributes","(","nrows",",","ncols",",","ssp_lon",")","and","projection","information","(","pdict","and","area_dict",")","were","computed","while","initializing","the","file","handler",".","Also","the","code","would","break","out","from","the","While-loop","below","as","soon","as","the","correct","parameter_number","was","found",".","This","has","now","been","revised","becasue","the","reader","would","sometimes","give","corrupt","information","about","the","number","of","messages","in","the","file","and","the","dataset","dimensions","within","a","given","message","if","the","file","was","only","partly","read","(","not","looping","over","all","messages",")","in","an","earlier","instance","."]
code: def get_dataset(self, dataset_id, dataset_info):
      """Get dataset using the parameter_number key in dataset_info.
  
      In a previous version of the reader, the attributes (nrows, ncols, ssp_lon) and projection information
      (pdict and area_dict) were computed while initializing the file handler. Also the code would break out from
      the While-loop below as soon as the correct parameter_number was found. This has now been revised becasue the
      reader would sometimes give corrupt information about the number of messages in the file and the dataset
      dimensions within a given message if the file was only partly read (not looping over all messages) in an earlier
      instance.
      """
      logger.debug(
          "Reading in file to get dataset with parameter number %d.",
          dataset_info["parameter_number"],
      )
  
      xarr = None
      message_found = False
      with open(self.filename, "rb") as fh:
          # Iterate over all messages and fetch data when the correct parameter number is found
          while True:
              gid = ec.codes_grib_new_from_file(fh)
  
              if gid is None:
                  if not message_found:
                      # Could not obtain a valid message ID from the grib file
                      logger.warning(
                          "Could not find parameter_number %d in GRIB file, no valid Dataset created",
                          dataset_info["parameter_number"],
                      )
                  break
  
              # Check if the parameter number in the GRIB message corresponds to the required key
              parameter_number = self._get_from_msg(
                  gid, "parameterNumber"
              )
  
              if parameter_number == dataset_info["parameter_number"]:
                  self._res = dataset_id["resolution"]
                  self._read_attributes(gid)
  
                  # Read the missing value
                  missing_value = self._get_from_msg(
                      gid, "missingValue"
                  )
  
                  # Retrieve values and metadata from the GRIB message, masking the values equal to missing_value
                  xarr = self._get_xarray_from_msg(gid)
  
                  xarr.data = da.where(
                      xarr.data == missing_value, np.nan, xarr.data
                  )
  
                  ec.codes_release(gid)
  
                  # Combine all metadata into the dataset attributes and break out of the loop
                  xarr.attrs.update(dataset_info)
                  xarr.attrs.update(self._get_attributes())
  
                  message_found = True
  
              else:
                  # The parameter number is not the correct one, release gid and skip to next message
                  ec.codes_release(gid)
  
      return xarr
  
imports: import logging
  from datetime import timedelta
  import dask.array
  import numpy
  import xarray
  from satpy.readers._geos_area import get_area_definition, get_geos_area_naming
  from satpy.readers.eum_base import get_service_mode
  from satpy.readers.file_handlers import BaseFileHandler
  from satpy.readers.seviri_base import PLATFORM_DICT, REPEAT_CYCLE_DURATION, calculate_area_extent
  from satpy.utils import get_legacy_chunk_size
label_desc: Use image node_id 5 for calling the SeviriL2GribFileHandler obj's underlying member method code with example usage: obj.get_dataset(dataset_id, dataset_info) and returns: xarr