Absorption API
Absorption provides HITRAN line-list reading, line-shape models, interpolation models, and absorption cross-section evaluation.
HITRAN Data Management
vSmartMOM.artifact Function
artifact(molecule::AbstractString, database::AbstractString = "hitran")Given a molecule name, retrieve the path to its HITRAN line-by-line .par file.
The data source depends on the active HITRAN edition (see set_hitran_edition!):
"artifact"(default): Uses legacy HITRAN 2016 data from Julia ArtifactsAny other edition (e.g.,
"HITRAN2024"): Uses data downloaded from hitran.org, auto-downloading on first access if not already cached.
Example
# Default: HITRAN 2016 from Artifacts
path = artifact("CO2")
# After switching edition:
set_hitran_edition!("HITRAN2024")
path = artifact("CO2") # downloads from hitran.org on first callvSmartMOM.fetch_hitran Function
fetch_hitran(molecule::AbstractString; numin=0, numax=150000,
edition="HITRAN2024", force=false)Download HITRAN line-by-line data for a molecule directly from hitran.org.
Analogous to HAPI's fetch(). Resolves the molecule name to all its isotopologue global IDs and queries the HITRAN API. Data is cached locally; subsequent calls return the cached path unless force=true.
Arguments
molecule: Molecule name (e.g., "CO2", "H2O", "O3")numin: Lower wavenumber bound in cm⁻¹ (default: 0)numax: Upper wavenumber bound in cm⁻¹ (default: 150000)edition: Label for this download (default: "HITRAN2024")force: Re-download even if cached (default: false)
Returns
- Path to the downloaded
.parfile
Example
path = fetch_hitran("CO2")
path = fetch_hitran("O3"; numin=500, numax=3000, edition="HITRAN2024")vSmartMOM.fetch_hitran_by_ids Function
fetch_hitran_by_ids(name::AbstractString, iso_ids::Vector{Int};
numin=0, numax=150000, edition="HITRAN2024", force=false)Download HITRAN data using explicit global isotopologue IDs.
Lower-level variant of fetch_hitran for when you need specific isotopologues. Global IDs can be looked up via Absorption.mol_globalID(mol, iso).
Arguments
name: Label for the file (typically molecule name)iso_ids: Vector of HITRAN global isotopologue IDsnumin,numax,edition,force: Same asfetch_hitran
Returns
- Path to the downloaded
.parfile
vSmartMOM.set_hitran_edition! Function
set_hitran_edition!(edition::AbstractString)Set the active HITRAN edition. Valid values:
"artifact"— use legacy HITRAN 2016 data from Julia Artifacts (default)Any other string (e.g.,
"HITRAN2024") — use data downloaded from hitran.org, stored in a local scratch-space cache. Data is auto-downloaded on first access.
Example
set_hitran_edition!("HITRAN2024") # switch to latest HITRAN
set_hitran_edition!("artifact") # back to legacyvSmartMOM.get_hitran_edition Function
get_hitran_edition()Return the currently active HITRAN edition string.
sourcevSmartMOM.available_hitran_editions Function
available_hitran_editions()List all locally available HITRAN editions. Always includes "artifact" (legacy HITRAN 2016). Additional editions appear as they are downloaded to the scratch cache.
vSmartMOM.hitran_info Function
hitran_info(molecule::AbstractString)Return metadata for the given molecule under the current HITRAN edition.
For "artifact" edition, returns basic info. For downloaded editions, returns the full metadata from the .meta.toml file (edition, download date, wavenumber range, SHA256, source URL).
vSmartMOM.hitran_is_cached Function
Check whether HITRAN data for a molecule is already cached for the given edition.
sourceCross-Section Workflow
vSmartMOM.Absorption.compute_absorption_cross_section Function
compute_absorption_cross_section(model::HitranModel, grid, pressure, temperature; wavelength_flag=false)Compute absorption cross-section from HITRAN line-by-line data.
Sums Voigt (or Doppler/Lorentz) line shapes over all transitions in the HITRAN table within the grid range. Uses a batched kernel to process all lines in a single launch for efficient GPU/CPU execution.
Arguments
model::HitranModel: Model with HITRAN data, broadening, wing_cutoff, CEFgrid: Wavenumber [cm⁻¹] or wavelength [nm] gridpressure::Real: Pressure (hPa)temperature::Real: Temperature (K)wavelength_flag::Bool=false: If true, grid is wavelength in nm
Returns
Array: Absorption cross-section (cm²/molecule) at each grid point
compute_absorption_cross_section(model::InterpolationModel, grid, pressure, temperature; wavelength_flag=false)Compute absorption cross-section by interpolating a pre-computed lookup table.
Uses BSpline interpolation over (ν, p, T). Faster than line-by-line for repeated calls.
Arguments
model::InterpolationModel: Pre-computed interpolator with ν_grid, p_grid, t_gridgrid: Wavenumber [cm⁻¹] or wavelength [nm] gridpressure::Real: Pressure (hPa)temperature::Real: Temperature (K)wavelength_flag::Bool=false: If true, grid is wavelength in nm
Returns
Array: Interpolated absorption cross-section (cm²/molecule) at each grid point
vSmartMOM.Absorption.absorption_cross_section Function
absorption_cross_section(model, grid, pressure, temperature; wavelength_flag=false)Calculate absorption cross-section. Convenience wrapper around compute_absorption_cross_section.
Arguments
model::AbstractCrossSectionModel: HitranModel or InterpolationModelgrid: Wavelength [nm] or wavenumber [cm⁻¹] grid (see wavelength_flag)pressure::Real: Pressure (hPa)temperature::Real: Temperature (K)wavelength_flag::Bool=false: If true, grid is wavelength in nm; else wavenumber in cm⁻¹
Returns
Vector: Absorption cross-sections (cm²/molecule) at each grid point
vSmartMOM.Absorption.read_hitran Function
read_hitran(filepath; mol=-1, iso=-1, ν_min=0, ν_max=Inf, min_strength=0)Read and parse a HITRAN line-by-line data file into a HitranTable.
Filters lines by molecule, isotopologue, wavenumber range, and minimum line strength. Uses fixed-width column parsing per the HITRAN format specification.
Arguments
filepath::String: Path to HITRAN .par or .hitran filemol::Int=-1: Filter by molecule ID (-1 = all)iso::Int=-1: Filter by isotopologue ID (-1 = all)ν_min::Real=0: Minimum wavenumber (cm⁻¹)ν_max::Real=Inf: Maximum wavenumber (cm⁻¹)min_strength::Real=0: Minimum line intensity at 296 K
Returns
HitranTable: Struct with line parameters (νᵢ, Sᵢ, γ_air, γ_self, E″, etc.)
Throws
HitranEmptyError: If no lines match the filter criteria
vSmartMOM.Absorption.make_hitran_model Function
make_hitran_model(hitran::HitranTable,
broadening::AbstractBroadeningFunction;
wing_cutoff::Real=40,
vmr::Real=0,
CEF::AbstractComplexErrorFunction=HumlicekWeidemann32SDErrorFunction(),
architecture::AbstractArchitecture = default_architecture())Convenience function to make a HitranModel out of the parameters (Matches make_interpolation_model)
sourcevSmartMOM.Absorption.make_interpolation_model Function
make_interpolation_model(hitran::HitranTable,
broadening::AbstractBroadeningFunction,
wave_grid::AbstractRange{<:Real},
p_grid::AbstractRange{<:Real},
t_grid::AbstractRange{<:Real};
wavelength_flag::Bool=false,
wing_cutoff::Real=40,
vmr::Real=0,
CEF::AbstractComplexErrorFunction=HumlicekWeidemann32SDErrorFunction(),
architecture::AbstractArchitecture = default_architecture())Using a HitranModel, create an InterpolationModel by interpolating the lineshape function at the given pressure and temperature grids
sourcemake_interpolation_model(absco::AbscoTable, wave_grid, p_grid, t_grid;
wavelength_flag=false, architecture=default_architecture())Create an InterpolationModel from ABSCO tabulated cross-section data.
Linearly interpolates the pre-computed cross-sections onto the specified pressure and temperature grids. Uses the ABSCO format (ν, p, T) for the lookup table.
Arguments
absco::AbscoTable: ABSCO table with cross-sections σ(ν, p, T)wave_grid: Wavenumber [cm⁻¹] or wavelength [nm] grid (see wavelength_flag)p_grid: Pressure grid (hPa)t_grid: Temperature grid (K)
Returns
InterpolationModel: Interpolator for absorption cross-sections
Line-Shape Types
vSmartMOM.Absorption.AbstractBroadeningFunction Type
type AbstractBroadeningFunctionAbstract Broadening Function type for generic line broadening function
source