Skip to content

Index

source package isofit.atmosphere.engines

Classes

  • KernelFlowsRT — Radiative transfer emulation based on KernelFlows.jl and VSWIREmulator.jl. A description of the model can be found in:

  • LibRadTranRT

  • ModtranRT

  • 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(full_config: AtmosphereConfig, **kwargs)

Bases : BaseAtmosphere, Writer

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

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(full_config, **kwargs)

Bases : BaseAtmosphere, Writer

Methods

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, min_samples_per_nm=10, max_samples_per_nm=100, **kwargs)

Bases : BaseAtmosphere, Writer

Methods

  • samples_per_nm

  • calc_band_model

  • 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_tp7 — Read a MODTRAN TP7 file and return the data as a dictionary, one entry for each case in the file. Don't do anything but read the data; all the 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.

  • required_results_exist

  • wl2flt — Helper function to generate Gaussian distributions around the center wavelengths.

source staticmethod ModtranRT.samples_per_nm(wl, fq_resolution)

source staticmethod ModtranRT.calc_band_model(samples_per_nm: int, wavelength: float)

Raises

  • ValueError

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 = 4) → 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 method ModtranRT.load_tp7(file_path: str, num_albedos: int, num_models: int, coszen: float)

Read a MODTRAN TP7 file and return the data as a dictionary, one entry for each case in the file. Don't do anything but read the data; all the data.

Parameters

  • file_path : str — Path to the MODTRAN TP7 file

  • num_albedos : int — Number of unique albedos

  • num_models : int — Number of models per albedo

  • coszen : float — cosine of the solar zenith angle (TOA)

Returns

  • dict — Cases dictionary reordered by model then albedo.

Raises

  • ValueError

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

Raises

  • ValueError

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.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(full_config, wl=[], fwhm=[], modtran_emulation=False, **kwargs)

Bases : BaseAtmosphere, Writer

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

source method SixSRT.preSim()

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(*args, **kwargs)

Bases : BaseAtmosphere, Writer

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

  • sharded — Process sRTMnet in Zarr shard groups. This enables processing of larger-than-memory LUTs.

  • process — Process sRTMnet

  • 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.sharded(sim, sixs)

Process sRTMnet in Zarr shard groups. This enables processing of larger-than-memory LUTs.

Parameters

  • sim : isofit.radiative_transfer.engines.sixs_s.SixSRT — The 6S engine

  • sixs : xarray.Dataset — The 6S LUT of only the aux_rt_quantities

source method SimulatedModtranRT.process(sim, outshape)

Process sRTMnet

Parameters

  • sim : xarray.Dataset — The 6S LUT of only the aux_rt_quantities

  • outshape : tuple of ints — The output shape of the array

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.