1. Introduction

This tutorial is intended to help the solar community to start working with IRIS Level 2 data using Python. It is especially oriented to those who have a limited knowledge of Python and want to start using this language to analyze IRIS data. Although more advanced Python packages are available for this purpose, this tutorial focuses on the first steps needed to start working with the IRIS Level 2 data, in this context that means: how to download the data from the IRIS database on the internet; how to read the downloaded data and visualize them; and how to save those variables that are of our interest.

In the chapters that follow, a tutorial presents simple and efficient Python tools to download, read, visualize, and analyze IRIS data, as well as a short introduction to start using the IRISpy package.

Further information for users interested in more-advanced Python packages can find them at:

  • IRISpy: the SunPy communty effort to work with IRIS data, and

  • IRISreader: a package oriented to read the IRIS data and prepare them for Machine Learning tasks developed by Cédric Huwyler.

Tip

If you are not interested in to learn the concepts behind the code that this tutorial presents, and you just want to start working in Python, you just need to learn how to install the needed Python packages, Section 1.1 , how to look for and download IRIS Level 2 data in Section 2 , and copy-paste a 12-line code presented in Section 3.6.

1.1. Software requirements

The codes used in this tutorial are available at IRIS-LMSALpy repository. You can install this package using any of these commands in your shell session:

git clone git@gitlab.com:LMSAL_HUB/iris_hub/iris_lmsalpy.git
git clone https://gitlab.com/LMSAL_HUB/iris_hub/iris_lmsalpy.git

Note

The text in the code block can be copied to the clipboard by clicking on the 2-page icon located in the upper right corner of the code block. In the Python code blocks, only the text preceded by “>>> ” will be copied to the clipboard. Thus, you just need to type Ctrl+V to paste the code in your Python session, your Python notebook, or your shell session (for the shell commands). If the code block has a horizontal scroll bar because one or more of the lines in the block is too long, the 2-page icon will appear once the scroll bar has been moved totally to its right limit (e.g. the \(1^{st}\) code block in Section 2).

A more detailed description of the installation can be found at IRIS-LMSALpy repository.

The IRIS-LMSALpy package uses standard Python packages that may need to be installed in your Python distribution. These packages are: astropy, json, matplotlib, numpy, os, requests, traceback, PyQt5, and pyqtgraph. Thus, if an error is raised after executing any of the following lines:

>>> import astropy
>>> import json
>>> import matplotlib
>>> import numpy
>>> import requests
>>> import os
>>> import traceback
>>> import PyQt5
>>> import pyqtgraph

then you should install the missing package using one of these commands in your shell session:

conda install <package-name>
pip install <package-name>