Skip to content

Absorption API

Absorption provides HITRAN line-list reading, line-shape models, interpolation models, and absorption cross-section evaluation.

HITRAN Data Management

vSmartMOM.artifact Function
julia
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 Artifacts

  • Any other edition (e.g., "HITRAN2024"): Uses data downloaded from hitran.org, auto-downloading on first access if not already cached.

Example

julia
# Default: HITRAN 2016 from Artifacts
path = artifact("CO2")

# After switching edition:
set_hitran_edition!("HITRAN2024")
path = artifact("CO2")  # downloads from hitran.org on first call
source
vSmartMOM.fetch_hitran Function
julia
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 .par file

Example

julia
path = fetch_hitran("CO2")
path = fetch_hitran("O3"; numin=500, numax=3000, edition="HITRAN2024")
source
vSmartMOM.fetch_hitran_by_ids Function
julia
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 IDs

  • numin, numax, edition, force: Same as fetch_hitran

Returns

  • Path to the downloaded .par file
source
vSmartMOM.set_hitran_edition! Function
julia
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

julia
set_hitran_edition!("HITRAN2024")  # switch to latest HITRAN
set_hitran_edition!("artifact")    # back to legacy
source
vSmartMOM.get_hitran_edition Function
julia
get_hitran_edition()

Return the currently active HITRAN edition string.

source
vSmartMOM.available_hitran_editions Function
julia
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.

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

source
vSmartMOM.hitran_is_cached Function

Check whether HITRAN data for a molecule is already cached for the given edition.

source

Cross-Section Workflow

vSmartMOM.Absorption.compute_absorption_cross_section Function
julia
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, CEF

  • grid: Wavenumber [cm⁻¹] or wavelength [nm] grid

  • pressure::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
source
julia
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_grid

  • grid: Wavenumber [cm⁻¹] or wavelength [nm] grid

  • pressure::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
source
vSmartMOM.Absorption.absorption_cross_section Function
julia
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 InterpolationModel

  • grid: 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
source
vSmartMOM.Absorption.read_hitran Function
julia
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 file

  • mol::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
source
vSmartMOM.Absorption.make_hitran_model Function
julia
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)

source
vSmartMOM.Absorption.make_interpolation_model Function
julia
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

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

Line-Shape Types

vSmartMOM.Absorption.AbstractBroadeningFunction Type
julia
type AbstractBroadeningFunction

Abstract Broadening Function type for generic line broadening function

source
vSmartMOM.Absorption.Voigt Type

Voigt line broadening

source
vSmartMOM.Absorption.Lorentz Type

Lorentz line broadening

source
vSmartMOM.Absorption.Doppler Type

Doppler line broadening

source