sensor_name: visir/viirs

modifiers:
  rayleigh_corrected_crefl:
    modifier: !!python/name:satpy.modifiers.atmosphere.ReflectanceCorrector
    url: "https://www.ssec.wisc.edu/~davidh/polar2grid/viirs_crefl/CMGDEM.hdf"
    known_hash: "sha256:f33f1f867d79fff4fafe128f61c154236dd74fcc97bf418ea1437977a38d0604"
    prerequisites:
    - name: satellite_azimuth_angle
      resolution: 742
    - name: satellite_zenith_angle
      resolution: 742
    - name: solar_azimuth_angle
      resolution: 742
    - name: solar_zenith_angle
      resolution: 742

  rayleigh_corrected_crefl_iband:
    modifier: !!python/name:satpy.modifiers.atmosphere.ReflectanceCorrector
    url: "https://www.ssec.wisc.edu/~davidh/polar2grid/viirs_crefl/CMGDEM.hdf"
    known_hash: "sha256:f33f1f867d79fff4fafe128f61c154236dd74fcc97bf418ea1437977a38d0604"
    prerequisites:
    - name: satellite_azimuth_angle
      resolution: 371
    - name: satellite_zenith_angle
      resolution: 371
    - name: solar_azimuth_angle
      resolution: 371
    - name: solar_zenith_angle
      resolution: 371

  rayleigh_corrected_iband:
    modifier: !!python/name:satpy.modifiers.PSPRayleighReflectance
    atmosphere: us-standard
    aerosol_type: rayleigh_only
    prerequisites:
    - name: I01
      resolution: 371
      modifiers: [sunz_corrected_iband]
    optional_prerequisites:
    - name: satellite_azimuth_angle
      resolution: 371
    - name: satellite_zenith_angle
      resolution: 371
    - name: solar_azimuth_angle
      resolution: 371
    - name: solar_zenith_angle
      resolution: 371

  rayleigh_corrected:
    modifier: !!python/name:satpy.modifiers.PSPRayleighReflectance
    atmosphere: us-standard
    aerosol_type: rayleigh_only
    prerequisites:
    - name: M05
      resolution: 742
      modifiers: [sunz_corrected]
    optional_prerequisites:
    - name: satellite_azimuth_angle
      resolution: 742
    - name: satellite_zenith_angle
      resolution: 742
    - name: solar_azimuth_angle
      resolution: 742
    - name: solar_zenith_angle
      resolution: 742

  rayleigh_corrected_marine_tropical:
    modifier: !!python/name:satpy.modifiers.PSPRayleighReflectance
    atmosphere: us-standard
    aerosol_type: marine_tropical_aerosol
    prerequisites:
    - name: M05
      resolution: 742
      modifiers: [sunz_corrected]
    optional_prerequisites:
    - name: satellite_azimuth_angle
      resolution: 742
    - name: satellite_zenith_angle
      resolution: 742
    - name: solar_azimuth_angle
      resolution: 742
    - name: solar_zenith_angle
      resolution: 742

  rayleigh_corrected_land:
    modifier: !!python/name:satpy.modifiers.PSPRayleighReflectance
    atmosphere: us-standard
    aerosol_type: continental_average_aerosol
    prerequisites:
    - name: M05
      resolution: 742
      modifiers: [sunz_corrected]
    optional_prerequisites:
    - name: satellite_azimuth_angle
      resolution: 742
    - name: satellite_zenith_angle
      resolution: 742
    - name: solar_azimuth_angle
      resolution: 742
    - name: solar_zenith_angle
      resolution: 742

  sunz_corrected:
    modifier: !!python/name:satpy.modifiers.SunZenithCorrector
    prerequisites:
    - name: solar_zenith_angle
      resolution: 742

  sunz_corrected_iband:
    modifier: !!python/name:satpy.modifiers.SunZenithCorrector
    prerequisites:
    - name: solar_zenith_angle
      resolution: 371

  nir_emissive_lowres:
    modifier: !!python/name:satpy.modifiers.NIREmissivePartFromReflectance
    prerequisites:
    - M15
    optional_prerequisites:
    - name: solar_zenith_angle
      resolution: 742

  nir_emissive_hires:
    modifier: !!python/name:satpy.modifiers.NIREmissivePartFromReflectance
    prerequisites:
    - I05
    optional_prerequisites:
    - name: solar_zenith_angle
      resolution: 371

  nir_reflectance_lowres:
    modifier: !!python/name:satpy.modifiers.NIRReflectance
    prerequisites:
    - M15
    optional_prerequisites:
    - name: solar_zenith_angle
      resolution: 742

  nir_reflectance_hires:
    modifier: !!python/name:satpy.modifiers.NIRReflectance
    prerequisites:
    - I05
    optional_prerequisites:
    - name: solar_zenith_angle
      resolution: 371

composites:

  true_color:
    compositor: !!python/name:satpy.composites.RatioSharpenedRGB
    prerequisites:
    - name: M05
      modifiers: [sunz_corrected, rayleigh_corrected]
    - name: M04
      modifiers: [sunz_corrected, rayleigh_corrected]
    - name: M03
      modifiers: [sunz_corrected, rayleigh_corrected]
    optional_prerequisites:
    - name: I01
      modifiers: [sunz_corrected_iband, rayleigh_corrected_iband]
    standard_name: true_color
    high_resolution_band: red

  true_color_crefl:
    compositor: !!python/name:satpy.composites.RatioSharpenedRGB
    prerequisites:
      - name: M05
        modifiers: [sunz_corrected, rayleigh_corrected_crefl]
      - name: M04
        modifiers: [sunz_corrected, rayleigh_corrected_crefl]
      - name: M03
        modifiers: [sunz_corrected, rayleigh_corrected_crefl]
    optional_prerequisites:
      - name: I01
        modifiers: [sunz_corrected_iband, rayleigh_corrected_crefl_iband]
    standard_name: true_color
    high_resolution_band: red

  true_color_lowres:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - name: M05
      modifiers: [sunz_corrected, rayleigh_corrected]
    - name: M04
      modifiers: [sunz_corrected, rayleigh_corrected]
    - name: M03
      modifiers: [sunz_corrected, rayleigh_corrected]
    standard_name: true_color

  true_color_lowres_crefl:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - name: M05
      modifiers: [sunz_corrected, rayleigh_corrected_crefl]
    - name: M04
      modifiers: [sunz_corrected, rayleigh_corrected_crefl]
    - name: M03
      modifiers: [sunz_corrected, rayleigh_corrected_crefl]
    standard_name: true_color

  true_color_lowres_land:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - name: M05
      modifiers: [sunz_corrected, rayleigh_corrected_land]
    - name: M04
      modifiers: [sunz_corrected, rayleigh_corrected_land]
    - name: M03
      modifiers: [sunz_corrected, rayleigh_corrected_land]
    standard_name: true_color

  true_color_lowres_marine_tropical:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - name: M05
      modifiers: [sunz_corrected, rayleigh_corrected_marine_tropical]
    - name: M04
      modifiers: [sunz_corrected, rayleigh_corrected_marine_tropical]
    - name: M03
      modifiers: [sunz_corrected, rayleigh_corrected_marine_tropical]
    standard_name: true_color

  false_color:
    compositor: !!python/name:satpy.composites.RatioSharpenedRGB
    prerequisites:
    - name: M11
      modifiers: [sunz_corrected]
    - name: M07
      modifiers: [sunz_corrected]
    - name: M05
      modifiers: [sunz_corrected, rayleigh_corrected]
    optional_prerequisites:
    - name: I01
      modifiers: [sunz_corrected_iband, rayleigh_corrected_iband]
    standard_name: false_color
    high_resolution_band: blue

  fire_temperature:
    # CIRA: Original VIIRS
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - name: M12
      calibration: radiance
    - name: M11
      calibration: radiance
    - name: M10
      calibration: radiance
    standard_name: fire_temperature
    name: fire_temperature
  fire_temperature_awips:
    # CIRA: EUMETSAT
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - name: M12
    - name: M11
    - name: M10
    standard_name: fire_temperature
    name: fire_temperature_awips

  fire_temperature_eumetsat:
    # CIRA: AWIPS
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - name: M12
    - name: M11
    - name: M10
    standard_name: fire_temperature
    name: fire_temperature_eumetsat
  fire_temperature_39refl:
    # CIRA: All bands in Reflectance units (%)
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - name: M12
      modifiers: [nir_reflectance_lowres]
    - name: M11
      modifiers: [sunz_corrected]
    - name: M10
      modifiers: [sunz_corrected]
    standard_name: fire_temperature
    name: fire_temperature_39refl

  natural_color:
    compositor: !!python/name:satpy.composites.RatioSharpenedRGB
    prerequisites:
    - name: M10
      modifiers: [sunz_corrected]
    - name: M07
      modifiers: [sunz_corrected]
    - name: M05
      modifiers: [sunz_corrected, rayleigh_corrected]
    optional_prerequisites:
    - name: I01
      modifiers: [sunz_corrected_iband, rayleigh_corrected_iband]
    standard_name: natural_color
    high_resolution_band: blue

  natural_color_sun:
    compositor: !!python/name:satpy.composites.RGBCompositor
    prerequisites:
    - name: I03
      modifiers: [sunz_corrected_iband]
    - name: I02
      modifiers: [sunz_corrected_iband]
    - name: I01
      modifiers: [sunz_corrected_iband]
    standard_name: natural_color

  natural_color_sun_lowres:
    compositor: !!python/name:satpy.composites.RGBCompositor
    prerequisites:
    - name: M10
      modifiers: [sunz_corrected]
    - name: M07
      modifiers: [sunz_corrected]
    - name: M05
      modifiers: [sunz_corrected]
    standard_name: natural_color

  true_color_raw:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - name: M05
      modifiers: [sunz_corrected]
    - name: M04
      modifiers: [sunz_corrected]
    - name: M03
      modifiers: [sunz_corrected]
    standard_name: true_color

  night_overview:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - DNB
    - DNB
    - M15
    standard_name: night_overview

  overview:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - M05
    - M07
    - M15
    standard_name: overview

  hr_overview:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - I01
    - I02
    - I05
    standard_name: overview

  night_microphysics:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - hncc_dnb
    - M12
    - M15
    standard_name: night_microphysics

  fog:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - compositor: !!python/name:satpy.composites.DifferenceCompositor
      prerequisites:
      - M16
      - M15
    - compositor: !!python/name:satpy.composites.DifferenceCompositor
      prerequisites:
      - M15
      - M14
    - M15
    standard_name: fog

  dust:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - compositor: !!python/name:satpy.composites.DifferenceCompositor
      prerequisites:
      - M16
      - M15
    - compositor: !!python/name:satpy.composites.DifferenceCompositor
      prerequisites:
      - M15
      - M14
    - M15
    standard_name: dust

  ash:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - compositor: !!python/name:satpy.composites.DifferenceCompositor
      prerequisites:
      - M16
      - M15
    - compositor: !!python/name:satpy.composites.DifferenceCompositor
      prerequisites:
      - M15
      - M14
    - M15
    standard_name: ash

  night_fog:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - compositor: !!python/name:satpy.composites.DifferenceCompositor
      prerequisites:
      - M16
      - M15
    - compositor: !!python/name:satpy.composites.DifferenceCompositor
      prerequisites:
      - M15
      - M12
    - M15
    standard_name: night_fog

  ssec_fog:
    compositor: !!python/name:satpy.composites.DifferenceCompositor
    prerequisites:
    - I05
    - I04
    standard_name: temperature_difference

  cloudtop_daytime:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - name: M12
      modifiers: [nir_emissive_lowres]
    - name: M15
    - name: M16
    standard_name: cloudtop

  hr_cloudtop_daytime:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - name: I04
      modifiers: [nir_emissive_hires]
    - name: I05
    - name: I05
    standard_name: cloudtop

  snow_lowres:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - name: M07
      modifiers: [sunz_corrected]
    - name: M10
      modifiers: [sunz_corrected]
    - name: M12
      modifiers: [nir_reflectance_lowres]
    standard_name: snow

  snow_hires:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - name: I02
      modifiers: [sunz_corrected_iband]
    - name: I03
      modifiers: [sunz_corrected_iband]
    - name: I04
      modifiers: [nir_reflectance_hires]
    standard_name: snow

  snow:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
      - name: I02
        modifiers: [sunz_corrected_iband]
      - name: I03
        modifiers: [sunz_corrected_iband]
      - name: I04
        modifiers: [nir_reflectance_hires]
    standard_name: snow

  histogram_dnb:
    compositor: !!python/name:satpy.composites.viirs.HistogramDNB
    prerequisites:
    - DNB
    - dnb_solar_zenith_angle
    standard_name: equalized_radiance
    units: "1"
  adaptive_dnb:
    compositor: !!python/name:satpy.composites.viirs.AdaptiveDNB
    prerequisites:
    - DNB
    - dnb_solar_zenith_angle
    adaptive_day: multiple
    adaptive_mixed: always
    adaptive_night: never
    standard_name: equalized_radiance
    units: "1"
  dynamic_dnb:
    compositor: !!python/name:satpy.composites.viirs.ERFDNB
    prerequisites:
    - DNB
    - dnb_solar_zenith_angle
    - dnb_lunar_zenith_angle
    - dnb_moon_illumination_fraction
    standard_name: equalized_radiance
    units: "1"
  hncc_dnb:
    compositor: !!python/name:satpy.composites.viirs.NCCZinke
    prerequisites:
    - DNB
    - dnb_solar_zenith_angle
    - dnb_lunar_zenith_angle
    - dnb_moon_illumination_fraction
    standard_name: ncc_radiance
    units: "1"

  night_overview:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
    - hncc_dnb
    - hncc_dnb
    - M15
    standard_name: night_overview

  snow_age:
    compositor: !!python/name:satpy.composites.viirs.SnowAge
    prerequisites:
    - name: M07
      modifiers: [sunz_corrected]
    - name: M08
      modifiers: [sunz_corrected]
    - name: M09
      modifiers: [sunz_corrected]
    - name: M10
      modifiers: [sunz_corrected]
    - name: M11
      modifiers: [sunz_corrected]
    standard_name: snow_age

  ocean_color:
    compositor: !!python/name:satpy.composites.RatioSharpenedRGB
    prerequisites:
    - name: M05
      modifiers: [sunz_corrected, rayleigh_corrected]
    - name: M04
      modifiers: [sunz_corrected, rayleigh_corrected]
    - name: M03
      modifiers: [sunz_corrected, rayleigh_corrected]
    optional_prerequisites:
    - name: I01
      modifiers: [sunz_corrected_iband, rayleigh_corrected_iband]
    standard_name: ocean_color
    high_resolution_band: red

  cloud_phase_distinction:
    description: >
      Day Cloud Phase Distinction RGB, for GOESR: NASA, NOAA
      Cloud Type RGB, for  EUMETSAT (https://www.eumetsat.int/website/home/Images/ImageLibrary/DAT_3958037.html)
    references:
      CIRA Quick Guide: https://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_DayCloudPhaseDistinction_final_v2.pdf
      Cloud Type recipe and typical colours: https://www.eumetsat.int/fr/media/45659
    ## it uses the default used in etc/enhancements/generic.yaml
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
      - name: M15
      - name: I01
        modifiers: [sunz_corrected_iband, rayleigh_corrected]
      - name: I03
        modifiers: [sunz_corrected_iband]
    standard_name: cloud_phase_distinction

  cloud_phase_distinction_raw:
    description: >
      same as cloud_phase_distinction
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
      - name: M15
      - name: I01
      - name: I03
    standard_name: cloud_phase_distinction

  cloud_phase:
    description: >
      EUMETSAT Cloud Phase RGB product
    references:
      EUMETRAIN Quick Guide: https://resources.eumetrain.org/rgb_quick_guides/quick_guides/CloudPhaseRGB.pdf
      Recipe : https://resources.eumetrain.org/RGBguide/recipes/RGB_recipes.pdf
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
      - name: I03
        modifiers: [sunz_corrected_iband]
      - name: M11
        modifiers: [sunz_corrected]
      - name: M05
        modifiers: [sunz_corrected, rayleigh_corrected]
    standard_name: cloud_phase

  cloud_phase_raw:
    description: >
      same as cloud_phase RGB product, without modifiers
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
      - name: I03
      - name: M11
      - name: M05
    standard_name: cloud_phase

  cimss_cloud_type:
    description: >
      Cloud Type RGB, candidate for standard FCI RGB
    references:
      EUMETRAIN Quick Guide: https://resources.eumetrain.org/rgb_quick_guides/quick_guides/CloudTypeRGB.pdf
      Recipe : https://resources.eumetrain.org/RGBguide/recipes/RGB_recipes.pdf
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
      - name: M09
        modifiers: [sunz_corrected]
      - name: I01
        modifiers: [sunz_corrected_iband]
      - name: I03
        modifiers: [sunz_corrected_iband]
    standard_name: cimss_cloud_type

  cimss_cloud_type_raw:
    description: >
      Cloud Type RGB, candidate for standard FCI RGB.  Raw version without sun zenith correction.
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
      - name: M09
      - name: I01
      - name: I03
    standard_name: cimss_cloud_type
