1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
"""
=========================================
Downloading and plotting a AIA lightcurve
=========================================
This example shows how to download AIA data from JSOC and make a lightcurve plot.
"""
import matplotlib.pyplot as plt
import drms
###############################################################################
# First we will create a `drms.Client`, using the JSOC baseurl.
client = drms.Client()
###############################################################################
# Some keywords we are interested in; you can use client.keys(series) to get a
# list of all available keywords of a series.
keys = [
"T_REC",
"T_OBS",
"DATAMIN",
"DATAMAX",
"DATAMEAN",
"DATARMS",
"DATASKEW",
"DATAKURT",
"QUALITY",
]
###############################################################################
# Get detailed information about the series. Some keywords from
# aia.lev1_euv_12s are links to keywords in aia.lev1 and unfortunately some
# entries (like note) are missing for linked keywords, so we are using the
# entries from aia.lev1 in this case.
print("Querying series info...")
series_info = client.info("aia.lev1_euv_12s")
series_info_lev1 = client.info("aia.lev1")
for key in keys:
linkinfo = series_info.keywords.loc[key].linkinfo
if linkinfo is not None and linkinfo.startswith("lev1->"):
note_str = series_info_lev1.keywords.loc[key].note
else:
note_str = series_info.keywords.loc[key].note
print(f"{key:>10} : {note_str}")
###############################################################################
# Construct the DRMS query string: "Series[timespan][wavelength]"
qstr = "aia.lev1_euv_12s[2014-01-01T00:00:01Z/365d@1d][335]"
# Get keyword values for the selected timespan and wavelength
print(f"Querying keyword data...\n -> {qstr}")
result = client.query(qstr, key=keys)
print(f" -> {len(result)} lines retrieved.")
# Only use entries with QUALITY==0
result = result[result.QUALITY == 0]
print(f" -> {len(result)} lines after QUALITY selection.")
# Convert T_REC strings to datetime and use it as index for the series
result.index = drms.to_datetime(result.T_REC)
###############################################################################
# Create some simple plots
ax = result[["DATAMIN", "DATAMAX", "DATAMEAN", "DATARMS", "DATASKEW"]].plot(figsize=(8, 10), subplots=True)
ax[0].set_title(qstr, fontsize="medium")
plt.tight_layout()
plt.show()
|