Skip to content

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

source
vSmartMOM.IO.parameters_from_file Function
julia
parameters_from_file(path::AbstractString) -> vSmartMOM_Parameters

Load 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

Example

julia
using vSmartMOM
params = parameters_from_file("config/my_scene.toml")
params.architecture = vSmartMOM.Architectures.CPU()
model = model_from_parameters(params)

See also

source
vSmartMOM.IO.parameters_from_source Function
julia
parameters_from_source(src::Formats.IOSource) -> vSmartMOM_Parameters

Load 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.

source
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.

source
vSmartMOM.IO.parameters_from_yaml Function
julia
parameters_from_yaml(path::AbstractString) -> vSmartMOM_Parameters

Compatibility wrapper for YAML parameter files.

New code should prefer parameters_from_file, which also supports TOML and any future registered file formats.

source
vSmartMOM.CoreRT.default_parameters Function

Generate default set of parameters for Radiative Transfer calculations (from ModelParameters/)

source

Model Construction and Solver Entry Points

vSmartMOM.CoreRT.model_from_parameters Function
julia
model_from_parameters(params::vSmartMOM_Parameters) -> RTModel

Construct 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 from parameters_from_yaml).

Returns

  • model::RTModel{ARCH, FT}: Hierarchical model ready for rt_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.

source

Take the parameters specified in the vSmartMOM_Parameters struct, and calculate derived attributes into an RTModel

source
julia
model_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:

  1. 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.

  1. 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.Dual numbers to simultaneously obtain derivatives of the extinction cross-section, single-scattering albedo, truncation factor, and greek coefficients with respect to [nᵣ, nᵢ, rₘ, σᵣ].

source
vSmartMOM.CoreRT.rt_run Function
julia
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 from model_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:

julia
R, T = rt_run(model)

Example

julia
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 spectrum

See also

source
julia
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.

source

Architectures

vSmartMOM.Architectures.CPU Type
julia
CPU <: AbstractArchitecture

Run on a single-core of a CPU.

source
vSmartMOM.Architectures.GPU Type
julia
GPU <: AbstractArchitecture

Run on a single NVIDIA CUDA GPU.

source
vSmartMOM.Architectures.MetalGPU Type
julia
MetalGPU <: AbstractArchitecture

Run 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.

source
vSmartMOM.Architectures.default_architecture Function
julia
default_architecture()

Return GPU() if CUDA is available, MetalGPU() if Metal is available, and otherwise CPU().

source
vSmartMOM.Architectures.array_type Function
julia
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).

source

Return the array constructor for the model's architecture

source