Both SunPy and Astropy have utilities for downloading data for your delectation. They are simple and easy to use, however increasing levels of computing will allow a great deal of personalisation and selection. Let us begin with SunPy
This is the main interface which SunPy to search for and find solar data. VSO stands for the Virtual Solar Observatory, a service which presents a homogenous interface to heterogenous data set.
So what do we need?
This is your client object. This is effectively the intermediary between yourself and the treasure chest of solar data available. You query VSO, then VSO querys all data providers which fit the limiations you imposed during your search command. The VSO client also handles the particulars of dowloading the data onto your machiene.
Lets kick off with an example, lets ask the veteran of solar imaging, SoHO for some EIS data, between the dates of between January 1st and 2nd, 2001,
qr is a Python list of response onjects, each one a record that the VSO has found.
So we can pass many attributes to the VSO, in this case we started with time
Start and end times for the query as strings, any date/time function can be understood by SunPy's parse_time function e.g. the datetime onjects we will look at later. Next we give it the instrument we want:
You don't have to pass it an instrument, the client will find all available missions in the parameter you've defined if you like. Next, wavelength:
We pass it a min and max wavelength. This has to be an astropy units quantity (in SI for the love of coffee). If you don't you will get an error.
For a full list of attributes that vso can take use `help(vso.attrs):
So we can use multiple instument queries and define get smaller sample times but narrowing down the query:
The Heliophysics Event Knowledgebase (HEK) is a repository of feature and event information about the Sun. Entries are generated both by automated algorithms and human observers.
We need to set up HEK in a similar way to VSO
Creating a very similar client as we saw with VSO above.
Given that HEK is a database of solar events of interest, the query has different requirements to VSO. It needs start and end times, and an event type. Again time objects can be defined as datetime objects or correctly formatted strings.
Event types are specified as uppercase two letter strings found on the HEK website
Notice that the HEK query is extremely similar to the VSO query style, with our attributes defined accordingly.
Instead of returning a list, HEK returns a list of dictionary objects. Each entry in the dictionary sis a pair of key-value pairs that exactly correspond to the parameters. We can return the key words using:
Remember, the HEK query we made returns all the flares in the time-range stored in the HEK, regardless of the feature recognition method. The HEK parameter which stores the the feature recognition method is called “frm_name”. Using list comprehensions (which are very cool), it is easy to get a list of the feature recognition methods used to find each of the flares in the result object, for example:
This way we can avoid troublesome doubling up of results. We can do the same
help(hek.attrs) command as VSO to fins out further options.
In this case the query is looking at a specific set of coordinates
These methods can be expanded to all the following modules