Plotting solar image in Python

Python provides the SunPy package for working with solar physics data and creating solar images. This package includes various solar datasets from observatories and labs, containing proton/electron flux data and imaging data.

You can install SunPy using the following command ?

pip install sunpy

What is AIA?

The Atmospheric Imaging Assembly (AIA) is an instrument aboard the Solar Dynamics Observatory (SDO) that captures high-resolution images of the Sun's atmosphere in multiple wavelengths. The AIA provides crucial data for understanding solar activity and space weather.

Creating a Solar Map

SunPy uses the Map class to handle solar image data. The sunpy.map.Map() function creates a map object from supported solar data products ?

import sunpy.map
import matplotlib.pyplot as plt
import sunpy.data.sample

# Create a map from AIA sample data
my_aia = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)

# Create figure and subplot with proper projection
fig = plt.figure(figsize=(8, 6))
ax = plt.subplot(111, projection=my_aia)

# Plot the solar image
my_aia.plot()

# Add solar limb and coordinate grid
my_aia.draw_limb()
my_aia.draw_grid()

# Add colorbar and display
plt.colorbar()
plt.title('Solar AIA 171 Angstrom Image')
plt.show()

Understanding the Code

The code above performs the following steps ?

  • sunpy.map.Map() − Creates a solar map object from the AIA 171 Angstrom sample image
  • projection=my_aia − Sets the proper coordinate system for solar data visualization
  • my_aia.plot() − Renders the solar image with appropriate scaling
  • draw_limb() − Adds the solar disk boundary
  • draw_grid() − Overlays coordinate grid lines

Output

Solar AIA 171 Angstrom Image X (arcsec) Y (arcsec) Intensity

Key Features

The SunPy visualization includes several important elements ?

  • Solar limb − The circular boundary of the solar disk
  • Coordinate grid − Helioprojective coordinate system for position reference
  • Color mapping − Intensity values mapped to colors for visualization
  • Proper projection − Solar-specific coordinate system handling

Conclusion

SunPy provides powerful tools for solar data visualization with the Map class. The AIA instrument data can be easily plotted with proper coordinate systems, solar limb boundaries, and coordinate grids for scientific analysis.

Updated on: 2026-03-25T04:57:15+05:30

441 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements