This lesson covers the functionality in SunPy to download solar physics data from various places. It has been written for the current release (v0.5.4), despite the fact there are large improvements in the downloading software for SunPy v0.6.
This lesson will cover the core downloaders available in the sunpy.net
submodule, we will cover the following topics:
The VSO is a centralised portal to many different sources of solar physics data. SunPy has a very powerful and easy to use VSO client, which we are going to use to download an AIA image.
Import the vso
module:
Create a client instance:
Query the VSO:
Download the File:
Having done a quick demo of the VSO client, we will now go through the steps in more detail and explain them. The main part of the VSO interface is the query syntax.
The query syntax allows you to perform very complex queries, by using the logical and &
and logical or |
operators on the individual query attributes.
The query attributes live in the sunpy.net.vso.attrs
namespace, which we have imported as vso.attrs
.
The attributes available for use in a VSO query are:
You can combine these attributes to make simple or more complex queries. First, let's explain the example we used earlier:
vclient.query(vso.attrs.Time('2015/03/15T00:00:00', '2015/03/15T00:00:01') & vso.attrs.Instrument('AIA'))
The Time
attribute, specifies a time range for the data, you must specify a start and an end value to Time
.
The Instrument
attribute specifies the name of the instrument used to collect the data, the list of available instruments is on the VSO website: http://sdac.virtualsolar.org/cgi/show_details?keyword=INSTRUMENT
When we passed these into query()
we used the &
symbol to tell query()
that we wanted VSO to look for records that satisfied both attributes.
It is also possible to use the |
operator to get multiple results:
We can also construct these queries outside of the query()
method, to make it easier to read or to make multiple queries:
So far we have been downloading files using get()
with the default options. In this section we are going to look at how to customise these options and save the files to different directories.
Once we have obtained the results we can download them with the get()
method:
The important parameters for the get method are the path
and the methods
keyword arguments.
path
allows you to specify where the data is downloaded to, by default it goes to the SunPy data directory, which defaults to ~/sunpy/data
, this (and other options) can be set in the SunPy config file ~/.sunpy/sunpyrc
.
The parameters that you can use for the path formatting is anything that is in the QueryResponse
object, or the results from query:
Things that have multiple nested properties can be acessed via .
i.e. time.start
or wave.wavemin
.
method
allows you to request the data in a different form, such as a tarball or a RICE compressed image for AIA: