SunPy is a package for solar data analysis using Python. We will be using this package for analysis of solar data
On the command line type:
pip install sunpy
Downloading Sample Data
The SunPy package contains a number of data files which are solar data of proton/electron fluxes from various solar observatory and solar labs. They are stored under the module sunpy.data.
To download the sample data simply run the following command:
import sunpy.data sunpy.data.download_sample_data()
In this small project, we will see a very simple way to plot a sample AIA image.
AIA = Atmospheric Imaging Assembly (AIA), is another instrument board the Solar Dynamics Observatory(SDO) designed to study the solar corona, taking simultaneous full disc images in multiple wavelengths of the corona and transitional region (up to half a solar radius above the solar limb), with 1.5 arc sec resolution and 12 second temporal cadence or better.
First we try to explore.
Maps: Maps are the primary data type in SunPy they are spatially and / or temporally aware data arrays. There are types of maps for a 2D image, a time series of 2D images or 1D spectra or 2D spectrograms. Making a map of your data is the normally the first step in using SunPy to work with your data.
Creating a Map
SunPy supports many different data products from various sources ‘out of the box’ we shall use SDO’s AIA instrument as an example in this tutorial. The general way to create a map from one of the supported data products is with the sunpy.Map() command.
sunpy.Map() takes either a filename, list of filenames data array and header. We can test map with:
import sunpy aia = sunpy.Map(sunpy.AIA_171_IMAGE)
This returns a map named aia.
Plotting a sample solar data file
Let’s begin by creating a simple plot of an AIA image. To make things easy, SunPy includes several example files. These files have names like sunpy.AIA_171_IMAGE and sunpy.RHESSI_IMAGE.
If everything has been configured properly you should see an AIA image with a red colormap, a colorbar on the right-hand side and a title and some labels.
Solar data plotting is a crucial aspect in order to detect future solar flares and solar storms. Also it is important to note the variation of the proton and electron flux at various intervals of time.
This article is contributed by Prateek Chanda. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Graph Plotting in Python | Set 1
- Graph Plotting in Python | Set 2
- Graph Plotting in Python | Set 3
- Plotting graph using Seaborn | Python
- Python | Geographical plotting using plotly
- Python | Matplotlib Sub plotting using object oriented API
- Python | Plotting Google Map using gmplot package
- Python | Plotting Google Map using folium package
- Python | Plotting Fibonacci spiral fractal using Turtle
- Python | Plotting Data on Google Map using pygmaps package
- Python | Matplotlib Graph plotting using object oriented API
- Getting started with Scikit-image: image processing in Python
- Python | Plotting charts in excel sheet using openpyxl module | Set 3
- Python | Plotting Pie charts in excel sheet using XlsxWriter module
- Python | Plotting bar charts in excel sheet using XlsxWriter module