SPART package

Submodules

SPART.BSM module

Brightness-Shape-Moisture soil model.

Ported from the original matlat run_spart code.

Model as outlined in:
The run_spart model: A soil-plant-atmosphere radiative transfer model for satellite measurements in the solar spectrum - Yang et al.
src.spart.bsm.BSM(soilpar, soilspec)

Run the BSM soil model

Parameters:
  • soilpar (SoilParameters) – Object with attributes [B, lat, lon] / dry soil spectra, and SMp, SMC, film
  • soilspec (dict) – Contains keys [‘GSV’, ‘kw’, ‘nw’] which key the Global Soil Vectors, water absorption constants for the spectrum and water refraction index for the spectrum. Loaded in in the main run_spart script and passed to this function.
Returns:

Return type:

SoilOptics

class src.spart.bsm.SoilOptics(refl, refl_dry)

Bases: object

Class to hold soil optical reflectance spectra.

Parameters:
  • refl (np.array) – Soil reflectance spectra (with SM taken into account)
  • refl_dry (np.array) – Dry soil reflectance spectra
refl

Soil reflectance spectra (with SM taken into account)

Type:np.array
refl_dry

Dry soil reflectance spectra

Type:np.array
class src.spart.bsm.SoilParameters(B, lat, lon, SMp, SMC=None, film=None)

Bases: object

Class to hold the soil characteristics for BSM.

Parameters:
  • B (float) – Soil brightness as defined in the paper.
  • lat (float) – Soil spectral coordinate, latitiude, realistic range 80 - 120 deg for soil behavior (see paper, phi)
  • lon (float) – Soil spectral coordinate, longitude, realistic range -30 - 30 deg for soil behaviour (see paper, lambda)
  • SMp (float) – Soil moisture percentage [%]
  • SMC (float, optional) – Soil moisture carrying capacity of the soil
  • film (float, optional) – Single water film optical thickness, cm
B

Soil brightness as defined in the paper.

Type:float
lat

Soil spectral coordinate, latitiude

Type:float
lon

Soil spectral coordinate, longitude

Type:float
SMp

Soil moisture percentage [%]

Type:float
SMC

Soil moisture carrying capacity of the soil

Type:float
film

Single water film optical thickness, cm

Type:float
rdry_set

False. Declares that the object doesnt’ contain a dry soil reflectance spectra

Type:bool
class src.spart.bsm.SoilParametersFromFile(soil_file, SMp, SMC=None, film=None)

Bases: object

Class to load and hold soil reflectance spectrum from the JPL soil reflectance data available at https://speclib.jpl.nasa.gov/

Parameters:
  • soil_file (str or np.array) – path to JPL soil reflectance spectra file or array containing rdry
  • SMp (float) – Soil moisture percentage [%]
  • SMC (float, optional) – Soil moisture carrying capacity of the soil
  • film (float, optional) – Single water film optical thickness, cm
rdry_set

True. Declares that the object contains a dry soil reflectance spectra

Type:bool
rdry

Array containing soil reflectance spectrum extracted from file and interpolated to 1 nm intervals between 400 nm and 2400 nm

Type:np.array
src.spart.bsm.soilwat(rdry, nw, kw, SMp, SMC, deleff)

Model soil water effects on soil reflectance and return wet reflectance.

From original matlab code:
In this model it is assumed that the water film area is built up according to a Poisson process.

See the description in the original model paper in the top of script docstring.

Parameters:
  • rdry (np.array) – Dry soil reflectance
  • nw (np.array) – Refraction index of water
  • kw (np.array) – Absorption coefficient of water
  • SMp (float) – Soil moisture volume [%]
  • SMC (float) – Soil moisture carrying capacity
  • deleff (float) – Effective optical thickness of single water film, cm
Returns:

Wet soil reflectance spectra across 400 nm to 2400 nm

Return type:

np.array

Note

The original matlab script accepts SMp row vectors for different SM percentages. This is not implemented here but may need to be in future if there is a significant speed bonus to doing so.

SPART.PROSPECT_5D module

run_spart-python

PROSPECT 5D or PROSPECT-PRO model.

Feret et al. - PROSPECT-D: Towards modeling leaf optical properties
through a complete lifecycle

PROSPECT-PRO model.

Féret et al. (2021) - PROSPECT-PRO for estimating content of nitrogen-containing leaf proteins and other carbon-based constituents

class src.spart.prospect_5d.LeafBiology(Cab, Cca, Cw, Cdm, Cs, Cant, N, PROT=0.0, CBC=0.0)

Bases: object

Class to hold leaf biology variables.

Parameters:
  • Cab (float) – Chlorophyll concentration, micro g / cm ^ 2
  • Cca (float) – Carotenoid concentration, micro g / cm ^ 2
  • Cw (float) – Equivalent water thickness, cm
  • Cdm (float) – Leaf mass per unit area, g / cm ^ 2
  • Cs (float) – Brown pigments (from run_spart paper, unitless)
  • Cant (float) – Anthocyanin content, micro g / cm ^ 2
  • N (float) – Leaf structure parameter. Unitless.
  • PROT (float) – protein content, g / cm ^ 2
  • CBC (float) – non-protein carbon-based constituent content, g cm ^ 2
Cab

Chlorophyll concentration, micro g / cm ^ 2

Type:float
Cca

Carotenoid concentration, micro g / cm ^ 2

Type:float
Cw

Equivalent water thickness, cm

Type:float
Cdm

Leaf mass per unit area, g / cm ^ 2

Type:float
Cs

Fraction senescent material (brown pigment from run_spart paper, unitless)

Type:float
Cant

Anthocyanin content, micro g / cm ^ 2

Type:float
N

Leaf structure parameter. Unitless.

Type:float
PROT

leaf protein content, g / cm ^ 2. Default: 0.0 Range of values: 0 - 0.003 g / cm ^ 2 (Féret et al., 2021)

Type:float
CBC

non-protein carbon-based constituent content, g cm ^ 2. Default: 0.0 Range of values: 0 - 0.01 g / cm ^ 2 (Féret et al., 2021)

Type:float
rho_thermal

Reflectance in the thermal range. run_spart assumption: 0.01

Type:float
tau_thermal

Transmittance in the thermal range. run_spart assumption: 0.01

Type:float
class src.spart.prospect_5d.LeafOptics(refl, tran, kChlrel)

Bases: object

Class to hold leaf optics information.

Parameters:
  • refl (np.array) – Spectral reflectance of the leaf, 400 to 2400 nm
  • tran (np.array) – Spectral transmittance of the leaf, 400 to 2400 nm
  • kChlrel (np.array) – Relative portion of chlorophyll contribution to reflecntace / transmittance in the spectral range, 400 to 2400 nm
refl

Spectral reflectance of the leaf, 400 to 2400 nm

Type:np.array
tran

Spectral transmittance of the leaf, 400 to 2400 nm

Type:np.array
kChlrel

Relative portion of chlorophyll contribution to reflecntace / transmittance in the spectral range, 400 to 2400 nm

Type:np.array
src.spart.prospect_5d.PROSPECT_5D(leafbio, optical_params)

PROSPECT_5D model.

Parameters:
  • leafbio (LeafBiology) – Object holding user specified leaf biology model parameters.
  • optical_params (dict) – Optical parameter constants. Loaded externally and passed in.
Returns:

Contains attributes relf, tran, kChlrel for reflectance, transmittance and contribution of chlorophyll over the 400 nm to 2400 nm spectrum

Return type:

LeafOptics

src.spart.prospect_5d.calculate_tav(alpha, nr)

Calculate average transmissitivity of a dieletrie plane surface.

Parameters:
  • alpha (float) – Maximum incidence angle defining the solid angle.
  • nr (float) – Refractive index
Returns:

Transmissivity of a dielectric plane surface averages over all directions of incidence and all polarizations.

Return type:

float

Note

Lifted directly from original run_spart matlab calculations. Papers cited in original PROSPECT model:

Willstatter-Stoll Theory of Leaf Reflectance Evaluated by Ray Tracinga - Allen et al. Transmission of isotropic radiation across an interface between two dielectrics - Stern

SPART.SAILH module

SAILH Canopy model.

Ported from the original run_spart matlab code.

SAILH model outlined in:
Theory of radiative transfer models applied in optical remote sensing
  • W Verhoef 1998
class src.spart.sailh.Angles(sol_angle, obs_angle, rel_angle)

Bases: object

Class to hold solar zenith, observation zenith, and relative azimuth angles.

Parameters:
  • sol_angle (float) – Solar zenith angle, degrees
  • obs_angle (float) – Observer zenith angle, degrees
  • rel_angle (float) – Relative azimuth angle, degrees
sol_angle

Solar zenith angle, degrees

Type:float
obs_angle

Observer zenith angle, degrees

Type:float
rel_angle

Relative azimuth angle, degrees

Type:float
class src.spart.sailh.CanopyReflectances(rso, rdo, rsd, rdd)

Bases: object

class src.spart.sailh.CanopyStructure(LAI, LIDFa, LIDFb, q)

Bases: object

Class to hold canopy properties. Some are user specified, others are SAIL model assumptions.

Parameters:
  • LAI (float) – Leaf area index, 0 to 8
  • LIDFa (float) – Leaf inclination distribution function parameter a, range -1 to 1
  • LIDFb (float) – Leaf inclination distribution function parameter b, range -1 to 1
  • q (float) – Canopy hotspot parameter: leaf width / canopy height, range 0 to 0.2
LAI

Leaf area index, 0 to 8

Type:float
LIDFa

Leaf inclination distribution function parameter a, range -1 to 1

Type:float
LIDFb

Leaf inclination distribution function parameter b, range -1 to 1

Type:float
q

Canopy hotspot parameter: leaf width / canopy height, range 0 to 0.2

Type:float
nlayers

Number of layers in canopy, 60 (SAIL assumption)

Type:int
nlincl

Number of different leaf inclination angles, 13 (SAIL assumption)

Type:int
nlazi

Number of different leaf azimuth angles, 36 (SAIL assumption)

Type:int
lidf

Leaf inclination distribution function, calculated from LIDF params

Type:np.array
src.spart.sailh.SAILH(soil, leafopt, canopy, angles)

Run the SAILH model.

Parameters:
  • soil (bsm.SoilOptics) – Contains soil reflectance spectra for 400 nm to 2400 nm
  • leafopt (prospect_5d.LeafOptics) – Contains leaf reflectance and transmittance spectra, 400 nm to 2400 nm, 2500 to 15000 nm, and 16000 to 50000 nm.
  • canopy (CanopyStructure) – Contains canopy information and SAIL model assumptions
  • angles (Angles) – Holds solar zenith, observer zenith, and relative azimuth angles
Returns:

Contains the four canopy reflectances arrays as attributes rso, rdo, rsd, rdd.

Return type:

CanopyReflectances

src.spart.sailh.calculate_leafangles(LIDFa, LIDFb)

Calculate the Leaf Inclination Distribution Function as outlined by Verhoef in paper cited at the top of this script.

Parameters:
  • LIDFa (float) – Leaf inclination distribution function parameter a, range -1 to 1
  • LIDFb (float) – Leaf inclination distribution function parameter b, range -1 to 1
Returns:

Leaf inclination distribution function, calculated from LIDF

Return type:

np.array

SPART.SMAC module

SMAC model.

Library for atmospheric correction using SMAC method (Rahman and Dedieu, 1994) Original translated and improved by: Peiqi Yang, ITC, University of Twente

Adapted to Python by: George Worrall, CRS, University of Florida

class src.spart.smac.AtmosphericOptics(Ta_s, Ta_o, Tg, Ra_dd, Ra_so, Ta_ss, Ta_sd, Ta_oo, Ta_do)

Bases: object

Class to hold atmospheric optics results from the SMAC model.

Parameters:
  • Ta_s (np.array) – Total scattering transmission downard
  • Ta_o (np.array) – Total scattering transmission upward
  • Tg (np.array) – Transmittance for all gases
  • Ra_dd (np.array) – Hemispherical atmospheric reflectance for diffuse light
  • Ra_so (np.array) – Directional atmospheric reflectance for direct incidence
  • Ta_ss (np.array) – Directional transmittance for direct incidence
  • Ta_sd (np.array) – Hemispherical transmittance for direct incidence
  • Ta_oo (np.array) – Directional transmittance for direct incidence (in viewing direction)
  • Ta_do (np.array) – Hemispherical transmittance for direct incidence (in viewing direction)
Ta_s

Total scattering transmission downard

Type:np.array
Ta_o

Total scattering transmission upward

Type:np.array
Tg

Transmittance for all gases

Type:np.array
Ra_dd

Hemispherical atmospheric reflectance for diffuse light

Type:np.array
Ra_so

Directional atmospheric reflectance for direct incidence

Type:np.array
Ta_ss

Directional transmittance for direct incidence

Type:np.array
Ta_sd

Hemispherical transmittance for direct incidence

Type:np.array
Ta_oo

Directional transmittance for direct incidence (in viewing direction)

Type:np.array
Ta_do

Hemispherical transmittance for direct incidence (in viewing direction)

Type:np.array
class src.spart.smac.AtmosphericProperties(aot550, uo3, uh2o, Pa=None, alt_m=None, temp_k=None)

Bases: object

Class to hold the properties of the atmosphere used in SMAC calculations.

Parameters:
  • aot550 (float) – Aerosol optical thickness at 550 nm
  • uo3 (float) – Ozone content, cm-atm
  • uh2o (float) – Water vapour content, g cm^-2
  • Pa (float, optional) – Air pressure, hPa, defaults to 1013.25
  • alt_m (int, optional) – Altitude of observation site, used to calculate air pressure if air pressure not known.
  • temp_k (float, optional) – Temperature in kelvin used to estimate air pressure
aot550

Aerosol optical thickness at 550 nm

Type:float
uO3

Ozone content, cm-atm

Type:float
uh20

Water vapour content, g cm^-2

Type:float
Pa

Air pressure, hPa

Type:float
src.spart.smac.SMAC(angles, atm, coefs)

Run the SMAC atmosphere model.

Parameters:
  • angles (sailh.Angles) – Contains solar zenith, observational zentiy, and relative difference of azimuth angles in degrees.
  • atm (AtmosphericProperties) – Contains the atmospheric properties for the model.
  • coefs (dict) – Contains all the transmittance coefficients for different atmospheric gases at the wavelengths of the specified sensor.
Returns:

Contains atmospheric reflectance and transmittance arrays

Return type:

AtmosphericOptics

SPART.SPART module

Soil-Plant-Atmosphere Radiative Transfer model for top-of-canopy and top-of-atmosphere reflectance

Coupling bsm, PROSAIL and smac to simulate TOA reflectance

Python port coded by George Worrall (gworrall@ufl.edu) Center for Remote Sensing, University of Florida

Ported to Python from the original matlab code and model developed by:

Peiqi Yang (p.yang@utwente.nl) Christiaan van der Tol (c.vandertol@utwente.nl) Wout Verhoef (w.verhoef@utwente.nl)

University of Twente Faculty of Geo-Information Science and Earth Observation (ITC), Department of Water Resources

class src.spart.SPART(soilpar, leafbio, canopy, atm, angles, sensor, DOY)

Bases: object

run_spart model.

Parameters:
  • soilpar (SoilParameters) – Holds the soil parameters for the bsm model.
  • leafbio (LeafBiology) – Hold the leaf biology parameters for the PROSPECT model.
  • canopy (CanopyStructure) – Holds the canopy parameters for the sailh model.
  • atm (AtmosphericProperties) – Holds the atmospheric properties for the smac model.
  • sensor (str) – Name of RS platform to simulate. This is done after the SAIL stage and saves on atmospheric diffuse reflectance calculations for TOC and atmospheric correction calculations for TOA. Currently available: ‘TerraAqua-MODIS’ ‘LANDSAT4-TM’ ‘LANDSAT5-TM’ ‘LANDSAT7-ETM’ ‘LANDSAT8-OLI’ ‘Sentinel2A-MSI’ ‘Sentinel2B-MSI’ ‘Sentinel3A-OLCI’ ‘Sentinel3B-OLCI’
  • DOY (int) – Day of the year - Julian calendar
soilopt

Contains soil reflectances

Type:bsm.SoilOptics
leafopt

Contains leaf reflectance and transmittance and fraction contributed by chlorophyll

Type:prospect_5d.LeafOptics
canopyopt

Contains bidrectional and directional, diffuce and specular reflectance

Type:sailh.CanopyReflectances
R_TOC

Top of canopy reflectance

Type:np.array
R_TOA

Top of atmosphere reflectance

Type:np.array
L_TOA

Top of atmosphere radiance

Type:np.array
DOY
angles
atm
canopy
leafbio
run(debug=False)

Run the run_spart model.

Parameters:debug (bool) – if True, returns the simulated BSM derived soil spectra as well as additional output column. Default: False
Returns:Contains the radiances and reflectances columns ‘Band’ ‘L_TOA’ ‘R_TOA’ ‘R_TOC’ index by central band wavelength
Return type:pd.DataFrame
sensor
set_refl_trans_assumptions()

Sets the model assumptions about soil and leaf reflectance and transmittance in the thermal range.

These are that soil reflectance is the value for 2400 nm in the entire thermal range and that leaf relctance and transmittance are 0.01 in the thermal range (this is a model assumption that is set in the LeafBiology class in the bsm script)

Returns:
Return type:None
soilpar
class src.spart.SpectralBands

Bases: object

Class to hold definitions of spectral band ranges and wavelengths.

wlP

Range of wavelengths over which the PROSPECT model operates.

Type:np.array
wlE

Range of wavelengths in E-F excitation matrix

Type:np.array
wlF

Range of wavelengths for chlorophyll fluorescence in E-F matrix

Type:np.array
wlO

Range of wavelengths in the optical part of the spectrum

Type:np.array
wlT

Range of wavelengths in the thermal part of the spectrum

Type:np.array
wlS

Range of wavelengths for the solar spectrum. wlO and wlT combined.

Type:np.array
wlPAR

Range of wavelengths for photosynthetically active radiation

Type:np.array
nwlP

Number of optical bands

Type:int
nwlT

Number of thermal bands

Type:int
IwlP

Index of optical bands

Type:range
IwlT

Index of thermal bands

Type:range
src.spart.calculate_ET_radiance(Ea, DOY, tts)

Calculate extraterrestrial radiation.

Parameters:
  • Ea (float) – Solar constant for spectral irradiance
  • DOY (int) – Day of year, Julian calendar
  • tts (float) – Solar zenith angle in degrees
Returns:

Solar extraterrestrial spectrum

Return type:

np.array

Note

see: https://www.sciencedirect.com/topics/engineering/
extraterrestrial-radiation
src.spart.calculate_spectral_convolution(wl_hi, radiation_spectra, sensorinfo)

Calculate the spectral convolution for a given spectral response function.

Parameters:
  • wl_hi (np.array) – Arrays of wavelengths to be convolved
  • radiation_spectra (np.array) – irradiance or radiance to be convolved
  • sensorinfo (dict) – Contains keys ‘wl_srf’ -> number of bands contrib * number of bands post con ‘p_srf’ -> relative contribution of each band
Returns:

Convolution result

Return type:

np.array

src.spart.load_ET_parameters()

Load extratrerrestrial parameters from saved arrays

src.spart.load_optical_parameters()

Load optical parameters from saved arrays

src.spart.load_sensor_info(sensor)

Load RS sensor information from saved arrays

Module contents

Soil-Plant-Atmosphere Radiative Transfer model for top-of-canopy and top-of-atmosphere reflectance

Coupling bsm, PROSAIL and smac to simulate TOA reflectance

Python port coded by George Worrall (gworrall@ufl.edu) Center for Remote Sensing, University of Florida

Ported to Python from the original matlab code and model developed by:

Peiqi Yang (p.yang@utwente.nl) Christiaan van der Tol (c.vandertol@utwente.nl) Wout Verhoef (w.verhoef@utwente.nl)

University of Twente Faculty of Geo-Information Science and Earth Observation (ITC), Department of Water Resources

class src.spart.SPART(soilpar, leafbio, canopy, atm, angles, sensor, DOY)

Bases: object

run_spart model.

Parameters:
  • soilpar (SoilParameters) – Holds the soil parameters for the bsm model.
  • leafbio (LeafBiology) – Hold the leaf biology parameters for the PROSPECT model.
  • canopy (CanopyStructure) – Holds the canopy parameters for the sailh model.
  • atm (AtmosphericProperties) – Holds the atmospheric properties for the smac model.
  • sensor (str) – Name of RS platform to simulate. This is done after the SAIL stage and saves on atmospheric diffuse reflectance calculations for TOC and atmospheric correction calculations for TOA. Currently available: ‘TerraAqua-MODIS’ ‘LANDSAT4-TM’ ‘LANDSAT5-TM’ ‘LANDSAT7-ETM’ ‘LANDSAT8-OLI’ ‘Sentinel2A-MSI’ ‘Sentinel2B-MSI’ ‘Sentinel3A-OLCI’ ‘Sentinel3B-OLCI’
  • DOY (int) – Day of the year - Julian calendar
soilopt

Contains soil reflectances

Type:bsm.SoilOptics
leafopt

Contains leaf reflectance and transmittance and fraction contributed by chlorophyll

Type:prospect_5d.LeafOptics
canopyopt

Contains bidrectional and directional, diffuce and specular reflectance

Type:sailh.CanopyReflectances
R_TOC

Top of canopy reflectance

Type:np.array
R_TOA

Top of atmosphere reflectance

Type:np.array
L_TOA

Top of atmosphere radiance

Type:np.array
DOY
angles
atm
canopy
leafbio
run(debug=False)

Run the run_spart model.

Parameters:debug (bool) – if True, returns the simulated BSM derived soil spectra as well as additional output column. Default: False
Returns:Contains the radiances and reflectances columns ‘Band’ ‘L_TOA’ ‘R_TOA’ ‘R_TOC’ index by central band wavelength
Return type:pd.DataFrame
sensor
set_refl_trans_assumptions()

Sets the model assumptions about soil and leaf reflectance and transmittance in the thermal range.

These are that soil reflectance is the value for 2400 nm in the entire thermal range and that leaf relctance and transmittance are 0.01 in the thermal range (this is a model assumption that is set in the LeafBiology class in the bsm script)

Returns:
Return type:None
soilpar
class src.spart.SpectralBands

Bases: object

Class to hold definitions of spectral band ranges and wavelengths.

wlP

Range of wavelengths over which the PROSPECT model operates.

Type:np.array
wlE

Range of wavelengths in E-F excitation matrix

Type:np.array
wlF

Range of wavelengths for chlorophyll fluorescence in E-F matrix

Type:np.array
wlO

Range of wavelengths in the optical part of the spectrum

Type:np.array
wlT

Range of wavelengths in the thermal part of the spectrum

Type:np.array
wlS

Range of wavelengths for the solar spectrum. wlO and wlT combined.

Type:np.array
wlPAR

Range of wavelengths for photosynthetically active radiation

Type:np.array
nwlP

Number of optical bands

Type:int
nwlT

Number of thermal bands

Type:int
IwlP

Index of optical bands

Type:range
IwlT

Index of thermal bands

Type:range
src.spart.calculate_ET_radiance(Ea, DOY, tts)

Calculate extraterrestrial radiation.

Parameters:
  • Ea (float) – Solar constant for spectral irradiance
  • DOY (int) – Day of year, Julian calendar
  • tts (float) – Solar zenith angle in degrees
Returns:

Solar extraterrestrial spectrum

Return type:

np.array

Note

see: https://www.sciencedirect.com/topics/engineering/
extraterrestrial-radiation
src.spart.calculate_spectral_convolution(wl_hi, radiation_spectra, sensorinfo)

Calculate the spectral convolution for a given spectral response function.

Parameters:
  • wl_hi (np.array) – Arrays of wavelengths to be convolved
  • radiation_spectra (np.array) – irradiance or radiance to be convolved
  • sensorinfo (dict) – Contains keys ‘wl_srf’ -> number of bands contrib * number of bands post con ‘p_srf’ -> relative contribution of each band
Returns:

Convolution result

Return type:

np.array

src.spart.load_ET_parameters()

Load extratrerrestrial parameters from saved arrays

src.spart.load_optical_parameters()

Load optical parameters from saved arrays

src.spart.load_sensor_info(sensor)

Load RS sensor information from saved arrays