class_docstr: Test the CREFL modifier.
class_docstr_tok: ["Test","the","CREFL","modifier","."]
docstr: Test ReflectanceCorrector modifier with VIIRS data.
docstr_tok: ["Test","ReflectanceCorrector","modifier","with","VIIRS","data","."]
code: def test_reflectance_corrector_viirs(
      self, tmpdir, url, dem_mock_cm, dem_sds
  ):
      """Test ReflectanceCorrector modifier with VIIRS 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="I01",
          prerequisites=[],
          wavelength=(0.6, 0.64, 0.68),
          resolution=371,
          calibration="reflectance",
          modifiers=(
              "sunz_corrected_iband",
              "rayleigh_corrected_crefl_iband",
          ),
          sensor="viirs",
          url=url,
          dem_sds=dem_sds,
      )
  
      assert ref_cor.attrs["modifiers"] == (
          "sunz_corrected_iband",
          "rayleigh_corrected_crefl_iband",
      )
      assert ref_cor.attrs["calibration"] == "reflectance"
      assert ref_cor.attrs["wavelength"] == (0.6, 0.64, 0.68)
      assert ref_cor.attrs["name"] == "I01"
      assert ref_cor.attrs["resolution"] == 371
      assert ref_cor.attrs["sensor"] == "viirs"
      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, data = self.data_area_ref_corrector()
      c01 = _make_viirs_xarray(
          data,
          area,
          "I01",
          "toa_bidirectional_reflectance",
          wavelength=(0.6, 0.64, 0.68),
          units="%",
          calibration="reflectance",
      )
      c02 = _make_viirs_xarray(
          data, area, "satellite_azimuth_angle", "sensor_azimuth_angle"
      )
      c03 = _make_viirs_xarray(
          data, area, "satellite_zenith_angle", "sensor_zenith_angle"
      )
      c04 = _make_viirs_xarray(
          data, area, "solar_azimuth_angle", "solar_azimuth_angle"
      )
      c05 = _make_viirs_xarray(
          data, area, "solar_zenith_angle", "solar_zenith_angle"
      )
  
      with dem_mock_cm(tmpdir, url), assert_maximum_dask_computes(0):
          res = ref_cor([c01], [c02, c03, c04, c05])
  
      assert isinstance(res, xr.DataArray)
      assert isinstance(res.data, da.Array)
      assert res.attrs["wavelength"] == (0.6, 0.64, 0.68)
      assert res.attrs["modifiers"] == (
          "sunz_corrected_iband",
          "rayleigh_corrected_crefl_iband",
      )
      assert res.attrs["calibration"] == "reflectance"
      assert res.attrs["resolution"] == 371
      assert res.attrs["name"] == "I01"
      assert (
          res.attrs["standard_name"] == "toa_bidirectional_reflectance"
      )
      assert res.attrs["platform_name"] == "Suomi-NPP"
      assert res.attrs["sensor"] == "viirs"
      assert res.attrs["units"] == "%"
      assert res.attrs["start_time"] == datetime(
          2012, 2, 25, 18, 1, 24, 570942
      )
      assert res.attrs["end_time"] == datetime(
          2012, 2, 25, 18, 11, 21, 175760
      )
      assert res.attrs["area"] == area
      assert res.attrs["ancillary_variables"] == []
      data = res.values
      assert abs(np.mean(data) - 51.12750267805715) < 1e-6
      assert data.shape == (3, 5)
      unique = np.unique(data)
      np.testing.assert_allclose(
          unique, [25.20341703, 52.38819447, 75.79089654]
      )
  
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 3 for calling the TestReflectanceCorrectorModifier obj's underlying member method code with example usage: obj.test_reflectance_corrector_viirs(tmpdir, url, dem_mock_cm, dem_sds) without return types