# Originally converted from the CSPP Polar2Grid SCMI Writer
# Some datasets are named differently and have not been converted to
# Satpy-style naming yet. These config entries are commented out.
writer:
  name: awips_tiled
  description: AWIPS-compatible Tiled NetCDF4 Writer
  writer: !!python/name:satpy.writers.awips_tiled.AWIPSTiledWriter
  compress: True
sectors:
  LCC:
    lower_left_lonlat: [-135, 20]
    upper_right_lonlat: [-60, 60]
    resolution: [1300000, 1300000]  # y, x
    projection: '+proj=lcc +datum=WGS84 +ellps=WGS84 +lat_0=25 +lat_1=25 +lon_0=-95 +units=m +no_defs'
  Polar:
    lower_left_lonlat: [-180, 33]
    upper_right_lonlat: [-40.5, 78]
    resolution: [1400000, 1400000]
    projection: '+proj=stere +datum=WGS84 +ellps=WGS84 +lat_0=90 +lat_ts=60.0 +lon_0=-150 +units=m'
  Mercator:
    lower_left_lonlat: [-135, 0]
    upper_right_lonlat: [-30, 50]
    resolution: [2150000, 2150000]
    projection: '+proj=merc +datum=WGS84 +ellps=WGS84 +lon_0=-95 +lat_0=0 +units=m +no_defs'
  Pacific:
    lower_left_lonlat: [120, 0]
    upper_right_lonlat: [-135, 50]
    resolution: [2150000, 2150000]
    projection: '+proj=merc +datum=WGS84 +ellps=WGS84 +lon_0=170 +lat_0=0 +units=m +no_defs'
  GOES_TEST:
    lower_left_xy: [-5434894.8851, -5434894.8851]
    upper_right_xy: [5434894.8851, 5434894.8851]
    resolution: [2500000, 2500000]
    projection: '+proj=geos +lon_0=-89.5 +h=35786023.0 +a=6378137.0 +b=6356752.31414 +sweep=x +units=m +no_defs'
  GOES_EAST:
    lower_left_xy: [-5434894.8851, -5434894.8851]
    upper_right_xy: [5434894.8851, 5434894.8851]
    resolution: [2500000, 2500000]
    projection: '+proj=geos +lon_0=-75.0 +h=35786023.0 +a=6378137.0 +b=6356752.31414 +sweep=x +units=m +no_defs'
  GOES_WEST:
    lower_left_xy: [-5434894.8851, -5434894.8851]
    upper_right_xy: [5434894.8851, 5434894.8851]
    resolution: [2500000, 2500000]
    projection: '+proj=geos +lon_0=-137.0 +h=35786023.0 +a=6378137.0 +b=6356752.31414 +sweep=x +units=m +no_defs'
  GOES_STORE:
    lower_left_xy: [-5434894.8851, -5434894.8851]
    upper_right_xy: [5434894.8851, 5434894.8851]
    resolution: [2500000, 2500000]
    projection: '+proj=geos +lon_0=-105.0 +h=35786023.0 +a=6378137.0 +b=6356752.31414 +sweep=x +units=m +no_defs'
  AHI Full Disk:
    lower_left_xy: [-5499999.901174725, -5499999.901174725]
    upper_right_xy: [5499999.901174725, 5499999.901174725]
    resolution: [2500000, 2500000]
    projection: '+proj=geos +lon_0=140.7 +h=35785863.0 +a=6378137.0 +b=6356752.3 +sweep=y +units=m +no_defs'
templates:
  polar:
    single_variable: true
    add_sector_id_global: true
    filename: '{source_name}_AII_{platform_name}_{sensor}_{name}_{sector_id}_{tile_id}_{start_time:%Y%m%d_%H%M}.nc'
    global_attributes:
      start_date_time: {}  # special handler for debugging in awips_tiled.py
#        value: "{start_time:%Y-%m-%dT%H:%M:%S}"
      product_name:
        value: "{name}"
      production_location: {}
#        value: "${ORGANIZATION}"
      awips_id: {}
#        value: "{awips_id}"  # special variable created by awips_tiled.py
      physical_element: {}
#        value: "{physical_element}"   #special variable created by awips_tiled.py
      satellite_id:
        value: "{platform_name!u}-{sensor!u}"

    coordinates:
      x:
        attributes:
          units:
            value: "{units}"
        encoding:
          dtype: "int16"
          _Unsigned: "true"
      y:
        attributes:
          units:
            value: "{units}"
        encoding:
          dtype: "int16"
          _Unsigned: "true"

    # XXX: Variable attributes *CAN NOT* be tile-specific.
    variables:
      # if no other section matches, we use this
      default:
        var_name: 'data'
        attributes:
          physical_element:
            value: '{name}'
          units: {}
          standard_name:
            value: '{standard_name}'
        encoding:
          dtype: int16
          _Unsigned: "true"


      # ACSPO Products
      acspo_sst:
        reader: acspo
        name: sst
        var_name: data
        attributes:
          physical_element:
            raw_value: ACSPO SST

      # CLAVR-x Products
      default_clavrx:
        reader: clavrx
        var_name: data
        attributes:
          units: {}
          physical_element:
            value: 'CLAVR-x {name}'
      clavrx_cloud_type:
        reader: clavrx
        name: cloud_type
        var_name: data
        attributes:
          physical_element:
            raw_value: CLAVR-x Cloud Type
          units: {}
      clavrx_cld_temp_acha:
        reader: clavrx
        name: cld_temp_acha
        var_name: data
        attributes:
          units: {}
          physical_element:
            raw_value: CLAVR-x Cloud Top Temperature (ACHA)
      clavrx_cld_height_acha:
        reader: clavrx
        name: cld_height_acha
        var_name: data
        attributes:
          units: {}
          physical_element:
            raw_value: CLAVR-x Cloud Top Height (ACHA)
      clavrx_cloud_phase:
        reader: clavrx
        name: cloud_phase
        var_name: data
        attributes:
          units: {}
          physical_element:
            raw_value: CLAVR-x Cloud Phase
      clavrx_cld_opd_dcomp:
        reader: clavrx
        name: cld_opd_dcomp
        var_name: data
        attributes:
          units: {}
          physical_element:
            raw_value: CLAVR-x Cloud Optical Depth (dcomp)
      clavrx_clld_opd_nlcomp:
        reader: clavrx
        name: cloud_opd_nlcomp
        var_name: data
        attributes:
          units: {}
          physical_element:
            raw_value: CLAVR-x Cloud Optical Depth (nlcomp)
      clavrx_cld_reff_dcomp:
        reader: clavrx
        name: cld_reff_dcomp
        var_name: data
        attributes:
          units: {}
          physical_element:
            raw_value: CLAVR-x Cloud Effective Radius (dcomp)
      clavrx_cld_reff_nlcomp:
        reader: clavrx
        name: cld_reff_nlcomp
        var_name: data
        attributes:
          units: {}
          physical_element:
            raw_value: CLAVR-x Cloud Effective Radius (nlcomp)
      clavrx_cld_emiss_acha:
        reader: clavrx
        name: cld_emiss_acha
        var_name: data
        attributes:
          units: {}
          physical_element:
            raw_value: CLAVR-x Cloud Emissivity (ACHA)
      clavrx_refl_lunar_dnb_nom:
        reader: clavrx
        name: refl_lunar_dnb_nom
        var_name: data
        attributes:
          units: {}
          physical_element:
            raw_value: CLAVR-x Cloud Lunar Reflectance
      clavrx_rain_rate:
        reader: clavrx
        name: rain_rate
        var_name: data
        attributes:
          units: {}
          physical_element:
            raw_value: CLAVR-x Rain Rate

      # AVHRR L1B products
      avhrr_band1_vis:
        name: band1_vis
        var_name: data
        attributes:
          physical_element:
            raw_value: 0.63 um
      avhrr_band2_vis:
        name: band2_vis
        var_name: data
        attributes:
          physical_element:
            raw_value: 0.86 um
      avhrr_band3a_vis:
        name: band3a_vis
        var_name: data
        attributes:
          physical_element:
            raw_value: 1.61 um
      avhrr_band3b_bt:
        name: band3b_bt
        var_name: data
        attributes:
          physical_element:
            raw_value: 3.74 um
      avhrr_band4_bt:
        name: band4_bt
        var_name: data
        attributes:
          physical_element:
            raw_value: 10.8 um
      avhrr_band5_bt:
        name: band5_bt
        var_name: data
        attributes:
          physical_element:
            raw_value: 12.0 um

      # VIIRS SDRs
      viirs_i01:
        name: I01
        var_name: data
        attributes:
          physical_element:
            raw_value: 0.64 um
      viirs_i02:
        name: I02
        var_name: data
        attributes:
          physical_element:
            raw_value: 0.86 um
      viirs_i03:
        name: I03
        var_name: data
        attributes:
          physical_element:
            raw_value: 1.61 um
      viirs_i04:
        name: I04
        var_name: data
        attributes:
          physical_element:
            raw_value: 3.74 um
      viirs_i05:
        name: I05
        var_name: data
        attributes:
          physical_element:
            raw_value: 11.5 um
      viirs_histogram_dnb:
        name: histogram_dnb
        var_name: data
        attributes:
          physical_element:
            raw_value: Histogram DNB
      viirs_adaptive_dnb:
        name: adaptive_dnb
        var_name: data
        attributes:
          physical_element:
            raw_value: Adaptive DNB
      viirs_dynamic_dnb:
        name: dynamic_dnb
        var_name: data
        attributes:
          physical_element:
            raw_value: Dynamic DNB
      viirs_hncc_dnb:
        name: hncc_dnb
        var_name: data
        attributes:
          physical_element:
            raw_value: HNCC DNB
      viirs_ifog:
        name: ssec_fog
        var_name: data
        attributes:
          physical_element:
            raw_value: Fog
      viirs_m01:
        name: M01
        var_name: data
        attributes:
          physical_element:
            raw_value: 0.41 um
      viirs_m02:
        name: M02
        var_name: data
        attributes:
          physical_element:
            raw_value: 0.45 um
      viirs_m03:
        name: M03
        var_name: data
        attributes:
          physical_element:
            raw_value: 0.49 um
      viirs_m04:
        name: M04
        var_name: data
        attributes:
          physical_element:
            raw_value: 0.56 um
      viirs_m05:
        name: M05
        var_name: data
        attributes:
          physical_element:
            raw_value: 0.67 um
      viirs_m06:
        name: M06
        var_name: data
        attributes:
          physical_element:
            raw_value: 0.75 um
      viirs_m07:
        name: M07
        var_name: data
        attributes:
          physical_element:
            raw_value: 0.86 um
      viirs_m08:
        name: M08
        var_name: data
        attributes:
          physical_element:
            raw_value: 1.24 um
      viirs_m09:
        name: M09
        var_name: data
        attributes:
          physical_element:
            raw_value: 1.38 um
      viirs_m10:
        name: M10
        var_name: data
        attributes:
          physical_element:
            raw_value: 1.61 um
      viirs_m11:
        name: M11
        var_name: data
        attributes:
          physical_element:
            raw_value: 2.25 um
      viirs_m12:
        name: M12
        var_name: data
        attributes:
          physical_element:
            raw_value: 3.70 um
      viirs_m13:
        name: M13
        var_name: data
        attributes:
          physical_element:
            raw_value: 4.05 um
      viirs_m14:
        name: M14
        var_name: data
        attributes:
          physical_element:
            raw_value: 8.6 um
      viirs_m15:
        name: M15
        var_name: data
        attributes:
          physical_element:
            raw_value: 10.8 um
      viirs_m16:
        name: M16
        var_name: data
        attributes:
          physical_element:
            raw_value: 12.0 um

      # VIIRS Corrected Reflectance
      #    viirs_viirs_crefl01:
      #      name: viirs_crefl01
      #      attributes:
#          physical_element:
#            raw_value: 0.67 um CR
      #    viirs_viirs_crefl02:
      #      name: viirs_crefl02
      #      attributes:
#          physical_element:
#            raw_value: 0.87 um CR
      #    viirs_viirs_crefl03:
      #      name: viirs_crefl03
      #      attributes:
#          physical_element:
#            raw_value: 0.49 um CR
      #    viirs_viirs_crefl04:
      #      name: viirs_crefl04
      #      attributes:
#          physical_element:
#            raw_value: 0.56 um CR
      #    viirs_viirs_crefl05:
      #      name: viirs_crefl05
      #      attributes:
#          physical_element:
#            raw_value: 1.24 um CR
      #    viirs_viirs_crefl06:
      #      name: viirs_crefl06
      #      attributes:
#          physical_element:
#            raw_value: 1.61 um CR
      #    viirs_crefl07:
      #      name: viirs_crefl07
      #      attributes:
#          physical_element:
#            raw_value: 2.25 um CR
      #    viirs_crefl08:
      #      name: viirs_crefl08
      #      attributes:
#          physical_element:
#            raw_value: 0.64 um CR
      #    viirs_crefl09:
      #      name: viirs_crefl09
      #      attributes:
#          physical_element:
#            raw_value: 0.87 um CR
      #    viirs_crefl10:
      #      name: viirs_crefl10
      #      attributes:
#          physical_element:
#            raw_value: 1.61 um CR

    # MODIS L1B Products
#    modis_vis01:
#      name: vis01
#      physical_element: 0.65 um
#    modis_vis02:
#      name: vis02
#      physical_element: 0.86 um
#    modis_vis03:
#      name: vis03
#      physical_element: 0.47 um
#    modis_vis04:
#      name: vis04
#      physical_element: 0.56 um
#    modis_vis05:
#      name: vis05
#      physical_element: 1.24 um
#    modis_vis06:
#      name: vis06
#      physical_element: 1.64 um
#    modis_vis07:
#      name: vis07
#      physical_element: 2.13 um
#    modis_vis26:
#      name: vis26
#      physical_element: 1.38 um
#    modis_bt20:
#      name: bt20
#      physical_element: 3.75 um
#    modis_bt21:
#      name: bt21
#      physical_element: Fire
#    modis_bt22:
#      name: bt22
#      physical_element: 3.96 um
#    modis_bt23:
#      name: bt23
#      physical_element: 4.05 um
#    modis_bt24:
#      name: bt24
#      physical_element: 4.47 um
#    modis_bt25:
#      name: bt25
#      physical_element: 4.52 um
#    modis_bt27:
#      name: bt27
#      physical_element: 6.7 um
#    modis_bt28:
#      name: bt28
#      physical_element: 7.3 um
#    modis_bt29:
#      name: bt29
#      physical_element: 8.6 um
#    modis_bt30:
#      name: bt30
#      physical_element: 9.7 um
#    modis_bt31:
#      name: bt31
#      physical_element: 11.0 um
#    modis_bt32:
#      name: bt32
#      physical_element: 12.0 um
#    modis_bt33:
#      name: bt33
#      physical_element: 13.3 um
#    modis_bt34:
#      name: bt34
#      physical_element: 13.6 um
#    modis_bt35:
#      name: bt35
#      physical_element: 13.9 um
#    modis_bt36:
#      name: bt36
#      physical_element: 14.2 um
#    modis_sst:
#      name: sst
#      physical_element: SST
#    modis_lst:
#      name: lst
#      physical_element: LST
#    modis_slst:
#      name: slst
#      physical_element: LSTSUM
#    modis_fog:
#      name: ssec_fog
#      physical_element: Fog
#    modis_ctt:
#      name: ctt
#      physical_element: CTT
#    modis_ndvi:
#      name: ndvi
#      physical_element: NDVI
#    modis_tpw:
#      name: tpw
#      physical_element: TPW
#    modis_ice_concentration:
#      name: ice_concentration
#      physical_element: Ice Concentration
#    modis_ist:
#      name: ist
#      physical_element: Ice Surface Temperature

    # MODIS L1B Corrected Reflectances
#    modis_crefl01_250m:
#      name: modis_crefl01_250m
#      physical_element: 0.65 um CR
#    modis_crefl01_500m:
#      name: modis_crefl01_250m
#      physical_element: 0.65 um CR
#    modis_crefl01_1000m:
#      name: modis_crefl01_1000m
#      physical_element: 0.65 um CR
#    modis_crefl02_250m:
#      name: modis_crefl02_250m
#      physical_element: 0.86 um CR
#    modis_crefl02_500m:
#      name: modis_crefl02_500m
#      physical_element: 0.86 um CR
#    modis_crefl02_1000m:
#      name: modis_crefl02_1000m
#      physical_element: 0.86 um CR
#    modis_crefl03_250m:
#      name: modis_crefl03_250m
#      physical_element: 0.47 um CR
#    modis_crefl03_500m:
#      name: modis_crefl03_500m
#      physical_element: 0.47 um CR
#    modis_crefl03_1000m:
#      name: modis_crefl03_1000m
#      physical_element: 0.47 um CR
#    modis_crefl04_250m:
#      name: modis_crefl04_250m
#      physical_element: 0.56 um CR
#    modis_crefl04_500m:
#      name: modis_crefl04_500m
#      physical_element: 0.56 um CR
#    modis_crefl04_1000m:
#      name: modis_crefl04_1000m
#      physical_element: 0.56 um CR
#    modis_crefl05_500m:
#      name: modis_crefl05_500m
#      physical_element: 1.24 um CR
#    modis_crefl05_1000m:
#      name: modis_crefl05_1000m
#      physical_element: 1.24 um CR
#    modis_crefl06_500m:
#      name: modis_crefl06_500m
#      physical_element: 1.64 um CR
#    modis_crefl06_1000m:
#      name: modis_crefl06_1000m
#      physical_element: 1.64 um CR
#    modis_crefl07_500m:
#      name: modis_crefl07_500m
#      physical_element: 2.13 um CR
#    modis_crefl07_1000m:
#      name: modis_crefl07_1000m
#      physical_element: 2.13 um CR

    # MIRS Products
#    mirs_btemp_23v:
#      name: btemp_23v
#      physical_element: MIRS 23 GHZ V
#    mirs_btemp_31v:
#      name: btemp_31v
#      physical_element: MIRS 31 GHZ V
#    mirs_btemp_50h:
#      name: btemp_50h
#      physical_element: MIRS 50 GHZ H
#    mirs_btemp_51h:
#      name: btemp_51h
#      physical_element: MIRS 51 GHZ H
#    mirs_btemp_52h:
#      name: btemp_52h
#      physical_element: MIRS 52 GHZ H
#    mirs_btemp_53h:
#      name: btemp_53h
#      physical_element: MIRS 53 GHZ H
#    mirs_btemp_54h1:
#      name: btemp_54h1
#      physical_element: MIRS 54 GHZ H-1
#    mirs_btemp_54h2:
#      name: btemp_54h2
#      physical_element: MIRS 54 GHZ H-2
#    mirs_btemp_55h:
#      name: btemp_55h
#      physical_element: MIRS 55 GHZ H
#    mirs_btemp_57h1:
#      name: btemp_57h1
#      physical_element: MIRS 57 GHZ H-1
#    mirs_btemp_57h2:
#      name: btemp_57h2
#      physical_element: MIRS 57 GHZ H-2
#    mirs_btemp_57h3:
#      name: btemp_57h3
#      physical_element: MIRS 57 GHZ H-3
#    mirs_btemp_57h4:
#      name: btemp_57h4
#      physical_element: MIRS 57 GHZ H-4
#    mirs_btemp_57h5:
#      name: btemp_57h5
#      physical_element: MIRS 57 GHZ H-5
#    mirs_btemp_57h6:
#      name: btemp_57h6
#      physical_element: MIRS 57 GHZ H-6
#    mirs_btemp_88v:
#      name: btemp_88v
#      physical_element: MIRS 88 GHZ V
#    mirs_btemp_165h:
#      name: btemp_165h
#      physical_element: MIRS 165 GHZ H
#    mirs_btemp_183h1:
#      name: btemp_183h1
#      physical_element: MIRS 183 GHZ H-1
#    mirs_btemp_183h2:
#      name: btemp_183h2
#      physical_element: MIRS 183 GHZ H-2
#    mirs_btemp_183h3:
#      name: btemp_183h3
#      physical_element: MIRS 183 GHZ H-3
#    mirs_btemp_183h4:
#      name: btemp_183h4
#      physical_element: MIRS 183 GHZ H-4
#    mirs_btemp_183h5:
#      name: btemp_183h5
#      physical_element: MIRS 183 GHZ H-5
    # MIRS BTs - NOAA-18 - AMSU-A MHS
    # MIRS BTs - NOAA-19 - AMSU-A MHS
    # MIRS BTs - M1 (metopb) - AMSU-A MHS
    # MIRS BTs - M2 (metopa) - AMSU-A MHS
#    mirs_btemp_50v:
#      name: btemp_50v
#      physical_element: MIRS 50 GHZ V
#    mirs_btemp_52v:
#      name: btemp_52v
#      physical_element: MIRS 52 GHZ V
#    mirs_btemp_54h:
#      name: btemp_54h
#      physical_element: MIRS 54 GHZ H
#    mirs_btemp_54v:
#      name: btemp_54v
#      physical_element: MIRS 54 GHZ V
#    mirs_btemp_89v1:
#      name: btemp_89v1
#      physical_element: MIRS 89 GHZ V-1
#    mirs_btemp_89v2:
#      name: btemp_89v2
#      physical_element: MIRS 89 GHZ V-2
    # 157h on OPSO NOAA site
#    mirs_btemp_157v:
#      name: btemp_157v
#      physical_element: MIRS 157 GHZ V
#    mirs_btemp_190v:
#      name: btemp_190v
#      physical_element: MIRS 190 GHZ V
#    mirs_rain_rate:
#      reader: mirs
#      name: rain_rate
#      physical_element: MIRS Rain Rate
#    mirs_snow_cover:
#      reader: mirs
#      name: snow_cover
#      physical_element: MIRS Snow Cover
#    mirs_sea_ice:
#      reader: mirs
#      name: sea_ice
#      physical_element: MIRS Sea Ice
#    mirs_swe:
#      reader: mirs
#      name: swe
#      physical_element: MIRS SWE
#    mirs_clw:
#      reader: mirs
#      name: clw
#      physical_element: MIRS CLW
#    mirs_tpw:
#      reader: mirs
#      name: tpw
#      physical_element: MIRS TPW
#    mirs_tskin:
#      reader: mirs
#      name: tskin
#      physical_element: MIRS Skin Temperature

      # AMSR-2 L1B
      amsr2_btemp_36.5h:
        name: btemp_36.5h
        var_name: data
        attributes:
          physical_element:
            raw_value: 36.5 GHz H
      amsr2_btemp_36.5v:
        name: btemp_36.5v
        var_name: data
        attributes:
          physical_element:
            raw_value: 36.5 GHz V
      amsr2_btemp_89.0ah:
        name: btemp_89.0ah
        var_name: data
        attributes:
          physical_element:
            raw_value: 89.0 GHz AH
      amsr2_btemp_89.0av:
        name: btemp_89.0av
        var_name: data
        attributes:
          physical_element:
            raw_value: 89.0 GHz AV
      amsr2_btemp_89.0bh:
        name: btemp_89.0bh
        var_name: data
        attributes:
          physical_element:
            raw_value: 89.0 GHz BH
      amsr2_btemp_89.0bv:
        name: btemp_89.0bv
        var_name: data
        attributes:
          physical_element:
            raw_value: 89.0 GHz BV

      # GEOCAT Level 1 Products
      geocat_surface_type:
        name: pixel_surface_type
        var_name: data
        attributes:
          physical_element:
            raw_value: Surface Type
      # GEOCAT Level 2 Products
  glm_l2_radc:
    single_variable: false
    # OR_GLM-L2-GLMF-M6_G16_T10_e20201105150300.nc
    filename: '{environment_prefix}_GLM-L2-GLM{scene_abbr}-{scan_mode}_{platform_shortname}_T{tile_number:02d}_{end_time:%Y%m%d%H%M%S}.nc'
    global_attributes:
      # FIXME: This should come from the reader's metadata
      dataset_name:
        value: 'OR_GLM-L2-GLM{scene_abbr}-{scan_mode}_{platform_shortname}_s{start_time:%Y%j%H%M%S0}_e{end_time:%Y%j%H%M%S0}_c{creation_time:%Y%j%H%M%S0}.nc'
      time_coverage_end:
        value: "{end_time:%Y-%m-%dT%H:%M:%S.%fZ}"
      time_coverage_start:
        value: "{start_time:%Y-%m-%dT%H:%M:%S.%fZ}"
      production_site: {}  # special handler in awips_tiled.py
      platform_ID:
        value: "{platform_shortname}"
      cdm_data_type:
        raw_value: "Image"
      spatial_resolution:
        value: "{spatial_resolution}"
      orbital_slot:
        value: "{orbital_slot}"
      # This is used by AWIPS as sectorID
      scene_id:
        value: "{scene_id}"
    coordinates:
      x:
        attributes:
          units:
            value: "{units}"
        encoding:
          dtype: "int16"
#          _Unsigned: "true"
      y:
        attributes:
          units:
            value: "{units}"
        encoding:
          dtype: "int16"
#          _Unsigned: "true"
    variables:
      DQF:
        # Not currently viewable by AWIPS
        name: DQF
        attributes:
#          physical_element:
#            raw_value: "GLM_DQF"
          units:
            raw_value: "1"
          long_name:
            value: "{long_name}"
          standard_name:
            value: "{standard_name}"
          flag_values:
            raw_key: "flag_values"
          flag_meanings:
            raw_key: "flag_meanings"
        encoding:
          dtype: int8
          _Unsigned: "true"

      flash_extent_density:
        name: "flash_extent_density"
        var_name: "Flash_extent_density"
        attributes:
#          physical_element:
#            raw_value: "GLM_Flash_Extent_Density"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
      flash_extent_density_window:
        name: "flash_extent_density_window"
        var_name: "Flash_extent_density_window"
        attributes:
#          physical_element:
#            raw_value: "GLM_Flash_Extent_Density_Window"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
      average_flash_area:
        name: "average_flash_area"
        var_name: "Average_flash_area"
        attributes:
#          physical_element:
#            raw_value: "GLM_Average_Flash_Area"
          units:
            raw_value: "km^2"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
      average_flash_area_window:
        name: "average_flash_area_window"
        var_name: "Average_flash_area_window"
        attributes:
#          physical_element:
#            raw_value: "GLM_Average_Flash_Area_Window"
          units:
            raw_value: "km^2"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
      minimum_flash_area:
        name: "minimum_flash_area"
        var_name: "Minimum_flash_area"
        attributes:
          units:
            raw_value: "km^2"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
      minimum_flash_area_window:
        name: "minimum_flash_area_window"
        var_name: "Minimum_flash_area_window"
        attributes:
          units:
            raw_value: "km^2"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
      total_optical_energy:
        name: "total_energy"
        var_name: "Total_Optical_energy"
        attributes:
#          physical_element:
#            raw_value: "GLM_Total_Optical_Energy"
          units:
            value: "{units}"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
      total_optical_energy_window:
        name: "total_energy_window"
        var_name: "Total_optical_energy_window"
        attributes:
#          physical_element:
#            raw_value: "GLM_Total_Optical_Energy_Window"
          units:
            value: "{units}"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
  glm_l2_radf:
    single_variable: false
    # OR_GLM-L2-GLMF-M6_G16_T10_e20201105150300.nc
    filename: '{environment_prefix}_GLM-L2-GLM{scene_abbr}-{scan_mode}_{platform_shortname}_T{tile_number:02d}_{end_time:%Y%m%d%H%M%S}.nc'
    global_attributes:
      # FIXME: This should come from the reader's metadata
      dataset_name:
        # XXX: global attributes don't currently know things about tiles so we hardcode this to T00
        value: 'OR_GLM-L2-GLM{scene_abbr}-{scan_mode}_{platform_shortname}_T00_e{end_time:%Y%m%d%H%M%S}.nc'
      time_coverage_end:
        value: "{end_time:%Y-%m-%dT%H:%M:%SZ}"
      time_coverage_start:
        value: "{start_time:%Y-%m-%dT%H:%M:%SZ}"
      production_site: {}  # special handler in awips_tiled.py
      platform_ID:
        value: "{platform_shortname}"
      cdm_data_type:
        raw_value: "Image"
      spatial_resolution:
        value: "{spatial_resolution}"
      orbital_slot:
        value: "{orbital_slot}"
      # This is used by AWIPS as sectorID
      scene_id:
        value: "{scene_id}"
    coordinates:
      x:
        attributes:
          units:
            value: "{units}"
        encoding:
          dtype: "int16"
      #          _Unsigned: "true"
      y:
        attributes:
          units:
            value: "{units}"
        encoding:
          dtype: "int16"
    #          _Unsigned: "true"
    variables:
      DQF:
        # Not currently viewable by AWIPS
        name: DQF
        attributes:
          #          physical_element:
          #            raw_value: "GLM_DQF"
          units:
            raw_value: "1"
          long_name:
            value: "{long_name}"
          standard_name:
            value: "{standard_name}"
          flag_values:
            raw_key: "flag_values"
          flag_meanings:
            raw_key: "flag_meanings"
        encoding:
          dtype: int8
          _Unsigned: "true"

      flash_extent_density:
        name: "flash_extent_density"
        var_name: "Flash_extent_density"
        attributes:
          #          physical_element:
          #            raw_value: "GLM_Flash_Extent_Density"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
          scale_factor: 1.0000001
          add_offset: 0.0
          _FillValue: -1
      flash_extent_density_window:
        name: "flash_extent_density_window"
        var_name: "Flash_extent_density_w5u1"
        attributes:
          #          physical_element:
          #            raw_value: "GLM_Flash_Extent_Density_Window"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
      average_flash_area:
        name: "average_flash_area"
        var_name: "Average_flash_area"
        attributes:
          #          physical_element:
          #            raw_value: "GLM_Average_Flash_Area"
          units:
            raw_value: "km^2"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
      average_flash_area_window:
        name: "average_flash_area_window"
        var_name: "Average_flash_area_w5u1"
        attributes:
          #          physical_element:
          #            raw_value: "GLM_Average_Flash_Area_Window"
          units:
            raw_value: "km^2"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
      minimum_flash_area:
        name: "minimum_flash_area"
        var_name: "Minimum_flash_area"
        attributes:
          units:
            raw_value: "km^2"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
      minimum_flash_area_window:
        name: "minimum_flash_area_window"
        var_name: "Minimum_flash_area_w5u1"
        attributes:
          units:
            raw_value: "km^2"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
      total_optical_energy:
        name: "total_energy"
        var_name: "Total_Optical_energy"
        attributes:
          #          physical_element:
          #            raw_value: "GLM_Total_Optical_Energy"
          units:
            value: "{units}"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
      total_optical_energy_window:
        name: "total_energy_window"
        var_name: "Total_optical_energy_w5u1"
        attributes:
          #          physical_element:
          #            raw_value: "GLM_Total_Optical_Energy_Window"
          units:
            value: "{units}"
          standard_name:
            value: "{standard_name}"
          long_name:
            value: "{long_name}"
        encoding:
          dtype: int16
          _Unsigned: "true"
