1 toa_reflectance
toa_reflectance
1.1 Classes
| Name | Description |
|---|---|
| Init_rho_toa | BlockProcessor that computes TOA reflectance from TOA radiance. |
1.1.1 Init_rho_toa
toa_reflectance.Init_rho_toa(
ds,
srf=None,
solar_irradiance=None,
correct_sun_earth_distance=None,
)BlockProcessor that computes TOA reflectance from TOA radiance.
Implements the standard formula: rho_toa = pi * L_toa * d^2 / (mu_s * F0)
where d is the sun-earth distance in AU, mu_s = cos(SZA), and F0 is the extraterrestrial solar irradiance.
The processor is a no-op if rtoa is already present in the dataset. F0 can come from two sources (in order of priority): 1. As a per-pixel band variable in the dataset (F0). 2. Integrated from srf using a solar spectrum: either the solar_irradiance argument or, by default, the LISIRD p1nm spectrum. In this case F0 represents the irradiance at 1 AU.
The sun-earth distance correction (d²) can be controlled via correct_sun_earth_distance: - None (default): apply d² only when F0 is integrated from SRF (i.e., assume dataset-provided F0 already includes the correction). - True: always apply d² regardless of F0 source. - False: never apply d².
Args: ds: Input dataset used to determine which variables are already present and to parse the acquisition datetime. srf: Per-band spectral response functions used to integrate F0 when it is not available in ds. Required when names.F0 is absent from ds. solar_irradiance: Solar spectrum DataArray (wavelength axis named "wav") to integrate over srf. Defaults to the LISIRD p1nm spectrum when None. correct_sun_earth_distance: Whether to apply the sun-earth distance correction. If None (default), the correction is applied only when F0 is integrated from SRF. If True, always applied. If False, never applied.
1.2 Functions
| Name | Description |
|---|---|
| sun_earth_distance | Return the sun-earth distance in AU for a given datetime. |
1.2.1 sun_earth_distance
toa_reflectance.sun_earth_distance(t)Return the sun-earth distance in AU for a given datetime.
d is computed using a two-term Keplerian expansion of Earth’s orbit. Use it in the TOA reflectance formula as: rho = pi * L * sun_earth_distance(t)**2 / (F0 * cos(sza)) where F0 is the solar irradiance tabulated at 1 AU.
Args: t: acquisition datetime (timezone-aware or naive, UTC assumed).
Returns: Sun-earth distance in AU.