Package: lbl-repack
repackRepack and Compress Line-transition Data for Radiative-tranfer CalculationsThis code identifies the strong lines that dominate the spectrum from
the large-majority of weaker lines.  The code returns a binary
line-by-line (LBL) file with the strong lines info (wavenumber, Elow,
gf, and isotope ID), and an ascii file with the combined contribution
of the weaker lines compressed into a continuum extinction coefficient
(in cm-1 amagat-1) as function of wavenumber and temperature.Currently available databases:ExoMol (http://www.exomol.com/)HITRAN (https://www.cfa.harvard.edu/hitran/)Kurucz's TiO (http://kurucz.harvard.edu/molecules/tio)Team MembersPatricio Cubillos(IWF)patricio.cubillos@oeaw.ac.atInstallrepackhas beentestedto work on Python 3.6 and 3.7; and runs (at least) in both Linux and OSX.  You can installrepackfrom the terminal with pip:# Note that on PyPI ``repack``is indexed as ``lbl-repack``:pipinstalllbl-repackAlternative (for developers), you can directly dowload the source code
and install to your local machine with the following terminal commands:gitclonehttps://github.com/pcubillos/repack/cdrepack
pythonsetup.pyinstallGetting StartedThe following example compresses the Exomol HCN line-transition data.  First, download the ExoMol HCN dataset (there is no need to unzip the files):# Download ExoMol HCN data:wgethttp://exomol.com/db/HCN/1H-12C-14N/Harris/1H-12C-14N__Harris.states.bz2
wgethttp://exomol.com/db/HCN/1H-12C-14N/Harris/1H-12C-14N__Harris.trans.bz2
wgethttp://exomol.com/db/HCN/1H-12C-14N/Harris/1H-12C-14N__Harris.pf
wgethttp://exomol.com/db/HCN/1H-13C-14N/Larner/1H-13C-14N__Larner.states.bz2
wgethttp://exomol.com/db/HCN/1H-13C-14N/Larner/1H-13C-14N__Larner.trans.bz2
wgethttp://exomol.com/db/HCN/1H-13C-14N/Larner/1H-13C-14N__Larner.pfThen create a repack configuration file ('repack_HCN.cfg') like this below:[REPACK]# Line-transition files:lblfiles=1H-12C-14N__Harris.trans.bz21H-13C-14N__Larner.trans.bz2# Database type [exomol, hitran, or kurucz]:dbtype=exomol# Output file name (without file extension):outfile=HCN_exomol_harris-larner_0.3-33um_100-3000K_sthresh_0.01# Wavenumber boundaries and sampling rate (in cm-1):wnmin=303.0wnmax=33334.0dwn=1.0# Temperature sampling:tmin=100.0tmax=3000.0dtemp=100.0# Line-intensity threshold for strong/weak lines:sthresh=0.01# Maximum chunk size of lines to handle at a time:chunksize=5000000ncpu=5And runrepack, which will produce the following screen output:# Call the repack command-line executable for the HCN demo config file:repackrepack_HCN.cfg

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::repack:line-transitiondatacompression.Version1.4.1.Copyright(c)2017-2020PatricioCubillos.repackisopen-sourcesoftwareundertheMITlicense.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Starting:FriApr314:45:252020Unzipping:'1H-12C-14N__Harris.trans.bz2'.
Unzipping:'1H-13C-14N__Larner.trans.bz2'.
Reading:'1H-12C-14N__Harris.trans.bz2'.
Reading:'1H-13C-14N__Larner.trans.bz2'.Flagginglinesat100K(chunk1/14):Compressionrate:96.82%,148,115/4,662,663lines.Flagginglinesat3000K:Compressionrate:86.89%,611,256/4,662,663lines.Totalcompressionrate:84.60%,717,921/4,662,663lines.

...Flagginglinesat100K(chunk14/14):Compressionrate:95.47%,209,217/4,619,175lines.Flagginglinesat3000K:Compressionrate:75.13%,1,148,804/4,619,175lines.Totalcompressionrate:73.22%,1,237,122/4,619,175lines.

Withathresholdstrengthfactorof0.01,
keptatotalof7,553,671linetransitionsoutof65,586,274lines.

Successfullyrewritenexomolline-transitioninfointo:'HCN_exomol_harris-larner_0.3-33um_100-3000K_sthresh_0.01_lbl.dat'and'HCN_exomol_harris-larner_0.3-33um_100-3000K_sthresh_0.01_continuum.dat'.
End:FriApr314:51:062020The output binary file 'HCN_exomol_harris-larner_0.3-33um_100-3000K_sthresh_0.01_lbl.dat'
contains the line-by-line opacity information for HCN, which represent
most of the opacity contribution into the spectrum.  The information
is encoded as a sequence of three doubles and an integer containing
the wavenumber (in cm-1), lower-state energy (in cm-1 units),
gf value, and isotope index, respectively, for each transition.  This
info can be easily read with the following python script:importrepack.utilsasuwn,elow,gf,iiso=u.read_lbl('HCN_exomol_harris-larner_0.3-33um_100-3000K_sthresh_0.01_lbl.dat')The output ascii file 'HCN_exomol_harris-larner_0.3-33um_100-3000K_sthresh_0.01_continuum.dat'
contains the remaining opacity contribution of the weak lines (in cm-1
amagat-1 units) as function of wavenumber and temperature.  This is a
minor contribution compared to that of the LBL output file.Re-sorting MARVELized filesSince some ExoMol .states files have been MARVELized (refined energy levels), the .trans files are no longer sorted by wavenumber.  This is a problem forrepacksince its binaary searches rely on a sorted wavenumber files.  To solve this, the user should sort the files before repacking:# First sort the .trans files (use same config file as a repack file):repack-sortrepack_H2O.cfg# Now run repack as usual:repackrepack_H2O.cfgBe KindPlease, be kind and acknowledge the effort of the authors by citing the article asociated to this project:Cubillos (2017): An Algorithm to Compress Line-transition Data for Radiative-transfer Calculations, ApJ 850, 32.LicenseCopyright (c) 2017-2020 Patricio Cubillos.repackis open-source software under the MIT license (seeLICENSE).