class_docstr: A test of the ELECTRO-L main file handler functions.
docstr: Test calibrate.
docstr_tok: ["Test","calibrate","."]
code: def test_calibrate(self, *mocks):
      """Test calibrate."""
      lut = np.linspace(1e6, 1.6e6, num=1024).astype(np.int32)
      lut = np.tile(lut, (10, 1))
      fh = HRITGOMSFileHandler()
      fh.prologue = {"ImageCalibration": lut}
      fh.chid = 1
  
      # Set up test input data
  
      counts = DataArray(
          da.linspace(1, 1023, 25, chunks=5, dtype=np.uint16).reshape(
              5, 5
          )
      )
  
      # Test that calibration fails if given a silly mode
      with pytest.raises(NotImplementedError):
          fh.calibrate(counts, "nonsense")
  
      # Test that 'counts' calibration returns identical values to input
      out = fh.calibrate(counts, "counts")
      assert np.all(out.values == counts.values)
  
      # Test that 'radiance' calibrates successfully
      out = fh.calibrate(counts, "radiance")
      assert np.allclose(out.values, lut[0, counts] / 1000.0)
  
      # Test that 'brightness_temperature' calibrates successfully
      out = fh.calibrate(counts, "brightness_temperature")
      assert np.allclose(out.values, lut[0, counts] / 1000.0)
  
imports: import datetime
  import unittest
  from unittest import mock
  import dask.array
  import numpy
  import pytest
  from xarray import DataArray
  from satpy.readers.electrol_hrit import HRITGOMSEpilogueFileHandler, HRITGOMSFileHandler, HRITGOMSPrologueFileHandler, epilogue, image_acquisition, prologue, recarray2dict, satellite_status
  from satpy.tests.utils import make_dataid
label_desc: Use image node_id 2 for calling the TestHRITGOMSFileHandler obj's underlying member method code with example usage: obj.test_calibrate() without return types