toolsrtm.spart

SPART top-of-canopy (spart_toc) and top-of-atmosphere (spart_toa) reflectance/radiance. Direct port of ToolsRTM/R/spart.R, verified against a real, unmodified ToolsRTM::SPART() call.

Note

spart_toa’s atmospheric correction (SMAC) is implemented in toolsrtm.smac and is fully sensor-agnostic, but only Sentinel-2A’s sensor coefficients are bundled as package data so far, out of the 9 the R package ships — see toolsrtm.smac’s module docstring for exactly what adding another sensor takes (a data-export exercise, not a code change), and Known limitations.

SPART: top-of-canopy (TOC) and top-of-atmosphere (TOA) reflectance/radiance.

Direct port of ToolsRTM::SPART – BSM soil reflectance (getBSM.toolsRTM/soilwat) + fourSAIL canopy BRDF + Compute_BRF (spart_toc()), plus the SMAC atmospheric TOA path (spart_toa(), toolsrtm.smac) that turns TOC reflectance into top-of-atmosphere reflectance/radiance for a specific sensor.

Scope of the TOA path: only Sentinel-2A (MSI)’s sensor coefficients are bundled so far, out of the 9 the R package ships (see toolsrtm.smac’s module docstring for why that’s a data-export exercise, not a code-scope limitation, and how to add the other 8).

toolsrtm.spart.spart_toc(inputLUT, leaf_model='PROSPECT-PRO', rsoil=None, BSMBrightness=0.5, BSMlat=25.0, BSMlon=45.0, SMp=15.0, SMC=25.0, film=0.015)[source]

Top-of-canopy BRDF reflectance, 400-2400 nm – the TOC-only part of ToolsRTM::SPART (see module docstring for what’s not ported).

Equivalent to R’s SPART(...)$rfl.toc.brdf$rfl.toc (pre-sensor- convolution values; the R function also spline-interpolates this onto a sensor’s band centers as part of output$rfl.toc.BRDF – that resampling step isn’t reproduced here, only the underlying 1 nm spectrum both are derived from).

Parameters:
  • inputLUT (dict) – fourSAIL + leaf-model keys, as in toolsrtm.canopy.foursail().

  • leaf_model ({'PROSPECT-D', 'PROSPECT-PRO'})

  • rsoil (array_like, shape (2001,), optional) – Soil reflectance, 400-2400 nm. If omitted, computed from the BSM soil model using BSMBrightness/BSMlat/BSMlon/SMp/ SMC/film (R’s SPART() defaults: brightness=0.5, lat=25, lon=45, SMp=15, SMC=25, film=0.015).

  • BSMBrightness (float)

  • BSMlat (float)

  • BSMlon (float)

  • SMp (float)

  • SMC (float)

  • film (float)

Return type:

ndarray

class toolsrtm.spart.SpartToaResult(wl_smac, rfl_toa, rad_toa, rfl_toc, rfl_toc_brdf)[source]

Bases: object

Sensor-band-resolved output of spart_toa() (R’s SPART()$output).

Parameters:
wl_smac: ndarray
rfl_toa: ndarray
rad_toa: ndarray
rfl_toc: ndarray
rfl_toc_brdf: ndarray
toolsrtm.spart.spart_toa(inputLUT, sensor=None, leaf_model='PROSPECT-PRO', rsoil=None, BSMBrightness=0.5, BSMlat=25.0, BSMlon=45.0, SMp=15.0, SMC=25.0, film=0.015, irradiance=None)[source]

Top-of-atmosphere reflectance/radiance for a specific sensor – the full ToolsRTM::SPART() pipeline (TOC BRDF + SMAC atmospheric correction), sensor-band-resolved. Direct port of ToolsRTM::SPART (against the fixed R source; see ToolsRTM/R/spart.R’s own comment on the optipar2021.Pro.CX-not-in-ToolsRTM bug already fixed there).

Parameters:
  • inputLUT (dict) – Everything spart_toc() needs (fourSAIL + leaf-model keys), plus the atmosphere keys Pa (hPa), aot550, uo3 (atm-cm), uh2o (g/cm2).

  • sensor (SmacSensor, optional) – Defaults to toolsrtm.smac.sentinel2a_msi() (the only sensor bundled so far – see module docstring).

  • leaf_model (Literal['PROSPECT-D', 'PROSPECT-PRO']) – As in spart_toc().

  • rsoil (ndarray | None) – As in spart_toc().

  • BSMBrightness (float) – As in spart_toc().

  • BSMlat (float) – As in spart_toc().

  • BSMlon (float) – As in spart_toc().

  • SMp (float) – As in spart_toc().

  • SMC (float) – As in spart_toc().

  • film (float) – As in spart_toc().

  • irradiance (array_like, shape (2001,), optional) – Extraterrestrial irradiance, 400-2400nm, W m-2 nm-1. Defaults to the bundled ToolsRTM::Extraterrestrial_irradiance.

Return type:

SpartToaResult