pyLBL package

Subpackages

Submodules

pyLBL.atmosphere module

Define how atmospheric inputs are handled.

class pyLBL.atmosphere.Atmosphere(dataset, mapping=None)[source]

Bases: object

Atmospheric data container with basic data discover methods.

dataset

Input xarray Dataset.

pressure

xarray DataArray object for pressure [Pa].

temperature

xarray DataArray object for temperature [K].

gases

Dictionary of xarray DataArray objects for gas mole fractions [mol mol-1].

pyLBL.database module

Manages how the spectral input data is acquired and handled.

exception pyLBL.database.AliasNotFoundError[source]

Bases: BaseException

class pyLBL.database.ArtsCrossFitTable(**kwargs)[source]

Bases: Base

Arts-crossfit table schema.

id
molecule_id
path
exception pyLBL.database.CrossSectionNotFoundError[source]

Bases: BaseException

class pyLBL.database.Database(path, echo=False)[source]

Bases: object

Spectral line parameter database.

engine

SQLAlchemy Engine object.

arts_crossfit(name)[source]

Queries the database for all parameters needed to run ARTS Crossfit.

Parameters:

name – String molecule alias.

Returns:

Path to the cross section dataset.

Raises:

CrossSectionNotFoundError if no cross sections are found.

create(hitran_webapi, molecules='all', tips_webapi=None, cross_section_directory='.cross-sections')[source]

Downloads data from HITRAN and TIPS and inserts it into the database tables.

Parameters:
  • hitran_webapi – HitranWebApi object.

  • molecules – List of string molecule chemical formulae.

  • tips_webapi – TipsWebApi object.

  • cross_section_directory – Directory to download cross sections to.

gas(name)[source]

Queries the database for all parameters needed to run a line-by-line calculation.

Parameters:

name – String molecule alias.

Returns:

String chemical formula. mass: List of float isotopologue masses. transitions: List of TransitionTable objects. TotalPartionFunction: TotalPartitionFunction object.

Return type:

formula

molecules()[source]

Queries the database for all molecules.

Returns:

List of string moelcule chemical formulae.

tips(name)[source]

Queries the database for all parameters needed to run TIPS.

Parameters:

name – String molecule alias.

Returns:

Numpy array of temperatures. data: Numpy array of data values.

Return type:

temperature

Raises:

TipsDataNotFoundError if no TIPS data is found.

class pyLBL.database.IsotopologueTable(**kwargs)[source]

Bases: Base

Isotopologue database table schema.

abundance
id
iso_name
isoid
mass
molecule_id
exception pyLBL.database.IsotopologuesNotFoundError[source]

Bases: BaseException

class pyLBL.database.MetadataTable(**kwargs)[source]

Bases: Base

Table that describes when data was downloaded.

database
id
molecule_id
time
class pyLBL.database.MoleculeAliasTable(**kwargs)[source]

Bases: Base

Molecule alias database table schema.

alias
id
molecule
class pyLBL.database.MoleculeTable(**kwargs)[source]

Bases: Base

Molecule database table schema.

common_name
id
ordinary_formula
stoichiometric_formula
exception pyLBL.database.TipsDataNotFoundError[source]

Bases: BaseException

class pyLBL.database.TipsTable(**kwargs)[source]

Bases: Base

TIPS data table schema.

data
id
isotopologue_id
molecule_id
temperature
class pyLBL.database.TransitionTable(**kwargs)[source]

Bases: Base

Transition database table schema.

delta_air
elower
gamma_air
gamma_self
global_iso_id
id
local_iso_id
molecule_id
n_air
nu
sw
exception pyLBL.database.TransitionsNotFoundError[source]

Bases: BaseException

pyLBL.plugins module

Manage the model ‘back-ends’ using a plug-in model.

pyLBL.spectroscopy module

Provides a simplified API for calculating molecular line spectra.

class pyLBL.spectroscopy.MoleculeCache(name, grid, lines_database, lines_engine, continua_engine, cross_sections_engine)[source]

Bases: object

Helper class that caches molecular data so it can be reused.

cross_section

Object controlling the current absorption cross section backend plugin.

gas

Object controlling the current lines backend plugin.

gas_continua

List of objects controlling the curret continua backend plugin.

class pyLBL.spectroscopy.Spectroscopy(atmosphere, grid, database, mapping=None, lines_backend='pyLBL', continua_backend='mt_ckd', cross_sections_backend='arts_crossfit')[source]

Bases: object

Line-by-line gas optics.

atmosphere

Atmosphere object describing atmospheric conditions.

cache

Dictionary of MoleculeCache objects.

continua_backend

String name of model to use for the continua.

continua_engine

Object exposed by the current molecular continuum backed.

cross_section_backend

String name of model to use for the cross sections.

cross_section_engine

Object exposed by the current cross sections backend.

grid

Numpy array describing the spectral grid [cm-1].

lines_backend

String name of model to use for lines calculation.

lines_database

Database object controlling the spectral database.

lines_engine

Object exposed by the current molecular lines backend.

output

namedtuple object that stores some output dataset metadata.

compute_absorption(output_format='all', remove_pedestal=None)[source]
Computes absorption coefficient [m-1] at specified wavenumbers given temperature,

pressure, and gas concentrations.

Parameters:
  • output_format

    String describing how the absorption data should be output. “all” - returns absorption spectra from all components (lines,

    continuum, cross section) for all gases separately.

    ”gas” - returns total absorption spectra for all gases

    separately.

    ”total” - returns the total spectra.

  • remove_pedestal – Flag that allows the user to not subtract off the MT-CKD water vapor “pedestal” if desired.

Returns:

An xarray Dataset of absorption coefficients [m-1].

list_molecules()[source]

Provides a list of molecules available in the specral lines database.

Returns:

List of string molecule formulae available in the specral lines database.

pyLBL.spectroscopy.number_density(temperature, pressure, volume_mixing_ratio)[source]

Calculates the number density using the ideal gas law.

Parameters:
  • temperature – Temperature [K].

  • pressure – Pressure [Pa].

  • volume_mixing_ratio – Volume-mixing ratio [mol mol-1].

Returns:

Number density [m-3].

pyLBL.tips module

Controls the TIPS (total internal partition function) calculations.

class pyLBL.tips.TotalPartitionFunction(molecule, temperature, data)[source]

Bases: object

Total partition function, using data from TIPS 2017 (doi: 10.1016/j.jqsrt.2017.03.045).

data

Numpy array of total partition function values (isotopologue, temperature).

molecule

String molecule chemical formula.

temperature

Numpy array of temperatures [K].

property isotopologue
total_partition_function(temperature, isotopologue)[source]

Interpolates the total partition function values from the TIPS 2017 table.

Parameters:
  • temperature – Temperature [K].

  • isotopologue – Isotopologue id.

Returns:

Total partition function.

Module contents