UnifiedDownloaderFactory

class sunpy.net.fido_factory.UnifiedDownloaderFactory(default_widget_type=None, additional_validation_functions=[], registry=None)[source] [edit on github]

Bases: sunpy.util.datatype_factory_base.BasicRegistrationFactory

sunpy.net.Fido(*args, **kwargs)

Search and Download data from a variety of supported sources.

Methods Summary

__call__(*args, **kwargs)

Method for running the factory.

fetch(*query_results[, path, max_conn, …])

Download the records represented by UnifiedResponse objects.

search(*query)

Query for data in form of multiple parameters.

Methods Documentation

__call__(*args, **kwargs)[source] [edit on github]

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] [edit on github]

Download the records represented by UnifiedResponse objects.

Parameters
  • query_results (sunpy.net.fido_factory.UnifiedResponse) – Container returned by query method, or multiple.

  • path (str) – The directory to retrieve the files into. Can refer to any fields in UnifiedResponse.response_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) – 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. If specified the max_conn, progress and overwrite arguments are ignored.

Returns

parfive.Results

Examples

>>> from sunpy.net.vso.attrs import Time, Instrument
>>> unifresp = Fido.search(Time('2012/3/4','2012/3/5'), Instrument('EIT'))  # doctest: +REMOTE_DATA
>>> filepaths = Fido.fetch(unifresp)  # doctest: +SKIP

If any downloads fail, they can be retried by passing the parfive.Results object back into fetch.

>>> filepaths = Fido.fetch(filepaths)  # doctest: +SKIP
search(*query)[source] [edit on github]

Query for data in form of multiple parameters.

Examples

Query for LYRALightCurve 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')) # doctest: +REMOTE_DATA

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'))  # doctest: +REMOTE_DATA

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.vso.Sample(10*u.minute))  # doctest: +REMOTE_DATA
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.