toolsrtm.smac

SMAC (Simplified Method for Atmospheric Correction, Rahman & Dedieu 1994) atmospheric radiative transfer, and the per-sensor coefficient/spectral- response data it needs. Direct port of ToolsRTM::get.smac/ get.coef.SMAC/get.spectral.convolution.

Note

The atmospheric-correction physics (get_smac(), spectral_convolution()) is fully general and sensor-agnostic given a SmacSensor – only Sentinel-2A (MSI)’s data is bundled as package data so far, out of the 9 sensors the R package ships. See the module docstring for the exact R-side export recipe to add another sensor (a data-export exercise, not a code change).

SMAC (Simplified Method for Atmospheric Correction, Rahman & Dedieu 1994) atmospheric radiative transfer, and the sensor coefficient/spectral-response data it needs – the piece that turns SPART’s top-of-canopy (TOC) BRDF into top-of-atmosphere (TOA) reflectance/radiance for a specific sensor.

Direct port of ToolsRTM::get.smac/get.coef.SMAC/get.spectral.convolution (ToolsRTM/R/get.smac.R, get.coef.SMAC.R, Spectral.convolution.R).

Scope: all 9 sensors the R package ships are bundled – Landsat 4/5/7/8, Sentinel-2A/B, Sentinel-3A/B, Terra/Aqua MODIS (see ToolsRTM/data/*.rda and SENSORS/get_sensor()). The atmospheric-correction physics (get_smac(), spectral_convolution()) is fully general and sensor-agnostic given a SmacSensor; each sensor’s coefficient/SRF tables were exported via python/scratch/scratch_export_smac_sensors.R. Sentinel-2A verified against a real, unmodified ToolsRTM::SPART() call (see toolsrtm.spart.spart_toa()); the other 8 verified against a real ToolsRTM::get.smac() call each (see tests/test_smac.py).

class toolsrtm.smac.SmacSensor(mission, wl_smac, coef, wl_srf, p_srf)[source]

Bases: object

One sensor’s SMAC coefficients + spectral-response data (subset of R’s sensor list, e.g. ToolsRTM::Sentinel2A.MSI, actually used by get_smac()/spectral_convolution()).

Parameters:
mission: str
wl_smac: ndarray
coef: dict
wl_srf: ndarray
p_srf: ndarray
toolsrtm.smac.SENSORS = {'LANDSAT4.TM': <functools._lru_cache_wrapper object>, 'LANDSAT5.TM': <functools._lru_cache_wrapper object>, 'LANDSAT7.ETM': <functools._lru_cache_wrapper object>, 'LANDSAT8.OLI': <functools._lru_cache_wrapper object>, 'Sentinel2A.MSI': <functools._lru_cache_wrapper object>, 'Sentinel2B.MSI': <functools._lru_cache_wrapper object>, 'Sentinel3A.OLCI': <functools._lru_cache_wrapper object>, 'Sentinel3B.OLCI': <functools._lru_cache_wrapper object>, 'TerraAqua.MODIS': <functools._lru_cache_wrapper object>}

Every bundled sensor, by the same short name used in R’s ToolsRTM::get.smac(sensor=...).

toolsrtm.smac.get_sensor(name)[source]

Look up a bundled sensor by name (see SENSORS for the exact keys, matching R’s own sensor object names).

Parameters:

name (str)

Return type:

SmacSensor

toolsrtm.smac.sentinel2a_msi()[source]

Sentinel-2A MSI: 13 bands. Direct export of ToolsRTM::Sentinel2A.MSI.

Return type:

SmacSensor

toolsrtm.smac.sentinel2b_msi()[source]

Sentinel-2B MSI: 13 bands. Direct export of ToolsRTM::Sentinel2B.MSI.

Return type:

SmacSensor

toolsrtm.smac.sentinel3a_olci()[source]

Sentinel-3A OLCI: 21 bands. Direct export of ToolsRTM::Sentinel3A.OLCI.

Return type:

SmacSensor

toolsrtm.smac.sentinel3b_olci()[source]

Sentinel-3B OLCI: 21 bands. Direct export of ToolsRTM::Sentinel3B.OLCI.

Return type:

SmacSensor

toolsrtm.smac.landsat4_tm()[source]

Landsat 4 TM: 6 bands. Direct export of ToolsRTM::LANDSAT4.TM.

Return type:

SmacSensor

toolsrtm.smac.landsat5_tm()[source]

Landsat 5 TM: 6 bands. Direct export of ToolsRTM::LANDSAT5.TM.

Return type:

SmacSensor

toolsrtm.smac.landsat7_etm()[source]

Landsat 7 ETM+: 6 bands. Direct export of ToolsRTM::LANDSAT7.ETM.

Return type:

SmacSensor

toolsrtm.smac.landsat8_oli()[source]

Landsat 8 OLI: 9 bands. Direct export of ToolsRTM::LANDSAT8.OLI.

Return type:

SmacSensor

toolsrtm.smac.terra_aqua_modis()[source]

Terra/Aqua MODIS: 20 bands. Direct export of ToolsRTM::TerraAqua.MODIS.

Return type:

SmacSensor

class toolsrtm.smac.SmacAtmosphere(Ta_ss, Ta_sd, Ta_oo, Ta_do, Ta_s, Ta_o, Tg, Ra_dd, Ra_so)[source]

Bases: object

Per-band atmospheric optical quantities, on sensor.wl_smac.

Parameters:
Ta_ss: ndarray
Ta_sd: ndarray
Ta_oo: ndarray
Ta_do: ndarray
Ta_s: ndarray
Ta_o: ndarray
Tg: ndarray
Ra_dd: ndarray
Ra_so: ndarray
toolsrtm.smac.get_smac(sensor, tts, tto, psi, Pa, taup550, uo3, uh2o)[source]

Atmospheric transmittance/reflectance terms (SMAC, Rahman & Dedieu 1994), per sensor band. Direct port of ToolsRTM::get.smac.

Parameters:
  • sensor (SmacSensor)

  • tts (float) – Sun zenith, view zenith, relative azimuth (degrees).

  • tto (float) – Sun zenith, view zenith, relative azimuth (degrees).

  • psi (float) – Sun zenith, view zenith, relative azimuth (degrees).

  • Pa (float) – Surface air pressure (hPa). Use ToolsRTM::get.Altitude2Pa’s formula yourself first if you only have altitude – not ported here since every call site in this port supplies Pa directly.

  • taup550 (float) – Aerosol optical thickness at 550nm.

  • uo3 (float) – Ozone content (atm-cm).

  • uh2o (float) – Water vapour content (g/cm2).

Return type:

SmacAtmosphere

toolsrtm.smac.spectral_convolution(wave, values, sensor)[source]

Weighted-average a high-resolution spectrum onto a sensor’s bands using its spectral response function (SRF). Direct port of ToolsRTM::get.spectral.convolution (the non-Sentinel-3/MODIS per-detector-averaging branch – Sentinel-2A has one SRF per band already, no colMeans step needed).

Parameters:
  • wave (array_like, shape (nwl,)) – Integer-nm wavelength grid values is defined on (must cover every SRF sample wavelength for a band to get a non-NaN result).

  • values (array_like, shape (nwl,))

  • sensor (SmacSensor)

Return type:

ndarray