Working with HITRAN database using HAPI HITRAN Application
Working with HITRAN database using HAPI: HITRAN Application Programming Interface Roman V. Kochanova, c, Christian Hilla, b, Piotr Wcisloa, d, Jonas S. Wilzewskie, Iouli E. Gordona, and Laurence S. Rothmana a. Harvard-Smithsonian Center for Astrophysics, Cambridge MA, USA b. University c. Tomsk d. Nicolas e. Harvard College London, UK State University, Tomsk, RUSSIA Copernicus University, Torun, POLAND University, Astronomy Dept, Cambridge MA, USA
Introduction ● What is API? ● API, an abbreviation of Application Programming Interface, is a set of routines, protocols, and tools for building software applications. The API specifies how software components should interact and be used in a program code. – A good API makes it easier to develop a program by providing all the building blocks. A programmer then puts the blocks together. What is HITRAN API (HAPI)? – – Python module (library of functions) to work with HITRAN data Main purpose: extending user's code by the data of HITRAN and functionality of HITRANonline Offline part of HITRANonline functionality
Why is API a powerful tool for creating radiative-transfer codes? ● Seamless data format conversion Parsing data (cross-sections, line-by-line, parameters) “in a background” – ● Flexibility – – – ● ● Large number of input parameters to control calculation Possibility to add custom user code Possibility to use different line parameters and compare results Portability Access to external libraries – Python, Fortran, C++. . .
What is HAPI for? ● ● Retrieve and use of HITRANonline data (line lists, cross sections, molecule and isotopologue info. . . ) from a program written in Python (HITRANonline data is parsed automatically) Reduce the load of HITRANonline web service (calculation of cross sections can be resource-demanding!) Give more flexibility in data filtering (as in RDB) Provide a possibility to work with HITRAN data “offline” (locally)
Prerequisites 1) Python 2. 6+: https: //www. python. org/ 2) Numpy: http: //www. numpy. org/ License: open source => Scientific Python distribution (“Sage”, “Anaconda” or any other similar distribution)
Download http: //hitran. org/hapi - + Python code - + User guide Zenodo community (DOI for referencing): https: //zenodo. org/collection/user-hapi
How to use HAPI? ● Ways of usage: – In interactive Python shell – In a program (script) as a normal library – Jupyter/IPython
How to use HAPI? ● ● Ways of usage: – In interactive Python shell – In a program (script) as a normal library – Jupyter/IPython Where to use? – Local machine – Remote server (cluster, ssh access) – Cloud service (Wakari, Python. Anywhere, etc…)
HAPI architecture USER PLAIN TEXT XML HDF 5 DATABASE LOCAL
HAPI architecture USER PLAIN TEXT XML HDF 5 DATABASE API functions: → absorption. Coefficient_HT(…) → partition. Sum(…) → select(…) → describe. Table ( … ) →… LOCAL
HAPI architecture QUERY HITRANonline USER PLAIN TEXT XML HDF 5 DATABASE API functions: → absorption. Coefficient_HT(…) → partition. Sum(…) → select(…) → describe. Table ( … ) →… LOCAL REMOTE
HAPI architecture QUERY PLAIN TEXT XML HDF 5 DATABASE DATA TRANSPORT FORMA T (PLAIN TEXT, BINARY , HDF 5, . . . ) API functions: → absorption. Coefficient_HT(…) → partition. Sum(…) → select(…) → describe. Table ( … ) →… LOCAL HITRANonline USER REMOTE
Features (1) ● ● Fetching data (HITRANonline => local machine) Filtering and processing the data in SQL-like fashion Access to conventional Python structures (lists, tuples, dictionaries) for representing spectroscopic data. Accounting for “non-standard” HITRAN parameters: speed dependence, Dicke narrowing, different broadeners etc…
Features (2) ● ● ● Total internal partition sum (TIPS-2011): R. Gamache et al. Icarus 215 (2011) 391– 400 – Included information about 51 isotopologues – 70 -3000 K temperature range p. Cq. SDHC line profile: Ngo et al. JQSRT 129 (2013) 89– 100 (“Partially Correlated Quadratic Speed dependent Hard Collision Profile”) – a. k. a. Hartmann-Tran profile (HTP) – Can be reduced to VP, RP, q. SDVP, q. SDRP Codes are rewritten in Python using Numpy library (fast array operations)
Features (3) ● ● ● High-resolution spectra simulation accounting for pressure, temperature and optical path length. The following spectral functions can be calculated: – absorption coefficient – absorption spectrum – transmittance spectrum – radiance spectrum Spectral calculation using a number of instrumental functions to simulate experimental spectra. Possibility to extend the API's functionality by adding custom line profiles, partition sums and instrumental functions.
Features (4) ● Embedded documentation (get. Help)
Data manipulation ● Similar to SQL (for single table queries) ● Spectroscopic parameters are stored in tables ● Display data (~ SQL’s select) ● Apply filtering conditions (accounting wide range of expressions on parameters, including regexps) ● Adding/removing custom parameters ● Group by parameter/expression
Ipython: Cross section showcase - Download data M I Range
Ipython: Cross section showcase - Filter data
Ipython: Cross section showcase - Cross-section calculation
Ipython: Cross section showcase - Plotting result
Comment on “Radiative forcings for 28 potential Archean greenhouse gases” Clim. Past 10, 1779 (2014)
Comment on “Radiative forcings for 28 potential Archean greenhouse gases” Clim. Past 10, 1779 (2014)
Plans ● More data formats (XML, JSON, Net. CDF …) ● More profiles (soft collisions, line mixing) ● ● ● New data storage format (less bulky, more efficient) Update partition sums (TIPS-2013) Add functions for dealing with HITRAN’s collision-induced absorption cross-sections
Acknowledgements Cf. A HITRAN team: Iouli Gordon, Laurence Rothman, Christian Hill, Jonas Wilzewski, Piotr Wcisło NASA Grants: PASCAL, AURA
Newsletter, bug reports, feedback … ● It’s still work in progress! ● Please ask your questions ● Report bugs rkochanov@cfa. harvard. edu … and thanks for your attention!
- Slides: 26