1 rayleigh

rayleigh

1.1 Classes

Name Description
RayleighCorrection Block processor for applying Rayleigh scattering correction.

1.1.1 RayleighCorrection

rayleigh.RayleighCorrection(
    srf=None,
    version='polymer_legacy',
    pressure_kind='sea_level_pressure',
    sun_glint_corr=True,
    transmittance_corr=False,
    dtype='float32',
    **cfg,
)

Block processor for applying Rayleigh scattering correction.

This processor applies atmospheric Rayleigh scattering correction to satellite reflectance data using pre-computed lookup tables (LUTs).

1.1.1.1 Parameters

Name Type Description Default
srf xr.Dataset | None Sensor spectral response function for multi-wavelength correction. None
version Literal['polymer_legacy'] Version of the Rayleigh LUT to use. Currently only “polymer_legacy” is supported. "polymer_legacy"
pressure_kind Literal['surface_pressure', 'sea_level_pressure'] Type of pressure data to use. “sea_level_pressure” uses sea-level pressure, “surface_pressure” uses surface pressure. "sea_level_pressure"
sun_glint_corr bool Whether to include sun glint correction. If True, subtracts Rayleigh + glint reflectance (rho_rg); otherwise subtracts Rayleigh reflectance only (rho_r). True
transmittance_corr bool Whether to apply the Rayleigh diffuse transmittance correction. If True, the corrected reflectance rho_rc is divided by the total diffuse transmittance t_d (downward x upward), effectively compensating for remaining Rayleigh and gaseous attenuation along both the solar and sensor view paths. False

1.1.1.2 Attributes

Name Type Description
rayleigh_lut xr.Dataset Pre-computed Rayleigh scattering lookup table.
interpolator Interpolator Interpolator object for performing multi-dimensional interpolation.
pressure_kind str Type of pressure data used.

1.1.1.3 Methods

Name Description
check Check that srf bands are identical to ds.bands
1.1.1.3.1 check
rayleigh.RayleighCorrection.check(ds)

Check that srf bands are identical to ds.bands

1.2 Functions

Name Description
calc_odr Calculates ODR (Optical Depth Rayleigh)
load_rayleigh_lut Load the Rayleigh LUT (PP or SP)
main Command-line interface for Rayleigh correction processing.
process_rayleigh Run the full Rayleigh correction pipeline on a Level-1 product and write the result to disk.
process_rayleigh_dataset Apply the full Rayleigh correction pipeline to a Level-1 dataset.
rayleigh_correction Apply Rayleigh correction to ds

1.2.1 calc_odr

rayleigh.calc_odr(ds, srf=None)

Calculates ODR (Optical Depth Rayleigh)

Computes the Rayleigh optical depth based on altitude and pressure.

1.2.1.1 Parameters

Name Type Description Default
ds xr.Dataset Input dataset containing altitude and pressure information. Must contain either: - “altitude” and “surface_pressure” or “sea_level_pressure” - “cwav” (central wavelength) for single-wavelength calculation required
srf xr.Dataset | None Sensor spectral response function for multi-wavelength calculation. If provided, ODR is calculated by integrating the Rayleigh cross-section over the SRF. None

1.2.1.2 Returns

Name Type Description
xr.DataArray Rayleigh optical depth values with same dimensions as input.

1.2.1.3 Notes

  • If srf is provided, ODR is computed by integrating the Rayleigh cross-section over the SRF using the Bodhaine et al. (1999) method.
  • If srf is None, ODR is computed using the central wavelength from “cwav”

1.2.2 load_rayleigh_lut

rayleigh.load_rayleigh_lut(lut_rayleigh_pp, lut_rayleigh_sp, rayleigh, **kwargs)

Load the Rayleigh LUT (PP or SP)

Relative azimuth angle convention: standard (raa = saa - vaa)

Returns a dataset with: - reflectance_glitter (reflectance with a rough sea surface, no atmosphere) - reflectance_toa (including glitter) - T_tot_down: total transmission (downward) - T_tot_up: total transmission (upward)

1.2.3 main

rayleigh.main()

Command-line interface for Rayleigh correction processing.

1.2.4 process_rayleigh

rayleigh.process_rayleigh(
    input_product,
    reader,
    output_product,
    dem='eotools.dem.GTOPO30',
    transmittance_corr=True,
    **cfg,
)

Run the full Rayleigh correction pipeline on a Level-1 product and write the result to disk.

Loads the input product using the specified reader class, applies the Rayleigh correction via :func:process_rayleigh_dataset, and saves the result as a NetCDF file.

1.2.4.1 Parameters

Name Type Description Default
input_product Path Path to the Level-1 input product. required
reader str Dotted path of the reader class to use (e.g. eoread.planetscope.Level1_Planetscope). The class must be callable with a path and return an xr.Dataset. required
output_product Path Destination path for the output NetCDF file. required
dem str Dotted path of the DEM class to use (e.g. ‘eotools.dem.GTOPO30’ or ‘eotools.dem.CopernicusDEM’). Default is ‘eotools.dem.GTOPO30’. 'eotools.dem.GTOPO30'
transmittance_corr bool Whether to apply the Rayleigh diffuse transmittance correction to the Rayleigh-corrected reflectance. If True, rho_rc is divided by the total (downward x upward) Rayleigh diffuse transmittance t_d, which accounts for both direct and diffuse Rayleigh attenuation along the solar and sensor view paths. Default is True. True

1.2.5 process_rayleigh_dataset

rayleigh.process_rayleigh_dataset(
    input_dataset,
    dem='eotools.dem.CopernicusDEM',
    transmittance_corr=True,
)

Apply the full Rayleigh correction pipeline to a Level-1 dataset.

Runs TOA reflectance initialisation, geometry, altitude, NASA ancillary data, gaseous absorption, and Rayleigh scattering correction in sequence.

1.2.5.1 Parameters

Name Type Description Default
input_dataset xr.Dataset Level-1 dataset as returned by a reader module. required
dem str Dotted path of the DEM class to use (e.g. 'eotools.dem.GTOPO30' or 'eotools.dem.CopernicusDEM'). Default is 'eotools.dem.GTOPO30'. 'eotools.dem.CopernicusDEM'
transmittance_corr bool Whether to apply the Rayleigh diffuse transmittance correction to the Rayleigh-corrected reflectance. If True, rho_rc is divided by the total (downward x upward) Rayleigh diffuse transmittance t_d, which accounts for both direct and diffuse Rayleigh attenuation along the solar and sensor view paths. Default is True. True

1.2.5.2 Returns

Name Type Description
xr.Dataset Rayleigh-corrected dataset containing the following variables: - rho_gc : Gaseous corrected reflectances - rho_r : Rayleigh reflectance - rho_rg : Rayleigh + glint reflectance - t_d : Diffuse transmittance (upward + downward) - rho_rc : Rayleigh-corrected reflectance Other input and ancillary variables: - Rtoa : Top-of-atmosphere reflectance - cwav : Central wavelengths (nm) - altitude : Surface altitude (m) - horizontal_wind : Horizontal wind speed - sea_level_pressure : Sea level pressure - total_column_ozone : Total column ozone - total_column_water_vapour : Total column water vapour

1.2.6 rayleigh_correction

rayleigh.rayleigh_correction(ds, srf=None, **cfg)

Apply Rayleigh correction to ds

This function applies atmospheric Rayleigh scattering correction to the top-of-atmosphere reflectance data. It computes the Rayleigh-corrected reflectance and related atmospheric transmission parameters.

This creates the following variables in ds:

Variable Description
rho_rc Rayleigh-corrected signal
rho_mol_gli Rayleigh + glint reflectance
rho_mol Rayleigh reflectance (no glint)
t_d Total diffuse transmittance (downward+upward)

1.2.6.1 Parameters

Name Type Description Default
ds xr.Dataset The Dataset used for inputs/outputs. Must contain: - “altitude”: altitude above sea level - “horizontal_wind”: horizontal wind speed - “mus”: cosine of solar zenith angle - “muv”: cosine of viewing zenith angle - “raa”: relative azimuth angle (saa - vaa) - “rho_gc”: ground-corrected reflectance - “surface_pressure” or “sea_level_pressure”: atmospheric pressure required
srf xr.Dataset | None The sensor spectral response function (SRF). None
**cfg dict Additional configuration parameters passed to load_rayleigh_lut. {}

1.2.6.2 Returns

Name Type Description
xr.Dataset The input dataset with added variables: rho_rc, rho_mol_gli, rho_mol, t_d.
Note this function shoud be deprecated in favour of the class RayleighCorrection