Climatological numerical models (e.g., IGRF, IRI, MSIS, HWM93/07), commonly written in FORTRAN, are often used within the upper atmosphere research community for a wide variety of applications (e.g., initializing values in numerical models and for comparisons against measured data). Here we present pyglow, a Python module that includes wrappers for climatological models. In this way, the climatological models can be accessed in the high-level and scriptable Python programming language. This implementation provides quick access to each model under a common framework. Pyglow is open-sourced (https://github.com/timduly4/pyglow/) to encourage improvement and expansion of the code base.
pyglow: Upper atmosphere climatological models in Python Timothy M. Duly [email protected] !Daniel J. Fisher [email protected] University of Illinois at Urbana-Champaign
Abstract
High-LevelLow-Level
FortranExecution pyglow
CCMC web service
f2py / gfortran
IRI MSIS IGRF HWM93 HWM07
pyglow module
Python
Fortran
Introduction
Example Usage
1 # Example Python script using pyglow2 # and its climatological models3 # to plot profile of airglow emission.4 # and electron density5 #6 from matplotlib.pyplot import *7 import numpy as np8 from datetime import datetime , timedelta9 from pyglow.pyglow import Point
10
11 matplotlib.rcParams.update ({’font.size’: 16})12
13 # Setting lat , lon , and a range of altitudes14 lat = 18.37 # Arecibo15 lon = -66.6216 alts = np.linspace(85 ,1000,500)17
18 # set time (i.e., dn)19 dn_lt = datetime(2012 , 3, 22, 0, 0)20 tz = np.ceil(lon/15.)21 dn_ut = dn_lt - timedelta(hours=tz)22
23 # airglow calculation using pyglow:24 ag , ne = [], []25 for alt in alts:26 pt = Point(dn_ut , lat , lon , alt)27
28 pt.run_iri()29 pt.run_msis()30 pt.run_airglow()31
32 ag.append(pt.ag6300)33 ne.append(pt.ne)34
35 # plot data:36 figure (1, figsize=(7 ,8)); clf()37 semilogy(ag , alts , ’-k’, lw=4, label=’$V_{630.0}$’)38 grid()39 ylim([alts[0],alts[ -1]])40 the_yticks = np.arange (100 ,1001 ,100)41 yticks(the_yticks ,the_yticks)42 xlabel(’Volume Emission Rate [ph/cm$^3$/$s$]’)43 ylabel(’Altitude [km]’)44 legend(loc=’lower right ’)45
46 ax2 = gca().twiny()47 ax2.semilogx(ne , alts , ’--b’, lw=4, label=’$n_e$’)48 xlabel(’Electron density [items/cm$^3$]’,color=’blue’)49 ax2.legend(loc=’upper right’)50
51 draw(); show()52 savefig(’../images/pyglow- example.png’, dpi=200)
2
pyglow is installed system-wide and can be imported in a script
Instance of the Point class is instantiated (all inputs to the climatological models are a function of a time and a spatial location)
Here two models are called (which are needed for the airglow calculation)
Once the climatological values are executed, member data from the pt object are available
In this example, profiles of the electron density and 630.0-nm airglow emission are produced in ~50 lines of code!
Climatological Model
Description Terms Modeled
Reference
IRI International Reference Ionosphere
Plasma Bilitza and Reinisch [2008]
MSIS Mass Spectrometer Incoherent Scatter Radar
Neutral Picone [2002]
HWM93/07 Horizontal Wind Model 1993 / 2007
Neutral Wind
Hedin and Biondi [1996]
IGRF International Geomagnetic Reference Field
Magnetic Field
Finlay et al. [2010]
• There are primarily two different methods to access climatological models: compiling the FORTRAN code or using a web service provided by the Community Coordinated Modeling Center (CCMC)
• Both offer various levels of computer architecture abstraction
• In terms of abstraction level, pyglow is between these two, offering access to climatological models in the scriptable Python programming language
• pyglow offers access to several climatological models for various upper atmosphere parameters
• Future models can be easily implemented as they become available to the research community
• f2py (available in numpy) is used as the “glue” between the pyglow module and the Fortran models
• Access to models under common framework enables derived parameters to be calculated (e.g., airglow emission) and synergy between models (e.g., integrating electron densities along magnetic field line)
• pyglow is used to calculate a dip angle contour map in conjunction with the Basemap package for producing high quality maps
!• Combining the climatological models
and Basemap under a common framework provide quick development of results
• Example generating many electron density profiles (from IRI) for both solar maximum (top) and solar minimum (bottom)
!• ~50 lines of code are used
to generate this figure, all contained within one script
• pyglow can also be used to easily plot solar index data
!• In addition to F10.7
and F10.7A values, Kp and Ap indices are provided in pyglow
Additional Examples
• pyglow can be used for comparison of climatological values against experimental data
!• In this example, monthly
averaged HWM93/07 neutral winds are compared with Fabry-Perot interferometer measurements
References Bilitza, D., and B. Reinisch (2008), International Reference Ionosphere 2007: Improvements and new parameters, Advances in Space Research, 42(4), 599–609, doi:10.1016/j.asr.2007.07.048.
Finlay, C. C., S. Maus, C. D. Beggan, T. N. Bondar, A. Chambodut, T. a. Chernova, A. Chulliat, V. P. Golovkov, B. Hamilton, M. Hamoudi, R. Holme, G. Hulot, W. Kuang, B. Langlais, V. Lesur, F. J. Lowes, H. Luhr, S. Macmillan, M. Mandea, S. McLean, C. Manoj, M. Menvielle, I. Michaelis, N. Olsen, J. Rauberg, M. Rother, T. J. Sabaka, A. Tangborn, L. Tøffner Clausen, E. Thebault, a. W. P. Thomson, I. Wardinski, Z. Wei, and T. I. Zvereva (2010), International Geomagnetic Reference Field: the eleventh generation, Geophysical Journal International, 183(3), 1216–1230, doi:10.1111/j.1365-246X.2010.04804.x.
Hedin, A., E. Fleming, A. Manson, F. Schmidlin, S. Avery, R. Clark, S. Franke, G. Fraser, T. Tsuda, F. Vial, and R. Vincent (1996), Empirical wind model for the upper, middle and lower atmosphere, Journal of Atmospheric and Terrestrial Physics, 58(13), 1421–1447, doi: 10.1016/0021-9169(95)00122-0.
Picone, J. M. (2002), NRLMSISE-00 empirical model of the atmosphere: Statistical comparisons and scientific issues, Journal of Geophysical Research, 107 (A12), 1–16, doi: 10.1029/2002JA009430.
Time is set for a single location