Index
source package isofit.radiative_transfer.engines
Classes
-
KernelFlowsRT — Radiative transfer emulation based on KernelFlows.jl and VSWIREmulator.jl. A description of the model can be found in:
-
ModtranRT — A model of photon transport including the atmosphere.
-
SixSRT — A model of photon transport including the atmosphere.
-
SimulatedModtranRT — A hybrid surrogate-model and emulator of MODTRAN-like results. A description of the model can be found in: P.G. Brodrick, D.R. Thompson, J.E. Fahlen, M.L. Eastwood, C.M. Sarture, S.R. Lundeen, W. Olson-Duvall, N. Carmon, and R.O. Green. Generalized radiative transfer emulation for imaging spectroscopy reflectance retrievals. Remote Sensing of Environment, 261:112476, 2021.doi: 10.1016/j.rse.2021.112476.
source class KernelFlowsRT(engine_config: RadiativeTransferEngineConfig, **kwargs)
Bases : RadiativeTransferEngine
Radiative transfer emulation based on KernelFlows.jl and VSWIREmulator.jl. A description of the model can be found in:
O. Lamminpää, J. Susiluoto, J. Hobbs, J. McDuffie, A. Braverman, and H. Owhadi.
Forward model emulator for atmospheric radiative transfer using Gaussian processes
and cross validation (2024). Submitted to Atmospheric Measurement Techniques.
Methods
-
readSim — Since KF doesn't need to run simulations, readSim is where we actually do the work
source method KernelFlowsRT.assign_bounds()
Raises
-
ValueError
source method KernelFlowsRT.h5_to_dict(file)
source method KernelFlowsRT.preSim()
source method KernelFlowsRT.makeSim(point: np.array, template_only: bool = False)
source method KernelFlowsRT.readSim(in_point)
Since KF doesn't need to run simulations, readSim is where we actually do the work
Parameters
-
in_point : np.array — Input point - organized based on lut_grid, not emulator
Returns
-
dict — Dictionary of output values
Raises
-
ValueError
source method KernelFlowsRT.predict(points)
Raises
-
ValueError
source method KernelFlowsRT.predict_single_MVM(MVM, points, transfs)
source class LibRadTranRT(engine_config: RadiativeTransferEngineConfig, **kwargs)
source method LibRadTranRT.preSim()
Raises
-
ValueError
source method LibRadTranRT.makeSim(point: np.array)
Perform libRadtran simulations
Parameters
-
point : np.array — Point to process
source method LibRadTranRT.readSim(point)
source method LibRadTranRT.postSim()
source method LibRadTranRT.rebuild_cmd(point, name)
source class ModtranRT(engine_config: RadiativeTransferEngineConfig, lut_path: str = '', lut_grid: dict = None, wavelength_file: str = None, interpolator_style: str = 'mlg', build_interpolators: bool = True, overwrite_interpolator: bool = False, wl: np.array = [], fwhm: np.array = [], n_cores: int = 1)
Bases : RadiativeTransferEngine
A model of photon transport including the atmosphere.
Methods
-
parseTokens — Processes tokens returned by parseLine()
-
parseLine — Parses a single line of a .chn file into a list of token values
-
load_chn — Parses a MODTRAN channel file and extracts relevant data
-
load_tp6 — Parses relevant information from a tp6 file. Specifically, seeking a table in the unstructured text and extracting a column from it.
-
preSim — Post-initialized, pre-simulation setup
-
readSim — For a given point, parses the tp6 and chn file and returns the data
-
makeSim — Prepares the command to execute MODTRAN
-
modtran_driver — Write a MODTRAN 6.0 input file.
-
check_modtran_water_upperbound — Check to see what the max water vapor values is at the first point in the LUT
-
modtran_water_upperbound_polynomials — Polynomials as a function of ground altitude (km) to estimate upperbound of water column vapor (g/cm2).
-
modtran_aot_lowerbound_polynomials — Polynomials as a function of ground altitude (km) to estimate lowerbound of AOT at 550nm.
-
wl2flt — Helper function to generate Gaussian distributions around the center wavelengths.
source staticmethod ModtranRT.parseTokens(tokens: list, coszen: float) → dict
Processes tokens returned by parseLine()
Parameters
-
tokens : list — List of floats returned by parseLine()
-
coszen : float — cos(zenith(filename))
Returns
-
dict — Dictionary of calculated values using the tokens list
source staticmethod ModtranRT.parseLine(line: str) → list
Parses a single line of a .chn file into a list of token values
Parameters
-
line : str — Singular data line of a MODTRAN .chn file
Returns
-
list — List of floats parsed from the line
source method ModtranRT.load_chn(file: str, coszen: float, header: int = 5) → dict
Parses a MODTRAN channel file and extracts relevant data
Parameters
-
file : str — Path to a .chn file
-
coszen : float — ...
-
header : int, defaults=5 — Number of lines to skip for the header
Returns
-
chn : dict — Channel data
source staticmethod ModtranRT.load_tp6(file)
Parses relevant information from a tp6 file. Specifically, seeking a table in the unstructured text and extracting a column from it.
Parameters
-
tp6 : str — tp6 file path
Raises
-
ValueError
source method ModtranRT.preSim()
Post-initialized, pre-simulation setup
source method ModtranRT.readSim(point)
For a given point, parses the tp6 and chn file and returns the data
source method ModtranRT.makeSim(point, file=None, timeout=None)
Prepares the command to execute MODTRAN
source method ModtranRT.modtran_driver(overrides)
Write a MODTRAN 6.0 input file.
Raises
-
AttributeError
source method ModtranRT.check_modtran_water_upperbound() → float
Check to see what the max water vapor values is at the first point in the LUT
Returns
-
float — max water vapor value, or None if test fails
source staticmethod ModtranRT.modtran_water_upperbound_polynomials() → dict
Polynomials as a function of ground altitude (km) to estimate upperbound of water column vapor (g/cm2).
Returns
-
dict — 3rd degree polynomials to estimate upperbound of water column vapor
source staticmethod ModtranRT.modtran_aot_lowerbound_polynomials() → dict
Polynomials as a function of ground altitude (km) to estimate lowerbound of AOT at 550nm.
Returns
-
dict — 3rd degree polynomials to estimate lowerbound of AOT
source method ModtranRT.required_results_exist(filename_base)
source method ModtranRT.wl2flt(wavelengths: np.array, fwhms: np.array, outfile: str) → None
Helper function to generate Gaussian distributions around the center wavelengths.
Parameters
-
wavelengths : np.array — wavelength centers
-
fwhms : np.array — full width at half max
-
outfile : str — file to write to
source class SixSRT(engine_config: RadiativeTransferEngineConfig, modtran_emulation=False, **kwargs)
Bases : RadiativeTransferEngine
A model of photon transport including the atmosphere.
Methods
-
preSim — Add the 6S executable in the LUT attributes
-
makeSim — Perform 6S simulations
-
readSim — Parses a 6S output simulation file for a given point
-
postSim — Update solar_irr after simulations
-
rebuild_cmd — Build the simulation command file.
-
load_esd — Loads the earth-sun distance file
-
parse_file — Parses a 6S sim file
Add the 6S executable in the LUT attributes
source method SixSRT.makeSim(point: np.array)
Perform 6S simulations
Parameters
-
point : np.array — Point to process
source method SixSRT.readSim(point: np.array)
Parses a 6S output simulation file for a given point
Parameters
-
point : np.array — Point to process
Returns
-
data : dict — Simulated data results. These keys correspond with the expected keys of ISOFIT's LUT files
source method SixSRT.postSim()
Update solar_irr after simulations
Raises
-
FileNotFoundError
source method SixSRT.rebuild_cmd(point, wlinf, wlsup) → str
Build the simulation command file.
Parameters
-
point : np.array — conditions to alter in simulation
-
wlinf : float — shortest wavelength to run simulation for
-
wlsup: : float — longest wavelength to run simulation for
Returns
-
str — execution command
Raises
-
AttributeError
source method SixSRT.load_esd()
Loads the earth-sun distance file
source staticmethod SixSRT.parse_file(file, wl, multipart_transmittance=False, wl_size=0) → dict
Parses a 6S sim file
Parameters
-
file : str — Path to simulation file to parse
-
wl : np.array — Simulation wavelengths
-
multipart_transmittance : bool — Flag to tell program to parse up-down split transmittances
-
wl_size : int, default=0 — Size of the wavelengths dim, will trim data to this size. If zero, does no trimming
Returns
-
data : dict — Simulated data results. These keys correspond with the expected keys of ISOFIT's LUT files
Examples
from isofit.data import env
from isofit.radiative_transfer.engines import SixSRT
SixSRT.parse_file(f'{env.examples}/20151026_SantaMonica/lut/AOT550-0.0000_H2OSTR-0.5000', wl_size=3)
{'sphalb': array([0.3116, 0.3057, 0.2999]),
'rhoatm': array([0.2009, 0.1963, 0.1916]),
'transm_down_dif': array([0.53211358, 0.53993346, 0.54736113]),
'solzen': 55.21,
'coszen': 0.5705702414191993}
source class SimulatedModtranRT(engine_config: RadiativeTransferEngineConfig, lut_path: str = '', lut_grid: dict = None, wavelength_file: str = None, interpolator_style: str = 'mlg', build_interpolators: bool = True, overwrite_interpolator: bool = False, wl: np.array = [], fwhm: np.array = [], n_cores: int = 1)
Bases : RadiativeTransferEngine
A hybrid surrogate-model and emulator of MODTRAN-like results. A description of the model can be found in: P.G. Brodrick, D.R. Thompson, J.E. Fahlen, M.L. Eastwood, C.M. Sarture, S.R. Lundeen, W. Olson-Duvall, N. Carmon, and R.O. Green. Generalized radiative transfer emulation for imaging spectroscopy reflectance retrievals. Remote Sensing of Environment, 261:112476, 2021.doi: 10.1016/j.rse.2021.112476.
Methods
-
preSim — sRTMnet leverages 6S to simulate results which is best done before sRTMnet begins simulations itself
-
makeSim — sRTMnet does not implement a makeSim because it leverages 6S as its simulator As such, preSim() to create 6S, readSim() to process the 6S results
-
readSim — Resamples the predicts produced by preSim to be saved in self.lut_path
-
postSim — Post-simulation adjustments for sRTMnet.
source method SimulatedModtranRT.preSim()
sRTMnet leverages 6S to simulate results which is best done before sRTMnet begins simulations itself
Raises
-
ValueError
source method SimulatedModtranRT.makeSim(point)
sRTMnet does not implement a makeSim because it leverages 6S as its simulator As such, preSim() to create 6S, readSim() to process the 6S results
source method SimulatedModtranRT.readSim(point)
Resamples the predicts produced by preSim to be saved in self.lut_path
source method SimulatedModtranRT.postSim()
Post-simulation adjustments for sRTMnet.