class_docstr: Test the CREFL modifier.
class_docstr_tok: ["Test","the","CREFL","modifier","."]
docstr: Test ReflectanceCorrector modifier with ABI data.
docstr_tok: ["Test","ReflectanceCorrector","modifier","with","ABI","data","."]
code: def test_reflectance_corrector_abi(
      self, name, wavelength, resolution, exp_mean, exp_unique
  ):
      """Test ReflectanceCorrector modifier with ABI data."""
      from satpy.modifiers._crefl import ReflectanceCorrector
      from satpy.tests.utils import make_dsq
  
      ref_cor = ReflectanceCorrector(
          optional_prerequisites=[
              make_dsq(name="satellite_azimuth_angle"),
              make_dsq(name="satellite_zenith_angle"),
              make_dsq(name="solar_azimuth_angle"),
              make_dsq(name="solar_zenith_angle"),
          ],
          name=name,
          prerequisites=[],
          wavelength=wavelength,
          resolution=resolution,
          calibration="reflectance",
          modifiers=(
              "sunz_corrected",
              "rayleigh_corrected_crefl",
          ),
          sensor="abi",
      )
  
      assert ref_cor.attrs["modifiers"] == (
          "sunz_corrected",
          "rayleigh_corrected_crefl",
      )
      assert ref_cor.attrs["calibration"] == "reflectance"
      assert ref_cor.attrs["wavelength"] == wavelength
      assert ref_cor.attrs["name"] == name
      assert ref_cor.attrs["resolution"] == resolution
      assert ref_cor.attrs["sensor"] == "abi"
      assert ref_cor.attrs["prerequisites"] == []
      assert ref_cor.attrs["optional_prerequisites"] == [
          make_dsq(name="satellite_azimuth_angle"),
          make_dsq(name="satellite_zenith_angle"),
          make_dsq(name="solar_azimuth_angle"),
          make_dsq(name="solar_zenith_angle"),
      ]
  
      area, dnb = self.data_area_ref_corrector()
      c01 = xr.DataArray(
          dnb,
          dims=("y", "x"),
          attrs={
              "platform_name": "GOES-16",
              "calibration": "reflectance",
              "units": "%",
              "wavelength": wavelength,
              "name": name,
              "resolution": resolution,
              "sensor": "abi",
              "start_time": "2017-09-20 17:30:40.800000",
              "end_time": "2017-09-20 17:41:17.500000",
              "area": area,
              "ancillary_variables": [],
              "orbital_parameters": {
                  "satellite_nominal_longitude": -89.5,
                  "satellite_nominal_latitude": 0.0,
                  "satellite_nominal_altitude": 35786023.4375,
              },
          },
      )
      with assert_maximum_dask_computes(0):
          res = ref_cor([c01], [])
  
      assert isinstance(res, xr.DataArray)
      assert isinstance(res.data, da.Array)
      assert res.attrs["modifiers"] == (
          "sunz_corrected",
          "rayleigh_corrected_crefl",
      )
      assert res.attrs["platform_name"] == "GOES-16"
      assert res.attrs["calibration"] == "reflectance"
      assert res.attrs["units"] == "%"
      assert res.attrs["wavelength"] == wavelength
      assert res.attrs["name"] == name
      assert res.attrs["resolution"] == resolution
      assert res.attrs["sensor"] == "abi"
      assert res.attrs["start_time"] == "2017-09-20 17:30:40.800000"
      assert res.attrs["end_time"] == "2017-09-20 17:41:17.500000"
      assert res.attrs["area"] == area
      assert res.attrs["ancillary_variables"] == []
      data = res.values
      unique = np.unique(data[~np.isnan(data)])
      np.testing.assert_allclose(np.nanmean(data), exp_mean, rtol=1e-5)
      assert data.shape == (3, 5)
      np.testing.assert_allclose(unique, exp_unique, rtol=1e-5)
  
imports: from contextlib import contextmanager
  from datetime import datetime
  from unittest import mock
  import numpy
  import pytest
  import xarray
  from dask import array
  from pyresample.geometry import AreaDefinition
  from satpy.tests.utils import assert_maximum_dask_computes
label_desc: Use image node_id 2 for calling the TestReflectanceCorrectorModifier obj's underlying member method code with example usage: obj.test_reflectance_corrector_abi(name, wavelength, resolution, exp_mean, exp_unique) without return types