├── .gitignore ├── create_dist.bat ├── MANIFEST ├── hapi └── __init__.py ├── CITATION.md ├── LICENSE.txt ├── setup.py └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.bak 3 | build/ 4 | dist/ 5 | hitran_api.egg-info/ 6 | *~ -------------------------------------------------------------------------------- /create_dist.bat: -------------------------------------------------------------------------------- 1 | python setup.py sdist 2 | python setup.py bdist_wheel --universal -------------------------------------------------------------------------------- /MANIFEST: -------------------------------------------------------------------------------- 1 | # file GENERATED by distutils, do NOT edit 2 | setup.py 3 | hapi\__init__.py 4 | hapi\hapi.py 5 | -------------------------------------------------------------------------------- /hapi/__init__.py: -------------------------------------------------------------------------------- 1 | #from hapi import * 2 | 3 | #https://docs.python.org/3/tutorial/modules.html 4 | #__all__ = ['hapi',] 5 | 6 | #https://stackoverflow.com/questions/34341420/import-functions-directly-from-python-3-modules 7 | from .hapi import * -------------------------------------------------------------------------------- /CITATION.md: -------------------------------------------------------------------------------- 1 | If you use HAPI in your research or software development, 2 | please cite it using the following reference: 3 | 4 | R.V. Kochanov, I.E. Gordon, L.S. Rothman, P. Wcislo, C. Hill, J.S. Wilzewski, 5 | HITRAN Application Programming Interface (HAPI): A comprehensive approach 6 | to working with spectroscopic data, J. Quant. Spectrosc. Radiat. Transfer 177, 15-30 (2016) 7 | DOI: 10.1016/j.jqsrt.2016.03.005 -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | HITRAN Application Programming Interface (HAPI) 2 | 3 | MIT License 4 | 5 | Copyright 2018 HITRAN team (http://hitran.org/). 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 12 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | #from distutils.core import setup 4 | from setuptools import setup 5 | from hapi.hapi import HAPI_VERSION, HAPI_HISTORY 6 | 7 | import re 8 | import sys 9 | import shutil 10 | 11 | # Update the README file 12 | shutil.copy('README.md','README.bak') 13 | 14 | with open('README.md') as f: 15 | README = f.read() 16 | 17 | main_body = re.search('(## Introduction.+)$',README,re.MULTILINE|re.DOTALL).groups(0)[0].rstrip() 18 | 19 | HISTORY_LIST = '' 20 | for i,item in enumerate(HAPI_HISTORY): 21 | HISTORY_LIST += ' %d) %s\n'%(i+1,item) 22 | 23 | README = """ 24 | # HITRAN Application Programming Interface (HAPI) 25 | =============================================== 26 | 27 | Current version: {hapi_version} 28 | 29 | ## Version history 30 | 31 | {history} 32 | 33 | {body} 34 | 35 | """.format(hapi_version=HAPI_VERSION,body=main_body,history=HISTORY_LIST.rstrip()) 36 | 37 | # Python 2 and 3 encoding support 38 | if sys.version_info[0]<3: 39 | with open('README.md','w') as f: 40 | f.write(README.lstrip()) 41 | else: 42 | with open('README.md','wb') as f: 43 | f.write(README.lstrip().encode('utf-8')) 44 | 45 | # Install the package 46 | setup( 47 | name='hitran-api', 48 | version=HAPI_VERSION, 49 | packages=['hapi',], 50 | license='MIT', 51 | ) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HITRAN Application Programming Interface (HAPI) 2 | =============================================== 3 | 4 | Current version: 1.2.2.1 5 | 6 | ## Version history 7 | 8 | 1) FIXED GRID BUG (ver. 1.1.0.1) 9 | 2) FIXED OUTPUT FORMAT FOR CROSS-SECTIONS (ver. 1.1.0.1) 10 | 3) ADDED CPF BY SCHREIER (JQSRT_112_2011) (ver. 1.1.0.2) 11 | 4) OPTIMIZED EXPRESSION EVALUATIONS FOR SELECT (ver. 1.1.0.3) 12 | 5) ADDED SUPPORT FOR MIXTURES (ver. 1.1.0.4) 13 | 6) ADDED SUPPORT FOR USER-DEFINED ENV DEPENDENCES (ver. 1.1.0.5) 14 | 7) ADDED PROFILE SELECTION (ALPHA) (ver. 1.1.0.6) 15 | 8) ADDED METADATA FOR HTP, FIXED NORMALIZATION IN CONVOLVESPECTRUMSAME (ver. 1.1.0.7) 16 | 9) FIXED A "LONELY HEADER" BUG IN CACHE2STORAGE (ver. 1.1.0.7.1) 17 | 10) ADDED SUPPORT FOR PHOSGENE AND CYANOGEN (ver. 1.1.0.7.2) 18 | 11) OPTIMIZED STORAGE2CACHE (by Nils-Holger Loeber) (ver. 1.1.0.7.3) 19 | 12) ADDED SKIPABLE PARAMETERS IN HEADERS (ver. 1.1.0.7.4) 20 | 13) ADDED SUPPORT FOR FORTRAN D-NOTATION (ver. 1.1.0.7.5) 21 | 14) ADDED SUPPORT FOR WEIRD-FORMATTED INTENSITY VALUES E.G. "2.700-164" (ver. 1.1.0.7.6) 22 | 15) ADDED TIPS-2017 (ver. 1.1.0.8) 23 | 16) ADDED SUPPORT FOR CUSTOM EXTENSIONS OF THE DATA FILES (ver. 1.1.0.8.1) 24 | 17) FIXED LINK TO (2,0) ISOTOPOLOGUE IN TIPS-2017 (ver. 1.1.0.8.2) 25 | 18) ADDED SAVEHEADER FUNCTION (ver. 1.1.0.8.3) 26 | 19) ADDED METADATA FOR SF6 (ver. 1.1.0.8.4) 27 | 20) ADDED D2O ISOTOPOLOGUE OF WATER TO DESCRIPTION (ver. 1.1.0.8.5) 28 | 21) FIXED LINE ENDINGS IN STORAGE2CACHE AND QUERYHITRAN (ver. 1.1.0.8.6) 29 | 22) ADDED SUPPORT FOR NON-INTEGER LOCAL ISO IDS (ver. 1.1.0.8.7) 30 | 23) FIXED PARAMETER NAME CASE BUG (by Robert J. Hargreaves) (ver. 1.1.0.8.8) 31 | 24) CAST LOCAL_ISO_ID=0 TO 10 FOR CARBON DIOXIDE (ver. 1.1.0.8.9) 32 | 25) USING NUMPY.ARRAYS FOR NUMERIC COLUMNS OF LOCAL_TABLE_CACHE (ver. 1.1.0.9.0) 33 | 26) ADDED DESCRIPTIONS FOR BROADENING BY H2O (ver. 1.1.0.9.1) 34 | 27) ADDED PROXY SUPPORT IN FETCH AND FETCH_BY_IDS (ver. 1.1.0.9.2) 35 | 28) ADDED LIMIT FOR NUMBER OF LINES DURING TABLE READ (ver. 1.1.0.9.3) 36 | 29) FIXED ABSOLUTE PATH BUG IN TABLE NAMES (ver. 1.1.0.9.4) 37 | 30) CORRECTED ABUNDANCE OF THE HD ISOTOPOLOGUE (ver. 1.1.0.9.5) 38 | 31) ADDED UNIFIED INTERFACES FOR ABSCOEF AND XSC CALCULATIONS (ver. 1.1.0.9.6) 39 | 32) ADDED PARLISTS FOR LINE MIXING (VOIGT AND SDVOIGT) (ver. 1.1.0.9.7) 40 | 33) ADDED SUPPORT FOR ROSENKRANZ LM PARAMETERS TO PCQSDHC AND LORENTZ (ver. 1.1.1.0) 41 | 34) FIXED THE TYPEERROR IN ARANGE (ver. 1.1.2.0) 42 | 35) ADDED NEW FUNCTIONAL INTERFACES FOR ALL CROSS-SECTION CALCULATING ROUTINES (ver. 1.2.0.0) 43 | 36) ADDED CALCULATION OF THE ISO_ID TABLE ON STARTUP (ver. 1.2.1.0) 44 | 37) ADDED SUPPORT FOR TIPS-2021 (ver. 1.2.2.0) 45 | 38) FIXED BUG WITH WAVENUMBERGRID (ver. 1.2.2.1) 46 | 47 | ## Introduction 48 | 49 | The HITRAN Application Programming Interface (HAPI) [1] is a set of routines in Python which aims to provide remote access to functionality and data given by the HITRANonline. At the present time, the API can download, filter and process line-by-line transition data. 50 | 51 | The main purpose of this API is to extend the functionality of the main site, in particular, in the calculation of spectra using several types of line shape, including the flexible HT (Hartmann-Tran) profile [2] and optionally accounting for instrumental functions. Each feature of the API is represented by a Python function taking a set of arguments which describe the parameters defining the task. 52 | 53 | The current version is in the beta stage. All comments and suggestions are welcome: please email [rkochanov@cfa.harvard.edu](mailto:rkochanov@cfa.harvard.edu). 54 | 55 | ## Features 56 | 57 | Features 58 | 59 | Some of the prominent current features of HAPI are: 60 | 61 | 1) Downloading line-by-line data from the HITRANonline site to a local machine; 62 | 2) Filtering and processing the data in SQL-like fashion; 63 | 3) Conventional Python structures (lists, tuples, and dictionaries) for representing spectroscopic data; 64 | 4) Compatibility with a large set of third-party Python libraries to work with the data; 65 | 5) Python implementation of the HT profile [2,3,4,5] which can be used in spectral simulations. This line shape can also be reduced to a number of conventional line profiles such as Gaussian (Doppler), Lorentzian, Voigt, Rautian, Speed-dependent Voigt and speed-dependent Rautian; 66 | 6) Python implementation of the total internal partition sums algorithm, TIPS-2017[6] which is used in the calculation of the temperature dependence of HITRAN[7] transition intensities. The older software TIPS-2011[8] is also available; 67 | 7) High-resolution spectral simulation accounting for pressure, temperature and optical path length. The following spectral functions can be calculated: 68 | a) absorption coefficient 69 | b) absorption spectrum 70 | c) transmittance spectrum 71 | d) radiance spectrum 72 | 8) Spectral calculation using a number of instrumental functions to simulate experimental spectra; 73 | 9) Possibility to extend the user's functionality by adding custom line shapes, partition sums and apparatus functions. 74 | 75 | ## Citation 76 | 77 | It is free to use HAPI. If you use HAPI in your research or software development, please cite it using the following reference: 78 | 79 | R.V. Kochanov, I.E. Gordon, L.S. Rothman, P. Wcislo, C. Hill, J.S. Wilzewski, HITRAN Application Programming Interface (HAPI): A comprehensive approach to working with spectroscopic data, J. Quant. Spectrosc. Radiat. Transfer 177, 15-30 (2016) [Link to article](http://dx.doi.org/10.1016/j.jqsrt.2016.03.005). 80 | 81 | To make a reference to particular version of HAPI, use corresponding DOI from the [Zenodo](https://zenodo.org/collection/user-hapi) community in addition to the reference given above. 82 | 83 | ## References 84 | 85 | [1] R.V. Kochanov, I.E. Gordon, L.S. Rothman, P. Wcislo, C. Hill, J.S. Wilzewski, HITRAN Application Programming Interface (HAPI): A comprehensive approach to working with spectroscopic data, J. Quant. Spectrosc. Radiat. Transfer 177, 15-30 (2016) [Link to article](http://dx.doi.org/10.1016/j.jqsrt.2016.03.005). 86 | 87 | [2] N. H. Ngo, D. Lisak, H. Tran, J.-M. Hartmann, An isolated line-shape model to go beyond the Voigt profile in spectroscopic databases and radiative transfer codes, J. Quant. Spectrosc. Radiat. Transfer 129, 89-100 (2013). [Link to article](http://www.sciencedirect.com/science/article/pii/S0022407313002598) 88 | 89 | [3] H. Tran, N. H. Ngo, J.-M. Hartmann, Efficient computation of some speed-dependent isolated line profiles, J. Quant. Spectrosc. Radiat. Transfer 129, 199-203 (2013) [Link to article](http://www.sciencedirect.com/science/article/pii/S0022407313002598) 90 | 91 | [4] H. Tran, N. H. Ngo, J.-M. Hartmann, Erratum to "Efficient computation of some speed-dependent isolated line profiles", J. Quant. Spectrosc. Radiat. Transfer 134, 104 (2014) [Link to article](http://www.sciencedirect.com/science/article/pii/S0022407313004445) 92 | 93 | [5] J. Tennyson, P. F. Bernath, A. Campargue et al., Recommended isolated-line profile for representing high-resolution spectroscopic transitions (IUPAC Technical Report), Pure Appl. Chem. 86, 1931-1943 (2014) [Link to article](http://www.degruyter.com/view/j/pac.2014.86.issue-12/pac-2014-0208/pac-2014-0208.xml) 94 | 95 | [6] R. R. Gamache, C. Roller, E. Lopes, I. E. Gordon, L. S. Rothman, et al., Total internal partition sums for 166 isotopologues of 51 molecules important in planetary atmospheres: Application to HITRAN2016 and beyond, J. Quant. Spectrosc. Radiat. Transfer 203, 70-87 (2017). [Link to article](https://www.sciencedirect.com/science/article/pii/S0022407317301516) 96 | 97 | [7] I. E. Gordon, L. S. Rothman, C. Hill, R. V. Kochanov, Y. Tan, et al., The HITRAN2016 molecular spectroscopic database, J. Quant. Spectrosc. Radiat. Transfer 203, 3-69 (2017). [link to article](https://www.sciencedirect.com/science/article/pii/S0022407317301073) 98 | 99 | [8] A. L. Laraia, R. R. Gamache, J. Lamouroux, I. E. Gordon, L. S. Rothman, Total internal partition sums to support planetary remote sensing, Icarus 215, 391-400 (2011). [Link to article](http://www.sciencedirect.com/science/article/pii/S0019103511002132) 100 | 101 | --------------------------------------------------------------------------------