Solar-Terrestrial Sciences

SunPy: a Python solar data analysis environment

SunPy: a Python solar data analysis environment


For many years now we know that our star the Sun influences the Earth in many different ways, via the total solar irradiance, solar energetic particles and coronal mass ejections. Understanding the influence of the Sun on the Earth requires many different types of measurements. For example, NASA’s Solar Dynamics Observatory (SDO) spacecraft, produces over 1 terabyte of data per day (Pesnell et al., 2012), the bulk of it in the form of 4096 by 4096 pixel images in multiple bandpasses. The Parker Solar Probe (launched 12 August 2018) will fly closer to the Sun than any previous spacecraft, exploring the Sun’s corona, the solar wind and source and transport of space weather phenomena, by taking both in situ and remote measurements. Understanding the underlying physics requires sophisticated data analysis and modelling of multiple differing physical domains.

Managing and analyzing these heterogeneous data to answer evolving scientific needs and questions requires increasingly sophisticated software tools. These tools should be robust, easy to use and modify, have a transparent development history, and conform to modern software-engineering standards. The SunPy Project (SunPy Community et al., 2015) aims to provide a free and open source software package with these qualities for the analysis and visualisation of solar data. SunPy is built on Python, a free, general-purpose, powerful, and easy-to-learn programming  language. Python is widely used in many scientific fields, and has found applications in data analytics, machine learning and educational environments. SunPy brings solar physics in to the scientific Python ecosystem.

Organization and description of the code

Figure 1: SunPy is used to overlay two maps of data taken at the same time during the total solar eclipse of August 21, 2017: a ground-based photograph of the corona (black/white image), and an extreme ultraviolet image of the disk of the Sun (yellow image) taken by the SDO Atmospheric Imaging Assembly. Courtesy of S. Christe.

SunPy focuses on providing access to online repositories of solar physics data, and objects that make it easy to manipulate and display those data. SunPy is built using other open source Python projects, notably Astropy, numpy, SciPy, pandas and matplotlib. For example, many solar datasets are two-dimensional images, represented in SunPy by a Map object. Maps use SunPy’s coordinate transformation framework, an extension of Astropy’s powerful coordinates package, thereby enabling support for transforming between all Astropy and SunPy coordinate systems. SunPy was used to overlay ground based images of the solar corona taken during the total solar eclipse of August 21, 2017, and space based-images taken by SDO (Figure 1)


Figure 2: SunPy’s example gallery.

Figure 3: Simulated coronal loop emission generated using SunPy. Courtesy W. T. Barnes.

SunPy’s also provides the TimeSeries object for manipulating and displaying time-ordered scalar data.  Also, all public-facing SunPy functionality is unit-aware, meaning that physical units must be specified as required.  SunPy provides code snippets to get users started (Figure 2), and project members are active in teaching the community about SunPy.  SunPy is used by researchers working at NASA, European Space Agency (ESA), and the US National Solar Observatory Daniel K. Inouye Solar Telescope.  SunPy can also be used for modelling work: Figure 3 shows an example of using SunPy’s coordinate and mapping abilities to model the emission from an arcade of solar coronal loops.


Governance and development model

SunPy was born at the 2010 Solar Image Processing Workshop in Les Diablerets, Switzerland.  It is run by a small volunteer board of scientists that sets SunPy’s goals.  The Lead Developer (currently Dr. Stuart Mumford) is responsible for the implementation of SunPy’s goals. Contributions can be made by anyone. The project is managed at, and unit testing, continuous integration, and community review of contributions are implemented to reduce bugs and maintain quality.  Students supported by the Google Summer of Code and the ESA Summer of Code in Space programs have made substantial contributions to SunPy.  The SunPy project is also a member of NumFOCUS, a US-based nonprofit organization that promotes sustainable high-level programming languages, open code development, and reproducible scientific research.


SunPy gives users access to the ever widening scientific Python ecosystem. SunPy 1.0 is under development for release later on this year. This version will use Astropy’s representation of time, bringing improved precision and leap second support to SunPy.  The usability of SunPy’s data acquisition infrastructure will also be improved.  SunPy 1.0 will also drop support for the Python 2 series and require Python 3.6 or higher.  SunPy is also developing NDCube, a multi-dimensional, physically aware data object that can represent more complex multi-dimensional datasets, such as that from NASA’s Interface Region Imaging Spectrometer (IRIS) and other spectrometer instruments.  Finally, SunPy’s affiliated package program encourages the development of SunPy-based code that performs specific scientific tasks such as analyzing solar radio spectra.


SunPy Community, S.J. Mumford, S. Christe, et al. 2015, Computational Science and Discovery, 8, 014009.

D. Pesnell, B. J. Thompson, and P. C. Chamberlin. The solar dynamics observatory (SDO). Solar Physics, 275:3–15, Ja

Jack Ireland, lead support scientist at NASA/GSFC and Communications Officer for SunPy Project

nuary 2012.


This blogpost is written by Jack Ireland from the SunPy Community

Kamalam Vanninathan has a PhD in Solar Physics and has done a post-doc at the University of Graz. She has shifted focus from research to scientific funding and currently works for STFC. She is also an aspiring science communicator and loves nothing more than to be able to share the latest and greatest science has to offer! She tweets as @DrKamalamV.


  1. Very great post. I am interested in this topic and on this site I got more informative information. I am very comfortable to this beautiful content from the pure reading.Thanks for keen up the good working. look forward to reading many articles from you. keep posting.

  2. this article contain so much information about solar data analysis. this may help us in analyzing solar data. thanks for sharing this with all…

  3. Thanks for sharing this post,
    is very helpful article.

  4. Nice article. Thanks for sharing . keep sharing.

  5. hello
    thank you so much for this.
    Beautiful article

  6. Thanks for sharing this Great article.

  7. We should support such endeavors led by the team. Amazed by how Sunpy community caters to us and made progress in astounding scientific ways.

  8. thanks for the cool article, appreciate the writings

  9. It is the best time to make some plans for the future and it is time to
    be happy. I’ve read this post and if I could I want to suggest you some interesting things or suggestions.
    Perhaps you can write next articles referring to this article.
    I want to read more things about it!

  10. nice to know about the solar data analysis, thanks for the tips here

Comments are now closed for this post.