isofit.radiative_transfer.engines ================================= .. py:module:: isofit.radiative_transfer.engines Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/isofit/radiative_transfer/engines/kernel_flows/index /autoapi/isofit/radiative_transfer/engines/modtran/index /autoapi/isofit/radiative_transfer/engines/sRTMnet/index /autoapi/isofit/radiative_transfer/engines/six_s/index Attributes ---------- .. autoapisummary:: isofit.radiative_transfer.engines.Engines Classes ------- .. autoapisummary:: isofit.radiative_transfer.engines.KernelFlowsRT isofit.radiative_transfer.engines.ModtranRT isofit.radiative_transfer.engines.SixSRT isofit.radiative_transfer.engines.SimulatedModtranRT Package Contents ---------------- .. py:class:: KernelFlowsRT(engine_config: RadiativeTransferEngineConfig, **kwargs) Bases: :py:obj:`isofit.radiative_transfer.radiative_transfer_engine.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. .. py:attribute:: f .. py:attribute:: emulator_wl .. py:attribute:: emulator_internal_idx .. py:attribute:: emulator_names .. py:attribute:: points_bound_min .. py:attribute:: points_bound_max .. py:attribute:: input_transfs .. py:attribute:: output_transfs .. py:attribute:: rt_mode :value: 'rdn' .. py:method:: assign_bounds() .. py:method:: h5_to_dict(file) .. py:method:: preSim() This is an optional function that can be defined by a subclass RTE to be called directly before runSim() is executed. A subclass may return a dict containing any single or non-dimensional variables to be saved to the LUT file .. py:method:: makeSim(point: numpy.array, template_only: bool = False) Prepares and executes a radiative transfer engine's simulations :param point: conditions to alter in simulation :type point: np.array :param template_only: only write template file and then stop :type template_only: bool .. py:method:: readSim(in_point) Since KF doesn't need to run simulations, readSim is where we actually do the work :param in_point: Input point - organized based on lut_grid, not emulator :type in_point: np.array :returns: Dictionary of output values :rtype: dict .. py:method:: predict(points) .. py:method:: predict_single_MVM(MVM, points, transfs) .. py: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: numpy.array = [], fwhm: numpy.array = []) Bases: :py:obj:`isofit.radiative_transfer.radiative_transfer_engine.RadiativeTransferEngine` A model of photon transport including the atmosphere. .. py:attribute:: max_buffer_time :value: 0.5 .. py:method:: parseTokens(tokens: list, coszen: float) -> dict :staticmethod: Processes tokens returned by parseLine() :param tokens: List of floats returned by parseLine() :type tokens: list :param coszen: cos(zenith(filename)) :type coszen: float :returns: Dictionary of calculated values using the tokens list :rtype: dict .. py:method:: parseLine(line: str) -> list :staticmethod: Parses a single line of a .chn file into a list of token values :param line: Singular data line of a MODTRAN .chn file :type line: str :returns: List of floats parsed from the line :rtype: list .. py:method:: load_chn(file: str, coszen: float, header: int = 5) -> dict Parses a MODTRAN channel file and extracts relevant data :param file: Path to a .chn file :type file: str :param coszen: ... :type coszen: float :param header: Number of lines to skip for the header :type header: int, defaults=5 :returns: **chn** -- Channel data :rtype: dict .. py:method:: load_tp6(file) :staticmethod: Parses relevant information from a tp6 file. Specifically, seeking a table in the unstructured text and extracting a column from it. :param tp6: tp6 file path :type tp6: str .. py:method:: preSim() Post-initialized, pre-simulation setup .. py:method:: readSim(point) For a given point, parses the tp6 and chn file and returns the data .. py:method:: makeSim(point, file=None, timeout=None) Prepares the command to execute MODTRAN .. py:method:: modtran_driver(overrides) Write a MODTRAN 6.0 input file. .. py:method:: check_modtran_water_upperbound() -> float Check to see what the max water vapor values is at the first point in the LUT :returns: max water vapor value, or None if test fails :rtype: float .. py:method:: modtran_water_upperbound_polynomials() -> dict :staticmethod: Polynomials as a function of ground altitude (km) to estimate upperbound of water column vapor (g/cm2). :returns: 3rd degree polynomials to estimate upperbound of water column vapor :rtype: dict .. py:method:: modtran_aot_lowerbound_polynomials() -> dict :staticmethod: Polynomials as a function of ground altitude (km) to estimate lowerbound of AOT at 550nm. :returns: 3rd degree polynomials to estimate lowerbound of AOT :rtype: dict .. py:method:: required_results_exist(filename_base) .. py:method:: wl2flt(wavelengths: numpy.array, fwhms: numpy.array, outfile: str) -> None Helper function to generate Gaussian distributions around the center wavelengths. :param wavelengths: wavelength centers :param fwhms: full width at half max :param outfile: file to write to .. py:class:: SixSRT(engine_config: RadiativeTransferEngineConfig, modtran_emulation=False, **kwargs) Bases: :py:obj:`isofit.radiative_transfer.radiative_transfer_engine.RadiativeTransferEngine` A model of photon transport including the atmosphere. .. py:attribute:: modtran_emulation :value: False .. py:attribute:: wl .. py:attribute:: fwhm .. py:attribute:: engine_base_dir .. py:attribute:: exe .. py:attribute:: co2_mode :value: False .. py:method:: preSim() Add the 6S executable in the LUT attributes .. py:method:: makeSim(point: numpy.array) Perform 6S simulations :param point: Point to process :type point: np.array .. py:method:: readSim(point: numpy.array) Parses a 6S output simulation file for a given point :param point: Point to process :type point: np.array :returns: **data** -- Simulated data results. These keys correspond with the expected keys of ISOFIT's LUT files :rtype: dict .. py:method:: postSim() Update solar_irr after simulations .. py:method:: rebuild_cmd(point, wlinf, wlsup) -> str Build the simulation command file. :param point: conditions to alter in simulation :type point: np.array :param wlinf: shortest wavelength to run simulation for :type wlinf: float :param wlsup: (float): longest wavelength to run simulation for :returns: execution command :rtype: str .. py:method:: load_esd() Loads the earth-sun distance file .. py:method:: parse_file(file, wl, multipart_transmittance=False, wl_size=0) -> dict :staticmethod: Parses a 6S sim file :param file: Path to simulation file to parse :type file: str :param wl: Simulation wavelengths :type wl: np.array :param multipart_transmittance: Flag to tell program to parse up-down split transmittances :type multipart_transmittance: bool :param wl_size: Size of the wavelengths dim, will trim data to this size. If zero, does no trimming :type wl_size: int, default=0 :returns: **data** -- Simulated data results. These keys correspond with the expected keys of ISOFIT's LUT files :rtype: dict .. rubric:: 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} .. py: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: numpy.array = [], fwhm: numpy.array = []) Bases: :py:obj:`isofit.radiative_transfer.radiative_transfer_engine.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. .. py:attribute:: lut_quantities .. py:attribute:: aux_quantities .. py:attribute:: _disable_makeSim :value: True .. py:method:: preSim() sRTMnet leverages 6S to simulate results which is best done before sRTMnet begins simulations itself .. py:method:: 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 .. py:method:: readSim(point) Resamples the predicts produced by preSim to be saved in self.lut_path .. py:method:: postSim() Post-simulation adjustments for sRTMnet. .. py:data:: Engines