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) – Thezeep.Client
instance to use for interacting with the VSO. If not specified one will be created.
Attributes Summary
This should return a string that is a URL to the data server or documentation on the data being served.
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,
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.
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.
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
- fetch(
- query_response,
- path=None,
- methods=None,
- site=None,
- progress=True,
- overwrite=False,
- downloader=None,
- wait=True,
- **kwargs,
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
ofstr
) – 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) – IfTrue
show a progress bar showing how many of the total files have been downloaded. IfFalse
, no progress bars will be shown at all.overwrite (
bool
orstr
, optional) – Determine how to handle downloading if a file already exists with the same name. IfFalse
the file download will be skipped and the path returned to the existing file, ifTrue
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) – IfFalse
downloader.download()
will not be called. Only has any effect ifdownloader
is notNone
.
- 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_getdatarequest(response, methods=None, info=None)[source]#
Make datarequest with methods from response.
- 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 failsIf everything else fails use the last segment of the URL and hope.
- 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 ofQTable
.Now deprecated, will be removed in sunpy 7.0.
- Returns:
out (
VSOQueryResponseTable
) – Matched items. Return value is of same type as the one ofVSOClient.search()
.