VSOClient#

class sunpy.net.vso.VSOClient(url=None, port=None, api=None)[source]#

Bases: BaseClient

Provides access to query and download from Virtual Solar Observatory (VSO).

Parameters:
  • url (str, optional) – The VSO url to use. If not specified will use the first online known URL.

  • port (str, optional) – The VSO port name to use. If not specified will use the first online known URL.

  • api (zeep.Client, optional) – The zeep.Client instance to use for interacting with the VSO. If not specified one will be created.

Attributes Summary

info_url

This should return a string that is a URL to the data server or documentation on the data being served.

method_order

Methods Summary

by_fileid(response)

Returns a dictionary of fileids corresponding to records in the response.

create_getdatarequest(maps, methods[, info])

Create datarequest from maps mapping data provider to fileids and methods,

create_parse_vso_values()

Makes a network call to the VSO API that returns what keywords they support.

download(method, url, downloader, *args, ...)

Enqueue a file to be downloaded, extra args are passed to mk_filename

download_all(response, methods, downloader, ...)

fetch(query_response[, path, methods, site, ...])

Download data specified in the query_response.

load_vso_values()

We take this list and register all the keywords as corresponding Attrs.

make(atype, **kwargs)

Create a new SOAP object.

make_getdatarequest(response[, methods, info])

Make datarequest with methods from response.

merge(queryresponses)

Merge responses into one.

missing_information(info, field)

Override to provide missing information.

mk_filename(pattern, queryresponserow, resp, url)

Generate the best possible (or least-worse) filename for a VSO download.

multiple_choices(choices, response)

Override to pick between multiple download choices.

register_values()

This enables the client to register what kind of Attrs it can use directly.

search(*query[, response_format])

Query data from the VSO with the new API.

unknown_method(response)

Override to pick a new method if the current one is unknown.

Attributes Documentation

info_url#
method_order = ['URL-FILE_Rice', 'URL-FILE', 'URL-packaged', 'URL-TAR_GZ', 'URL-ZIP', 'URL-TAR']#

Methods Documentation

static by_fileid(response)[source]#

Returns a dictionary of fileids corresponding to records in the response.

create_getdatarequest(maps, methods, info=None)[source]#

Create datarequest from maps mapping data provider to fileids and methods,

static create_parse_vso_values()[source]#

Makes a network call to the VSO API that returns what keywords they support. We take this list and register all the keywords as corresponding Attrs.

download(method, url, downloader, *args, **kwargs)[source]#

Enqueue a file to be downloaded, extra args are passed to mk_filename

download_all(response, methods, downloader, path, qr, info=None, **kwargs)[source]#
fetch(query_response, path=None, methods=None, site=None, progress=True, overwrite=False, downloader=None, wait=True, **kwargs)[source]#

Download data specified in the query_response.

Parameters:
  • query_response (sunpy.net.vso.VSOQueryResponseTable) – QueryResponse containing the items to be downloaded.

  • path (str) – Specify where the data is to be downloaded. Can refer to arbitrary fields of the QueryResponseItem (instrument, source, time, …) via string formatting, moreover the file-name of the file downloaded can be referred to as file, e.g. “{source}/{instrument}/{time.start}/{file}”.

  • methods (list of str) – Download methods, defaults to URL-FILE_Rice then URL-FILE. Methods are a concatenation of one PREFIX followed by any number of SUFFIXES i.e. PREFIX-SUFFIX_SUFFIX2_SUFFIX3. The full list of PREFIXES and SUFFIXES are listed on the VSO site.

  • site (str) – There are a number of caching mirrors for SDO and other instruments, some available ones are listed below.

    NSO

    National Solar Observatory, Tucson (US)

    SAO (aka CFA)

    Smithonian Astronomical Observatory, Harvard U. (US)

    SDAC (aka GSFC)

    Solar Data Analysis Center, NASA/GSFC (US)

    ROB

    Royal Observatory of Belgium (Belgium)

    MPS

    Max Planck Institute for Solar System Research (Germany)

    UCLan

    University of Central Lancashire (UK)

    IAS

    Institut Aeronautique et Spatial (France)

    KIS

    Kiepenheuer-Institut fur Sonnenphysik Germany)

    NMSU

    New Mexico State University (US)

  • progress (bool, optional) – If True show a progress bar showing how many of the total files have been downloaded. If False, no progress bars will be shown at all.

  • overwrite (bool or str, optional) – Determine how to handle downloading if a file already exists with the same name. If False the file download will be skipped and the path returned to the existing file, if True the file will be downloaded and the existing file will be overwritten, if 'unique' the filename will be modified to be unique.

  • downloader (parfive.Downloader, optional) – The download manager to use.

  • wait (bool, optional) – If False downloader.download() will not be called. Only has any effect if downloader is not None.

Returns:

out (parfive.Results) – Object that supplies a list of filenames and any errors.

Examples

>>> files = fetch(qr) 
static load_vso_values()[source]#

We take this list and register all the keywords as corresponding Attrs.

Returns:

dict – The constructed Attrs dictionary ready to be passed into Attr registry.

make(atype, **kwargs)[source]#

Create a new SOAP object.

make_getdatarequest(response, methods=None, info=None)[source]#

Make datarequest with methods from response.

merge(queryresponses)[source]#

Merge responses into one.

missing_information(info, field)[source]#

Override to provide missing information.

static mk_filename(pattern, queryresponserow, resp, url)[source]#

Generate the best possible (or least-worse) filename for a VSO download.

  • Use the content-disposition header.

  • Use fileid to generate a file name if content-disposition fails

  • If everything else fails use the last segment of the URL and hope.

multiple_choices(choices, response)[source]#

Override to pick between multiple download choices.

classmethod register_values()[source]#

This enables the client to register what kind of Attrs it can use directly.

Returns:

dict – A dictionary with key values of Attrs and the values are a tuple of (“Attr Type”, “Name”, “Description”).

search(*query, response_format=None)[source]#

Query data from the VSO with the new API. Takes a variable number of attributes as parameter, which are chained together using AND.

Parameters:

response_format ({"legacy", "table"}, optional) – The response format from the search, this can be either "legacy" to return a list-like object of the zeep responses, or "table" to return the responses in a subclass of QTable.

Examples

Query all data from eit or aia between 2010-01-01T00:00 and 2010-01-01T01:00.

>>> from datetime import datetime
>>> from sunpy.net import vso, attrs as a
>>> client = vso.VSOClient()  
>>> client.search(
...    a.Time(datetime(2010, 1, 1), datetime(2010, 1, 1, 1)),
...    a.Instrument.eit | a.Instrument.aia,
...    response_format="table")   
<sunpy.net.vso.table_response.VSOQueryResponseTable object at ...>
    Start Time               End Time        Source ... Extent Type   Size
                                                    ...              Mibyte
----------------------- ----------------------- ------ ... ----------- -------
2010-01-01 00:00:08.000 2010-01-01 00:00:20.000   SOHO ...    FULLDISK 2.01074
2010-01-01 00:12:08.000 2010-01-01 00:12:20.000   SOHO ...    FULLDISK 2.01074
2010-01-01 00:24:10.000 2010-01-01 00:24:22.000   SOHO ...    FULLDISK 2.01074
2010-01-01 00:36:08.000 2010-01-01 00:36:20.000   SOHO ...    FULLDISK 2.01074
2010-01-01 00:48:09.000 2010-01-01 00:48:21.000   SOHO ...    FULLDISK 2.01074
Returns:

out (VSOQueryResponseTable) – Matched items. Return value is of same type as the one of VSOClient.search().

unknown_method(response)[source]#

Override to pick a new method if the current one is unknown.