50. Analyzing SDO/HMI Data Using Python

Contributed by Monica G. Bobra. Posted on April 24, 2016

Monica G. Bobra
Hansen Experimental Physics Laboratory, Stanford University, Stanford, CA 94305

SDO is six years old now, which means that there is half a solar cycle of data available to study. When SDO launched, most of the solar physics community was using IDL for data analysis. Since then, many people have switched to Python. Python is a powerful, object-oriented language with several advantages over IDL: it is open-source, has a larger user and developer community (which means that it is easier to find and fix mistakes in source code), offers many more scientific and mathematical libraries, is faster (in general), and is easily integrable with other languages (e.g. C, C++, Fortran, Java). The astronomical community widely supports python, with the Astropy1 and SunPy2 libraries coming online in 2011 and expanding considerably since then. In this Nugget, we will feature some of the python codes developed by the HMI team to analyze its many magnetic field data products.

bobra_fig1Figure 1 | All four panels show NOAA Active Regions 11429 and 11430 on March 6, 2012 at 23:00 TAI. The first row shows SHARP data for the Br component of the vector magnetic field; the second row shows AIA data in 1600 Å. The first column shows data in native CCD coordinates; the second column shows data in CEA coordinates. To map the CEA data to the AIA data, we first convert the latitude and longitude at the center of the patch from the Carrington Heliographic coordinate system, which has units of degrees, to Helioprojective Cartesian coordinates, which has units of arcsecond.

In addition to the full-disk vector magnetic field data3, the HMI team released a derivative data product called Space-weather Active Region Patches4, or SHARPs, which contain patches of HMI data that encapsulate automatically-detected active regions. These are available in one of two coordinate systems: native CCD coordinates or Cylindrical Equal-Area coordinates. In the latter system, each pixel is of equal area. We have received questions about how to translate between the two coordinate systems and how to cut a SHARP-sized patch out of AIA data, so we developed some code to do so[S1] (Fig. 1).


Figure 2 | This interactive plot shows the total unsigned flux contained in NOAA Active Region 11158 over a one-day period beginning on February 14, 2011 at 02:00 TAI. The home, pan, and zoom buttons on the lower left-hand corner of the plot allow you to explore the data.

The SHARP data also contain 18 FITS header keywords that parameterize the vector magnetic field within the strong field regions. These parameterizations include measurements of physical quantities, such as the magnetic flux; they also include proxies of physical quantities, such as the current helicity, which cannot be measured in its entirety within a single plane. Between 2010 May 1 and 2015 May 1, the HMI data processing pipeline automatically detected 3023 strong field regions and computed 18 parameterizations of each region at every 720-second interval throughout its lifetime, resulting in 36 million unique data points. We have developed some code to easily create interactive plots of SHARP, or, for that matter, any HMI keywords[S2] by using a JSON API to query the SDO database without having to download any images at all (interactive Fig. 2).

bobra_fig3Figure 3 | This vector field visualization is for NOAA Active Region 11158, which produced an X2.2-class are at on February 15, 2011 at 01:56:00 TAI. The red and blue colors indicate negative and positive polarities, respectively; the intensity of the color is proportional to the magnitude of the magnetic field. The brown lines indicate the direction of the field vector. Each vector varies from brown to yellow as a function of height.

It’s not easy to visualize the vector magnetic field, but we have tried to make it easier by developing code to generate movies of SHARP data[S3] and aesthetically-pleasing 3D visualizations of the magnetic field[S4]. In the latter code, we compute the observables based on the perspective of a viewer at a distance r and an angle (θ, φ) looking upon an active region (Fig. 3).

The HMI team also released a polar field data series5,[S5], which contains varies indices and four 180-element segments (e.g., the mean value of Br in each of the 1° latitudinal bins) every 720 seconds. We have developed code to interactively plot the mean value of Br above 60° latitude[S6] as well as generate a super-large butterfly diagram using both MDI and HMI data[S7] — which spans 20 years of nearly continuous observation!

References

[1] Astropy Collaboration: Robitaille, T. P., Tollerud, E. J., et al., 2013, A&A, 558, A33
[2] SunPy Community: T., Mumford, S. J., Christe, S., et al., 2015, Comp. Sci. & Discov., 8, 014009
[3] Schou, J., Scherrer, P.H., Bush, R.I.; Wachter, R., et al., 2012, SoPh, 275, 229
[4] Bobra, M. G., Sun, X., Hoeksema, J. T., et al., 2014, SoPh, 289, 3549
[5] Sun, X., Hoeksema, J. T., Liu, Y., & Zhao, J., 2015, ApJ, 798, 114

Example Python Software

[S1] http://nbviewer.ipython.org/github/mbobra/calculating-spaceweather-keywords/blob/master/feature_extraction.ipynb
[S2] http://nbviewer.jupyter.org/github/mbobra/calculating-spaceweather-keywords/blob/master/plot_swx_d3.ipynb
[S3] http://nbviewer.jupyter.org/github/mbobra/calculating-spaceweather-keywords/blob/master/movie.ipynb
[S4] http://nbviewer.jupyter.org/github/mbobra/calculating-spaceweather-keywords/blob/master/hedgehog.ipynb
[S5] http://jsoc.stanford.edu/data/hmi/polarfield/
[S6] http://nbviewer.jupyter.org/github/mbobra/plotting-polar-field/blob/master/plot_polarfield_d3.ipynb
[S7] http://nbviewer.jupyter.org/github/mbobra/plotting-polar-field/blob/master/butterfly.ipynb

One comment on “Analyzing SDO/HMI Data Using Python

  1. AmasBrown

    The drms module provides an easy-to-use interface for accessing HMI, AIA and MDI data with Python. It uses the publicly accessible JSOC DRMS server by default, but can also be used with local NetDRMS sites. More information, including a detailed tutorial, is available in the Documentation.

    Requirements
    The drms module supports Python 2.7 and Python 3.4 or newer. It requires the following Python packages:

    NumPy, version 1.9.0 or newer
    Pandas, version 0.15.0 or newer
    Six, version 1.8.0 or newer
    The module might also work with earlier versions, but it has not been tested with any versions older than the ones listed above.
    The Solar Dynamics Observatory (SDO) is the first mission to be launched under NASA’s Living With a Star (LWS) program. This
    program involves a diverse set of research topics that aim to provide a greater understanding how the activity and variability of the Sun
    affect life on Earth. The purpose of SDO is to understand how the Sun’s magnetic field is generated and structured, and how this stored
    magnetic energy is converted and released into the heliosphere and geospace in the form of solar wind, energetic particles, and variations
    in the solar irradiance.
    #Note There is more information on this http://hmi.stanford.edu

    Reply

Leave a Reply to AmasBrown Cancel reply

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