Change language

SunPy | Plotting a solar image in Python

|

Install
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 sunpy.data module. 
To download the sample data, just run the following command:

 import sunpy.data sunpy.data.download_sample_data () 

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 sunpy.data. 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 ()

Exit

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 contribute.python.engineering 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.

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

Common xlabel/ylabel for matplotlib subplots

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

12 answers

NUMPYNUMPY

Flake8: Ignore specific warning for entire file

12 answers

NUMPYNUMPY

glob exclude pattern

12 answers

NUMPYNUMPY

How to avoid HTTP error 429 (Too Many Requests) python

12 answers

NUMPYNUMPY

Python CSV error: line contains NULL byte

12 answers

NUMPYNUMPY

csv.Error: iterator should return strings, not bytes

12 answers

News


Wiki

Python | How to copy data from one Excel sheet to another

Common xlabel/ylabel for matplotlib subplots

Check if one list is a subset of another in Python

sin

How to specify multiple return types using type-hints

exp

Printing words vertically in Python

exp

Python Extract words from a given string

Cyclic redundancy check in Python

Finding mean, median, mode in Python without libraries

cos

Python add suffix / add prefix to strings in a list

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

Python - Move item to the end of the list

Python - Print list vertically