Comment 4 for bug 1012797

Revision history for this message
Jack Ireland (jack-ireland) wrote :

A skeleton sunpy download script.

I've split the data acquisition script down to a very atomic level, basically trying to reproduce how people select features and events in helioviewer.org. This might get tedious if there are a lot of choices.

#
# SunPy data download script
# helioviewer_data_script_AIA_EIT_LASCO-C2_20120716_120354__20120716_140354.py
#
#
# (1) Helioviewer provenance information
# --------------------------------------
#
# Automatically generated by helioviewer.org on 2012/11/28 12:34:56 UT.
# This script uses the Virtual Solar Observatory (VSO; www.virtualsolar.org)
# and the Heliophysics Event Knowledgebase (HEK; www.lmsal.com/hek)
# service to access to the science data used to generate
# the helioviewer.org movie http://www.helioviewer.org/?movieid=ApdT15
#
#
# (2) The SunPy environment and commands used to find and acquire data
# ------------------------------------------------------------------------
#
# This script requires an up-to-date installation of SunPy. To install
# SunPy, please follow the instructions at www.sunpy.org.
#
# This script is provided AS-IS. NOTE: It may require editing for it to
# work on your local system. Also, many of the commands included here
# have more sophisticated options that can be used to optimize your ability
# to acquire the relevant data. Please consult the relevant documentation
# for further information.
#
# IMPORTANT NOTE
# These scripts query the VSO for the records they have access to. Data
# relevant to your request may be available elsewhere. Likewise, the HEK
# provides only the feature and event information they have access to.
# Other features and events relevant to your request may be available
# elsewhere.

from sunpy.net import vso
from sunpy.net import hek

vso_client = vso.VSOClient()
hek_client = hek.HEKClient()

# Query 1: AIA 171 data (full disk only)
vso_result1 = vso_client.query(vso.attrs.Time('2012/07/16 12:03:54', '2012/07/16 14:03:54'), vso.attrs.Instrument('aia'), vso.attrs.Wave(171,171))

# Query 2: AIA 304 data (full disk only)
vso_result2 = vso_client.query(vso.attrs.Time('2012/07/16 12:03:54', '2012/07/16 14:03:54'), vso.attrs.Instrument('aia'), vso.attrs.Wave(304,304))

# Query 3: LASCO C2
vso_result3 = vso_client.query(vso.attrs.Time('2012/07/16 12:03:54', '2012/07/16 14:03:54'), vso.attrs.Instrument('lasco-c2') )

# Download 1: AIA data (full disk only). WARNING - this may be a lot of data
vso_data1 = vso_client.get(vso_result1 , path='/Users/myname/data/')

# Download 2: AIA data (full disk only). WARNING - this may be a lot of data
vso_data2 = vso_client.get(vso_result2, path='/Users/myname/data/')

# Download 3: LASCO C2
vso_data3 = vso_client.get(vso_result3, path='/Users/myname/data/')

# Download 4: HEK results
hek_data1 = hek_client.query(hek.attrs.Time('2012/07/16 12:03:54', '2012/07/16 14:03:54'), hek.attrs.FL, hek.attrs.FRM.Name == 'SSW Latest Events')

# Download 5: HEK results
hek_data2 = hek_client.query(hek.attrs.Time('2012/07/16 12:03:54', '2012/07/16 14:03:54'), hek.attrs.CM)

# Download 6: HEK results
hek_data3 = hek_client.query(hek.attrs.Time('2012/07/16 12:03:54', '2012/07/16 14:03:54'), hek.attrs.AR, hek.attrs.FRM.Name == 'SPoCA')