Download SDO/AIA data

This example shows how to download SDO AIA data from the Joint Science Operations Center (JSOC) using the ITI tool.

import os
from datetime import datetime
from sunpy.map import Map
import matplotlib.pyplot as plt

from itipy.data.dataset import get_intersecting_files
from itipy.download.download_sdo import SDODownloader

Initialize path where to download the data

base_path = os.getcwd()

Set up the downloader for SDO with the path to download the data

The SDO downloader allows to download AIA data in all available wavelengths. In addition to the EUV observations from AIA, we can download the HMI magnetograms at 6173 Å.

jsoc_email = os.environ["JSOC_EMAIL"]
downloader = SDODownloader(base_path=base_path+'/sdo', email=jsoc_email, wavelengths=[171, 193, 211, 304])

Download the data for a specific date

downloader.downloadDate(date=datetime(2022, 4, 5, 5))

We can now glob the downloaded files and sort them by date

aia_files = get_intersecting_files(base_path+'/sdo', [171, 193, 211, 304])

In the next step we load the .fits files as SunPy maps.

aia_map171 = [Map(f) for f in aia_files[0]]
aia_map193 = [Map(f) for f in aia_files[1]]
aia_map211 = [Map(f) for f in aia_files[2]]
aia_map304 = [Map(f) for f in aia_files[3]]

We can visualize the map of the two instruments using the SunPy plotting capabilities

fig, axs = plt.subplots(1, 4, subplot_kw={'projection': aia_map171[0]}, figsize=(20, 10), dpi=100)
aia_map171[0].plot(axes=axs[0])
aia_map193[0].plot(axes=axs[1])
aia_map211[0].plot(axes=axs[2])
aia_map304[0].plot(axes=axs[3])
plt.show()
AIA $171 \; \mathrm{\mathring{A}}$ 2022-04-05 05:00:09, AIA $193 \; \mathrm{\mathring{A}}$ 2022-04-05 05:00:04, AIA $211 \; \mathrm{\mathring{A}}$ 2022-04-05 04:59:57, AIA $304 \; \mathrm{\mathring{A}}$ 2022-04-05 05:00:05
/home/docs/checkouts/readthedocs.org/user_builds/iti-documentation/envs/latest/lib/python3.8/site-packages/sunpy/map/mapbase.py:2650: SunpyUserWarning: The map world coordinate system (WCS) is different from the axes WCS. The map data axes may not correctly align with the coordinate axes. To automatically transform the data to the coordinate axes, specify `autoalign=True`.
  warn_user('The map world coordinate system (WCS) is different from the axes WCS. '
/home/docs/checkouts/readthedocs.org/user_builds/iti-documentation/envs/latest/lib/python3.8/site-packages/sunpy/map/mapbase.py:2650: SunpyUserWarning: The map world coordinate system (WCS) is different from the axes WCS. The map data axes may not correctly align with the coordinate axes. To automatically transform the data to the coordinate axes, specify `autoalign=True`.
  warn_user('The map world coordinate system (WCS) is different from the axes WCS. '
/home/docs/checkouts/readthedocs.org/user_builds/iti-documentation/envs/latest/lib/python3.8/site-packages/sunpy/map/mapbase.py:2650: SunpyUserWarning: The map world coordinate system (WCS) is different from the axes WCS. The map data axes may not correctly align with the coordinate axes. To automatically transform the data to the coordinate axes, specify `autoalign=True`.
  warn_user('The map world coordinate system (WCS) is different from the axes WCS. '

Total running time of the script: (0 minutes 13.667 seconds)

Gallery generated by Sphinx-Gallery