Flare times on a GOES XRS plot

How to plot flare times as provided by the HEK on a GOES XRS plot.

import matplotlib.pyplot as plt

from sunpy.net import Fido
from sunpy.net import attrs as a
from sunpy.time import parse_time
from sunpy.timeseries import TimeSeries

Let’s grab GOES XRS data for a particular time of interest and the HEK flare data for this time from the NOAA Space Weather Prediction Center (SWPC).

tr = a.Time('2011-06-07 04:00', '2011-06-07 12:00')
results = Fido.search(tr, a.Instrument.xrs & a.goes.SatelliteNumber(15) | a.hek.FL & (a.hek.FRM.Name == 'SWPC'))  # NOQA

Then download the XRS data and load it into a TimeSeries.

files = Fido.fetch(results)
goes = TimeSeries(files)

Next let’s retrieve HEKTable from the Fido result and then load the first row from HEK results into flares_hek.

hek_results = results['hek']
flares_hek = hek_results[0]

Lets plot everything together.

fig, ax = plt.subplots()
           alpha=0.2, label=flares_hek['fl_goescls'])

goes hek m25

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

Gallery generated by Sphinx-Gallery