radis.io.hitemp module

Created on Tue Jan 26 22:40:51 2021

@author: erwan

https://stackoverflow.com/questions/55610891/numpy-load-from-io-bytesio-stream https://stupidpythonideas.blogspot.com/2014/07/three-ways-to-read-files.html

DATA_COLUMNS = ['iso', 'wav'][source]

only these column names will be searchable directly on disk to only load certain lines. See hdf2df()

Type

list

HITEMP_SOURCE_FILES = {'CH4': '06_HITEMP2020.par.bz2', 'CO': '05_HITEMP2019.par.bz2', 'CO2': '', 'H2O': '', 'N2O': '04_HITEMP2019.par.bz2', 'NO': '08_HITEMP2019.par.bz2', 'NO2': '10_HITEMP2019.par.bz2', 'OH': '13_HITEMP2020.par.bz2'}[source]

list of available HITEMP source files

Last update : 02 Feb 2021 Compare with files available on https://hitran.org/hitemp/

Type

dict

INFO_HITEMP_LINE_COUNT = {'CH4': 31880412, 'CO': 752976, 'CO2': 11193608, 'H2O': 114241164, 'N2O': 3626425, 'NO': 1137192, 'NO2': 1108709, 'OH': 57019}[source]

total line count according to https://hitran.org/hitemp/ Used for tests and to give an idea of the uncompress progress in :py:func:`~radis.io.hitemp.fetch_hitemp

Warning

may change with new HITEMP updates. Only use as an informative param, do not rely on this in the code.

Type

dict

fetch_hitemp(molecule, local_databases='~/.radisdb/', databank_name='HITEMP-{molecule}', isotope=None, load_wavenum_min=None, load_wavenum_max=None, cache=True, verbose=True, chunksize=100000, clean_cache_files=True, return_local_path=False)[source]

Stream HITEMP file from HITRAN website. Unzip and build a HDF5 file directly.

Returns a Pandas DataFrame containing all lines.

Parameters
  • molecule ("CO2", "N2O", "CO", "CH4", "NO", "NO2", "OH") – HITEMP molecule. See HITEMP_SOURCE_FILES

  • local_databases (str) – where to create the RADIS HDF5 files. Default "~/.radisdb/"

  • databank_name (str) – name of the databank in RADIS Configuration file Default "HITEMP-{molecule}"

  • isotope (str) – load only certain isotopes : '2', '1,2', etc. If None, loads everything. Default None.

  • load_wavenum_min, load_wavenum_max (float (cm-1)) – load only specific wavenumbers.

Other Parameters
  • cache (bool, or 'regen') – if True, use existing HDF5 file. If False or 'regen', rebuild it.

  • verbose (bool)

  • chunksize (int) – number of lines to process at a same time. Higher is usually faster but can create Memory problems and keep the user uninformed of the progress.

  • clean_cache_files (bool) – if True clean downloaded cache files after HDF5 are created.

  • return_local_path (bool) – if True, also returns the path of the local database file.

Returns

  • df (pd.DataFrame) – Line list A HDF5 file is also created in local_databases and referenced in the RADIS config file with name databank_name

  • local_path (str) – path of local database file if return_local_path

Notes

if using load_only_wavenum_above/below or isotope, the whole database is anyway downloaded and uncompressed to local_databases fast access .HDF5 files (which will take a long time on first call). Only the expected wavenumber range & isotopes are returned. The .HFD5 parsing uses hdf2df()

See also

hdf2df()

get_last(b)[source]

Get non-empty lines of a chunk b, parsing the bytes.

register_database(databank_name, path_list, molecule, wmin, wmax, download_date, urlname, verbose)[source]

Add to registered databases in RADIS config file.

If database exists, assert it has the same entries.

Parameters

databank_name (str) – name of the database in ~/radis.json config file

Other Parameters

verbose (bool)

Returns

adds to ~/radis.json with all the input parameters. Also adds

format : "hitemp-radisdb"
parfuncfmt : "hapi"   # TIPS-2017 for equilibrium partition functions

And if the molecule is in MOLECULES_LIST_NONEQUILIBRIUM:

levelsfmt : "radis"   # use RADIS spectroscopic constants for rovibrational energies (nonequilibrium)

Return type

None