VSOClient

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

Bases: sunpy.net.base_client.BaseClient

Main VSO Client.

Attributes Summary

method_order

Methods Summary

by_fileid(response)

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

by_provider(response)

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

create_getdatarequest(maps, methods[, info])

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

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.

latest()

Deprecated since version 1.0.

link(query_response, maps)

Return list of paths with records associated with them in the meta attribute.

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, queryresponse, resp, url)

multiple_choices(choices, response)

Override to pick between multiple download choices.

query_legacy([tstart, tend])

Deprecated since version 1.0.

search(*query)

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

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

Methods Documentation

static by_fileid(response)[source] [edit on github]

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

static by_provider(response)[source] [edit on github]

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

create_getdatarequest(maps, methods, info=None)[source] [edit on github]

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

download(method, url, downloader, *args)[source] [edit on github]

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

download_all(response, methods, downloader, path, qr, info=None)[source] [edit on github]
fetch(query_response, path=None, methods=None, site=None, progress=True, overwrite=False, downloader=None, wait=True)[source] [edit on github]

Download data specified in the query_response.

Parameters
  • query_response (sunpy.net.vso.QueryResponse) – 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) # doctest:+SKIP
latest()[source] [edit on github]

Deprecated since version 1.0: The latest function is deprecated and may be removed in a future version.

Return newest record (limited to last week).

Return list of paths with records associated with them in the meta attribute.

make(atype, **kwargs)[source] [edit on github]

Create a new SOAP object.

make_getdatarequest(response, methods=None, info=None)[source] [edit on github]

Make datarequest with methods from response.

merge(queryresponses)[source] [edit on github]

Merge responses into one.

missing_information(info, field)[source] [edit on github]

Override to provide missing information.

static mk_filename(pattern, queryresponse, resp, url)[source] [edit on github]
multiple_choices(choices, response)[source] [edit on github]

Override to pick between multiple download choices.

query_legacy(tstart=None, tend=None, **kwargs)[source] [edit on github]

Deprecated since version 1.0: The query_legacy function is deprecated and may be removed in a future version. Use sunpy.net.Fido instead.

Query data from the VSO mocking the IDL API as close as possible. Either tstart and tend or date_start and date_end or date have to be supplied.

Parameters
  • tstart (datetime.datetime) – Start of the time-range in which records are searched.

  • tend (datetime.datetime) – Start of the time-range in which records are searched.

  • date (str) – (start date) - (end date)

  • start_date (datetime) – the start date

  • end_date (datetime) – the end date

  • wave (str) – (min) - (max) (unit)

  • min_wave (str) – minimum spectral range

  • max_wave (str) – maximum spectral range

  • unit_wave (str) – spectral range units (Angstrom, GHz, keV)

  • extent (str) – VSO ‘extent type’ … (FULLDISK, CORONA, LIMB, etc)

  • physobj (str) – VSO ‘physical observable’

  • provider (str) – VSO ID for the data provider (SDAC, NSO, SHA, MSU, etc)

  • source (str) – spacecraft or observatory (SOHO, YOHKOH, BBSO, etc) synonyms : spacecraft, observatory

  • instrument (str) – instrument ID (EIT, SXI-0, SXT, etc) synonyms : telescope, inst

  • detector (str) – detector ID (C3, EUVI, COR2, etc.)

  • layout (str) – layout of the data (image, spectrum, time_series, etc.)

  • level (str) – level of the data product (numeric range, see below)

  • pixels (str) – number of pixels (numeric range, see below)

  • resolution (str) – effective resolution (1 = full, 0.5 = 2x2 binned, etc) numeric range, see below.

  • pscale (str) – pixel scale, in arcseconds (numeric range, see below)

  • near_time (datetime) – return record closest to the time. See below.

  • sample (int) – attempt to return only one record per SAMPLE seconds. See below.

  • Ranges (Numeric) –

    • May be entered as a string or any numeric type for equality matching

    • May be a string of the format ‘(min) - (max)’ for range matching

    • May be a string of the form ‘(operator) (number)’ where operator is one of: lt gt le ge < > <= >=

Examples

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

>>> from datetime import datetime
>>> from sunpy.net import vso
>>> client = vso.VSOClient()  # doctest: +SKIP
>>> qr = client.query_legacy(datetime(2010, 1, 1),
...                          datetime(2010, 1, 1, 1),
...                          instrument='eit')  # doctest: +SKIP
Returns

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

search(*query)[source] [edit on github]

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

The new query language allows complex queries to be easily formed.

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
>>> client = vso.VSOClient()  # doctest: +REMOTE_DATA
>>> client.search(
...    vso.attrs.Time(datetime(2010, 1, 1), datetime(2010, 1, 1, 1)),
...    vso.attrs.Instrument('eit') | vso.attrs.Instrument('aia'))   # doctest:  +REMOTE_DATA
<QTable length=5>
   Start Time [1]       End Time [1]    Source ...   Type   Wavelength [2]
                                               ...             Angstrom
       str19               str19         str4  ...   str8      float64
------------------- ------------------- ------ ... -------- --------------
2010-01-01 00:00:08 2010-01-01 00:00:20   SOHO ... FULLDISK 195.0 .. 195.0
2010-01-01 00:12:08 2010-01-01 00:12:20   SOHO ... FULLDISK 195.0 .. 195.0
2010-01-01 00:24:10 2010-01-01 00:24:22   SOHO ... FULLDISK 195.0 .. 195.0
2010-01-01 00:36:08 2010-01-01 00:36:20   SOHO ... FULLDISK 195.0 .. 195.0
2010-01-01 00:48:09 2010-01-01 00:48:21   SOHO ... FULLDISK 195.0 .. 195.0
Returns

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

unknown_method(response)[source] [edit on github]

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