Top-Level API
These are the functions and types most users call directly after using vSmartMOM. They load a scene, construct an RT model, run the solver, and select the compute architecture.
Scene Loading
vSmartMOM.IO.read_parameters Function
read_parameters(x)
Multi-dispatch convenience wrapper:
String (file path) → parameters_from_file
IOSource → parameters_from_source
Dict → parameters_from_dict
vSmartMOM_Parameters → pass-through
vSmartMOM.IO.parameters_from_file Function
parameters_from_file(path::AbstractString) -> vSmartMOM_ParametersLoad a registered configuration file and return a fully populated vSmartMOM_Parameters object.
The file format is selected by extension through the Formats.load_config registry. Built-in extensions are .yaml, .yml, and .toml. The loaded document must contain the same parameter schema accepted by parameters_from_dict.
Arguments
path::AbstractString: Path to a registered configuration file.
Returns
params::vSmartMOM_Parameters{FT}: Parsed parameter struct ready formodel_from_parameters.
Example
using vSmartMOM
params = parameters_from_file("config/my_scene.toml")
params.architecture = vSmartMOM.Architectures.CPU()
model = model_from_parameters(params)See also
parameters_from_sourcefor typed sources such as GEOS-Chem NetCDF.parameters_from_dictfor loading from an in-memory Dict.parameters_from_yamlfor the legacy YAML-specific wrapper.model_from_parametersto build the RT model.
vSmartMOM.IO.parameters_from_source Function
parameters_from_source(src::Formats.IOSource) -> vSmartMOM_ParametersLoad parameters from a typed IO source.
This is the extension point for non-file or domain-specific inputs: implement Formats.load_config(src::MySource) to return a configuration Dict, then parameters_from_source(src) will reuse the shared parameter parser.
vSmartMOM.IO.parameters_from_dict Function
parameters_from_dict(params_dict::Dict) -> vSmartMOM_Parameters
Convert a configuration Dict (e.g., loaded from YAML) into vSmartMOM_Parameters. Validates schema and parses radiative_transfer, geometry, atmospheric_profile, and optional absorption/scattering sections.
sourcevSmartMOM.IO.parameters_from_yaml Function
parameters_from_yaml(path::AbstractString) -> vSmartMOM_ParametersCompatibility wrapper for YAML parameter files.
New code should prefer parameters_from_file, which also supports TOML and any future registered file formats.
vSmartMOM.CoreRT.default_parameters Function
Generate default set of parameters for Radiative Transfer calculations (from ModelParameters/)
sourceModel Construction and Solver Entry Points
vSmartMOM.CoreRT.model_from_parameters Function
model_from_parameters(params::vSmartMOM_Parameters) -> RTModelConstruct an RTModel from user-supplied vSmartMOM_Parameters.
Computes all derived quantities needed by the RT solver:
Observation geometry and quadrature points
Rayleigh scattering coefficients (Greek/Cabannes)
Aerosol optics via Mie theory with δ-M truncation
Gas absorption cross-sections and optical depth profiles
Per-band Fourier truncation limits
Arguments
params::vSmartMOM_Parameters: Configuration struct (typically fromparameters_from_yaml).
Returns
model::RTModel{ARCH, FT}: Hierarchical model ready forrt_run(model).
See also
model_from_parameters(LinMode(), params)for the linearized (Jacobian) variant.parameters_from_yaml(path)to load parameters from a YAML file.
Take the parameters specified in the vSmartMOM_Parameters struct, and calculate derived attributes into an RTModel
sourcemodel_from_parameters(::LinMode, params::vSmartMOM_Parameters)Construct both the forward RTModel and the linearized RTModelLin objects from the input parameters, for use in linearized (Jacobian) RT computations.
This is the linearized counterpart of model_from_parameters(params). It computes:
- Forward optical properties (same as the forward-only model):
Rayleigh optical depth per layer and spectral point.
Aerosol optical properties (via Mie theory) with δ-M truncation.
Trace gas absorption cross-sections and optical depths.
- Linearized optical properties (derivatives of the above):
τ̇_aer[iB][iaer, 7, nSpec, nLayers]: Derivatives of aerosol τ w.r.t. 7 sub-parameters[τ_ref, nᵣ, nᵢ, rₘ, σᵣ, p₀, σp]per aerosol type.τ̇_abs[iB][NGas, nSpec, nLayers]: Derivatives of gas absorption τ w.r.t. VMR.lin_aerosol_optics[iB][iaer]: Derivatives of Mie properties (ω̃, fᵗ, greek coefficients) w.r.t. Mie parameters[nᵣ, nᵢ, rₘ, σᵣ].
Returns
model::RTModel: Forward model (optical properties, geometry, quadrature).lin_model::RTModelLin: Linearized model (all derivative arrays).
Notes
The atmospheric profile may be truncated to the observer altitude for tower/airborne sensors.
Aerosol Mie calculations use
ForwardDiff.Dualnumbers to simultaneously obtain derivatives of the extinction cross-section, single-scattering albedo, truncation factor, and greek coefficients with respect to[nᵣ, nᵢ, rₘ, σᵣ].
vSmartMOM.CoreRT.rt_run Function
rt_run(model::RTModel; i_band=1) -> (R, T, ...)Run the forward radiative transfer solver for one or more spectral bands.
Performs polarized adding-doubling RT through the atmosphere defined in model, computing top-of-atmosphere (TOA) reflectance and bottom-of-atmosphere (BOA) transmittance. The solver iterates over azimuthal Fourier moments m = 0, …, max_m-1, building layer R/T/J matrices via elemental → doubling → interaction steps, then applies surface coupling and postprocessing.
Equivalent to rt_run(noRS(), model, i_band) (no Raman scattering).
Arguments
model::RTModel: Pre-built model frommodel_from_parameters.i_band::Integer=1: Spectral band index (or vector of indices) to compute.
Returns
A tuple (R_SFI, T_SFI, ieR_SFI, ieT_SFI, hdr, bhr_uw, bhr_dw) when using source-function integration (default), where:
R_SFI::Array{FT,3}: TOA reflectance[nVZA × nStokes × nSpec]T_SFI::Array{FT,3}: BOA transmittance[nVZA × nStokes × nSpec]
For most use cases, only the first two elements are needed:
R, T = rt_run(model)Example
params = parameters_from_yaml("config/my_scene.yaml")
model = model_from_parameters(params)
R, T = rt_run(model)
R[1, 1, :] # Stokes-I reflectance at first VZA across the spectrumSee also
rt_run(model, lin_model, NAer, NGas, NSurf)for linearized RT with Jacobians.model_from_parametersto build the model from parameters.
rt_run(RS_type, model::RTModel, iBand; sources=nothing)Perform Radiative Transfer calculations with explicit Raman type.
Accepts an optional sources::AbstractSource argument (v0.6 source-term refactor, Phase 2). When nothing, the legacy F₀ default is preserved bit-for-bit. When a SourceSet (or a single AbstractSource) is supplied, the F₀ carried by the first SolarBeam is routed into RS_type.F₀ ahead of the existing SFI kernel call. Phase 5 will remove the RS_type.F₀ indirection.
Architectures
vSmartMOM.Architectures.CPU Type
CPU <: AbstractArchitectureRun on a single-core of a CPU.
sourcevSmartMOM.Architectures.GPU Type
GPU <: AbstractArchitectureRun on a single NVIDIA CUDA GPU.
sourcevSmartMOM.Architectures.MetalGPU Type
MetalGPU <: AbstractArchitectureRun on an Apple Silicon GPU through Metal.jl. Metal support is loaded through the optional vSmartMOMMetalExt package extension and requires Float32 arrays. The current Metal batched inverse path uses a conservative 32 KiB threadgroup memory guard, so large stream/Stokes matrices should use CPU or CUDA until a global-memory fallback lands.
vSmartMOM.Architectures.default_architecture Function
default_architecture()Return GPU() if CUDA is available, MetalGPU() if Metal is available, and otherwise CPU().
vSmartMOM.Architectures.array_type Function
array_type(arch::AbstractArchitecture)Return the array constructor for the given architecture (Array for CPU, CuArray for CUDA GPU, and MtlArray for MetalGPU when the matching optional backend extension is loaded).
Return the array constructor for the model's architecture
source