UnifiedDownloaderFactory¶
- class sunpy.net.fido_factory.UnifiedDownloaderFactory(default_widget_type=None, additional_validation_functions=[], registry=None)[source]¶
Bases:
BasicRegistrationFactory
Fido is a unified data search and retrieval tool.
It provides simultaneous access to a variety of online data sources, some cover multiple instruments and data products like the Virtual Solar Observatory and some are specific to a single source.
For details of using
Fido
see Finding and Downloading Data.Methods Summary
__call__
(*args, **kwargs)Method for running the factory.
fetch
(*query_results[, path, max_conn, ...])Download the records represented by
QueryResponseTable
orUnifiedResponse
objects.search
(*query)Query for data in form of multiple parameters.
Methods Documentation
- __call__(*args, **kwargs)[source]¶
Method for running the factory.
Arguments args and kwargs are passed through to the validation function and to the constructor for the final type.
- fetch(*query_results, path=None, max_conn=5, progress=True, overwrite=False, downloader=None, **kwargs)[source]¶
Download the records represented by
QueryResponseTable
orUnifiedResponse
objects.- Parameters:
*query_results (
sunpy.net.fido_factory.UnifiedResponse
orQueryResponseTable
) – Container returned by query method, or multiple.path (
str
) – The directory to retrieve the files into. Can refer to any fields inresponse_block_properties
via string formatting, moreover the file-name of the file downloaded can be referred to as file, e.g. “{source}/{instrument}/{time.start}/{file}”.max_conn (
int
, optional) – The number of parallel download slots.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. If specified themax_conn
,progress
andoverwrite
arguments are ignored.
- Returns:
Examples
>>> from sunpy.net.attrs import Time, Instrument >>> unifresp = Fido.search(Time('2012/3/4','2012/3/5'), Instrument('EIT')) >>> filepaths = Fido.fetch(unifresp)
If any downloads fail, they can be retried by passing the
parfive.Results
object back intofetch
.>>> filepaths = Fido.fetch(filepaths)
- search(*query)[source]¶
Query for data in form of multiple parameters.
Examples
Query for LYRA timeseries data for the time range (‘2012/3/4’,’2012/3/6’)
>>> from sunpy.net import Fido, attrs as a >>> import astropy.units as u >>> unifresp = Fido.search(a.Time('2012/3/4', '2012/3/6'), a.Instrument.lyra)
Query for data from Nobeyama Radioheliograph and RHESSI
>>> unifresp = Fido.search(a.Time('2012/3/4', '2012/3/6'), ... (a.Instrument.norh & a.Wavelength(17*u.GHz)) | a.Instrument.rhessi)
Query for 304 Angstrom SDO AIA data with a cadence of 10 minutes
>>> import astropy.units as u >>> from sunpy.net import Fido, attrs as a >>> unifresp = Fido.search(a.Time('2012/3/4', '2012/3/6'), ... a.Instrument.aia, ... a.Wavelength(304*u.angstrom, 304*u.angstrom), ... a.Sample(10*u.minute))
- Parameters:
*query (
sunpy.net.vso.attrs
,sunpy.net.jsoc.attrs
) – A query consisting of multiple parameters which define the requested data. The query is specified using attributes from the VSO and the JSOC. The query can mix attributes from the VSO and the JSOC.- Returns:
sunpy.net.fido_factory.UnifiedResponse
– Container of responses returned by clients servicing query.
Notes
The conjunction ‘and’ transforms query into disjunctive normal form ie. query is now of form A & B or ((A & B) | (C & D)) This helps in modularising query into parts and handling each of the parts individually.