class_docstr: The base class for the FengYun4 AGRI and GHI readers.
class_docstr_tok: ["The","base","class","for","the","FengYun4","AGRI","and","GHI","readers","."]
docstr: Calibrate the data.
docstr_tok: ["Calibrate","the","data","."]
code: def calibrate(self, data, ds_info, ds_name, file_key):
      """Calibrate the data."""
      # Check if calibration is present, if not assume dataset is an angle
      calibration = ds_info.get("calibration")
      # Return raw data in case of counts or no calibration
      if calibration in ("counts", None):
          data.attrs["units"] = ds_info["units"]
          ds_info["valid_range"] = data.attrs["valid_range"]
          ds_info["fill_value"] = data.attrs["FillValue"].item()
      elif calibration == "reflectance":
          channel_index = int(file_key[-2:]) - 1
          data = self.calibrate_to_reflectance(
              data, channel_index, ds_info
          )
      elif calibration == "brightness_temperature":
          data = self.calibrate_to_bt(data, ds_info, ds_name)
      elif calibration == "radiance":
          raise NotImplementedError(
              "Calibration to radiance is not supported."
          )
      # Apply range limits, but not for counts or we convert to float!
      if calibration != "counts":
          data = data.where(
              (data >= min(data.attrs["valid_range"]))
              & (data <= max(data.attrs["valid_range"]))
          )
      else:
          data.attrs["_FillValue"] = data.attrs["FillValue"].item()
      return data
  
imports: import logging
  from datetime import datetime
  import dask.array
  import numpy
  import xarray
  from satpy._compat import cached_property
  from satpy.readers._geos_area import get_area_definition, get_area_extent
  from satpy.readers.hdf5_utils import HDF5FileHandler
label_desc: Use image node_id 6 for calling the FY4Base obj's underlying member method code with example usage: obj.calibrate(data, ds_info, ds_name, file_key) and returns: data