SunPy | Plotting a solar image in Python

File handling | Python Methods and Functions

At the command line, enter:

 pip install sunpy 

Download sample data

The SunPy package contains a series of data files that represent solar data on proton / electron fluxes from various solar observatories and solar laboratories. They are stored under the module. 
To download the sample data, just run the following command:

 import () 

In this small project we will see a very simple way to build a sample AIA images. 
The AIA = Atmospheric Imaging Assembly (AIA) is another solar dynamic observatory's (SDO) instrument panel for the study of the solar corona, allowing simultaneous full imaging of discs at several wavelengths of the corona and transition region (up to half the solar radius above the solar radius). solar limb), with a resolution of 1.5 arc seconds and a 12 second time rate or better. 
First we try to investigate. 
Maps: Maps are the primary data type in SunPy, they are geographically and / or temporally referenced datasets. There are map types for 2D imagery, 2D time series imagery, or 1D spectra or 2D spectrograms. Create a map of your data — this is usually the first step in using SunPy to work with your data.

Map Generation

SunPy supports many different data products from different sources "from boxes ”, we will use the AIA SDO tool as an example in this tutorial. A general way to create a map from one of the supported data products — using the command sunpy.Map ().

sunpy.Map () accepts either a filename, an array of filenames, and a title. We can check the map with:

 import sunpy aia = sunpy.Map (sunpy.AIA_171_IMAGE) 

This returns a map named AIA.

Building a sample solar data file

Let's start by creating a simple plot of an AIA image. To keep things simple, SunPy includes several sample files. These files are named sunpy.AIA_171_IMAGE and sunpy.RHESSI_IMAGE.

from sample import AIA_171_IMAGE

import sunpy. map

# We now create a map using the sample data.

aiamap = sunpy. map . Map (AIA_171_IMAGE)

# Now we're doing a quick plot.
aiamap.peek ()


If all set up correctly, you should see an AIA image with a red color map, color bar on the right and a title and some caption. 
Plotting solar data is a key aspect for detecting future solar flares and solar storms. It is also important to note the change in proton and electron flux at different times.

This article is courtesy of Pratik Chanda . If you are as Python.Engineering and would like to contribute, you can also write an article using or by posting the article [email protected] ... See my article appearing on the Python.Engineering homepage and help other geeks.

Please post comments if you find anything wrong or if you'd like to share more information on the topic discussed above.