class_docstr: Test the CREFL modifier.
class_docstr_tok: ["Test","the","CREFL","modifier","."]
docstr: Test ReflectanceCorrector modifier with MODIS data.
docstr_tok: ["Test","ReflectanceCorrector","modifier","with","MODIS","data","."]
code: def test_reflectance_corrector_modis(self):
      """Test ReflectanceCorrector modifier with MODIS data."""
      from satpy.modifiers._crefl import ReflectanceCorrector
      from satpy.tests.utils import make_dsq
  
      sataa_did = make_dsq(name="satellite_azimuth_angle")
      satza_did = make_dsq(name="satellite_zenith_angle")
      solaa_did = make_dsq(name="solar_azimuth_angle")
      solza_did = make_dsq(name="solar_zenith_angle")
      ref_cor = ReflectanceCorrector(
          optional_prerequisites=[
              sataa_did,
              satza_did,
              solaa_did,
              solza_did,
          ],
          name="1",
          prerequisites=[],
          wavelength=(0.62, 0.645, 0.67),
          resolution=250,
          calibration="reflectance",
          modifiers=("sunz_corrected", "rayleigh_corrected_crefl"),
          sensor="modis",
      )
      assert ref_cor.attrs["modifiers"] == (
          "sunz_corrected",
          "rayleigh_corrected_crefl",
      )
      assert ref_cor.attrs["calibration"] == "reflectance"
      assert ref_cor.attrs["wavelength"] == (0.62, 0.645, 0.67)
      assert ref_cor.attrs["name"] == "1"
      assert ref_cor.attrs["resolution"] == 250
      assert ref_cor.attrs["sensor"] == "modis"
      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()
  
      def make_xarray(
          name,
          calibration,
          wavelength=None,
          modifiers=None,
          resolution=1000,
      ):
          return xr.DataArray(
              dnb,
              dims=("y", "x"),
              attrs={
                  "wavelength": wavelength,
                  "level": None,
                  "modifiers": modifiers,
                  "calibration": calibration,
                  "resolution": resolution,
                  "name": name,
                  "coordinates": ["longitude", "latitude"],
                  "platform_name": "EOS-Aqua",
                  "polarization": None,
                  "sensor": "modis",
                  "units": "%",
                  "start_time": datetime(
                      2012, 8, 13, 18, 46, 1, 439838
                  ),
                  "end_time": datetime(2012, 8, 13, 18, 57, 47, 746296),
                  "area": area,
                  "ancillary_variables": [],
              },
          )
  
      c01 = make_xarray(
          "1",
          "reflectance",
          wavelength=(0.62, 0.645, 0.67),
          modifiers="sunz_corrected",
          resolution=500,
      )
      c02 = make_xarray("satellite_azimuth_angle", None)
      c03 = make_xarray("satellite_zenith_angle", None)
      c04 = make_xarray("solar_azimuth_angle", None)
      c05 = make_xarray("solar_zenith_angle", None)
      res = ref_cor([c01], [c02, c03, c04, c05])
  
      assert isinstance(res, xr.DataArray)
      assert isinstance(res.data, da.Array)
      assert res.attrs["wavelength"] == (0.62, 0.645, 0.67)
      assert res.attrs["modifiers"] == (
          "sunz_corrected",
          "rayleigh_corrected_crefl",
      )
      assert res.attrs["calibration"] == "reflectance"
      assert res.attrs["resolution"] == 500
      assert res.attrs["name"] == "1"
      assert res.attrs["platform_name"] == "EOS-Aqua"
      assert res.attrs["sensor"] == "modis"
      assert res.attrs["units"] == "%"
      assert res.attrs["start_time"] == datetime(
          2012, 8, 13, 18, 46, 1, 439838
      )
      assert res.attrs["end_time"] == datetime(
          2012, 8, 13, 18, 57, 47, 746296
      )
      assert res.attrs["area"] == area
      assert res.attrs["ancillary_variables"] == []
      data = res.values
      assert abs(np.mean(data) - 52.09372623964498) < 1e-6
      assert data.shape == (3, 5)
      unique = np.unique(data)
      np.testing.assert_allclose(
          unique, [25.43670075, 52.93221561, 77.91226236]
      )
  
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 4 for calling the TestReflectanceCorrectorModifier obj's underlying member method code with example usage: obj.test_reflectance_corrector_modis() and returns: xr