63. A New Python Module for Accessing HMI and AIA Data

Contributed by K. Glogowski & M. G. Bobra. Posted on October 31, 2016

K. Glogowski1 & M. G. Bobra2

1. Kiepenheuer-Institut für Sonnenphysik, Schöneckstraße 6, 79104 Freiburg, Germany
2. W.W. Hansen Experimental Physics Laboratory, Stanford University, Stanford, CA 94305

There are many different ways to obtain data from the Solar Dynamics Observatory’s (SDO) Helioseismic and Magnetic Imager (HMI) and Atmospheric Imaging Assembly (AIA) instruments. Two of the most popular methods, aside from a direct web interface, use the SolarSoft library in IDL and the SunPy library in Python. We have released a new Python module, called drms, to access the HMI and AIA data provided by the Joint Science Operations Center (JSOC).

Of the Python-based methods to access solar data, the drms module has some unique capabilities. It allows the user to query metadata independently of image data, export tailored FITS files and serve these files in a variety of methods, and export data as movies and images in different formats.

The drms module can be installed from PyPI and its source code is available on Github, where also many example scripts are included in the examples subdirectory. The drms manual is available on the Read the Docs website, and contains a detailed tutorial . In addition there is an IPython notebook that shows how to use the drms module to plot, query, visualize, and export the data in a variety of formats.

Data from the HMI and AIA instruments are stored at Stanford University. The metadata are stored in a SQL database, which is handled by the Data Record Management System (DRMS). The image data are stored separately on disk, and managed by the Storage Unit Management System (SUMS). Data are merged together, upon export from both systems, as FITS files. The separation of image data and metadata makes it possible to directly access all the metadata without going through every file of a dataset. It also allows the user to select files, based on certain criteria, before downloading any data.

Figure 1 | Magnetogram, continuum intensity map, magnetic field strength and Dopplergram of SHARP 4315 (NOAA 12108 & 12110), crossing the central meridian.

The following short example demonstrates how to use the Python drms module to select a record, based on the available metadata, and download a selection of files from this record. It uses Space-weather HMI Active Region Patches1, or SHARPs, from the JSOC data series hmi.sharp_720s. More specifically, the central meridian crossing of the active region with HARP number 4315 is determined by querying the flux-weighted longitude of the patch (using the series keyword LON_FWT) and selecting the record with the lowest absolute longitude. This record is then used to download FITS files containing the corresponding magnetogram, continuum intensity map, Dopplergram and a map of the magnetic field strength, which are shown in Figure 1. As a further example, an IPython notebook is available, which demonstrates how the plot in Figure 1 was created.

import drms
c = drms.Client(email='name@example.com', verbose=True)
k = c.query('hmi.sharp_720s[4315]', key='LON_FWT', rec_index=True)
rec_cm = k.LON_FWT.abs().argmin()

export_query = rec_cm + '{field,magnetogram,continuum,Dopplergram}'
r = c.export(export_query, protocol='fits')

Figure 2 | Area of active pixel, mean inclination angle, total unsigned flux, and mean current helicity of SHARP 4315 (NOAA 12108 & 12110) during its disk passage. The dashed red line marks the central meridian crossing of the active region.

Metadata can not only be used to select files for download, but can also contain valuable information. The SHARP data series, for example, contains many parameters that characterize active regions. Figure 2 shows a small selection of the available indices for HARP 4315. From the steep gradient in the total unsigned flux and the increasing area of active pixels, it is directly evident, without inspecting any image data, that HARP 4315 is a strong emerging active region. The script that was used to create Figure 2 is also available as an IPython notebook .

This work was supported by the European Research Council under the European UnionÕs Seventh Framework Programme (FP/2007-2013) / ERC Grant Agreement no. 307117.


[1] Bobra, M. G., Sun, X., Hoeksema, J. T. et al., 2014, Solar Phys., 289, 3549
[2] SunPy Community, T., Mumford, S. J., Christe, S., et al., 2015, Computational Science and Discovery, 8, 014009

One comment on “A New Python Module for Accessing HMI and AIA Data

Leave a comment

Your email address will not be published. Required fields are marked *