Searching and downloading from the VSO

How to download data from the VSO with Fido.

import astropy.units as u
from sunpy.net import Fido, attrs as a

Fido is the primary interface to search for and download data and will search the VSO when appropriate. The following example searches for all SOHO/EIT images between the times defined below by defining a timerange (Time) and the instrument (Instrument).

attrs_time = a.Time('2005/01/01 00:10', '2005/01/01 00:15')
result = Fido.search(attrs_time, a.Instrument('eit'))

Let’s inspect the results.

print(result)

Out:

Results from 1 Provider:

1 Results from the VSOClient:
   Start Time [1]       End Time [1]    Source ...   Type   Wavelength [2]
                                               ...             Angstrom
       str19               str19         str4  ...   str8      float64
------------------- ------------------- ------ ... -------- --------------
2005-01-01 00:12:10 2005-01-01 00:12:22   SOHO ... FULLDISK 195.0 .. 195.0

The following shows how to download the results. If we don’t provide a path it will download the file into the sunpy data directory. The output provides the path of the downloaded files.

downloaded_files = Fido.fetch(result)
print(downloaded_files)

Out:

['/home/docs/sunpy/data/archive_soho_private_data_processed_eit_lz_2005_01_efz20050101.001210']

More complicated queries can be constructed by using relational operators. For example, it is possible to query two wavelengths at the same time with the OR operator (|).

result = Fido.search(a.Time('2012/03/04 00:00', '2012/03/04 00:02'),
                     a.Instrument('aia'),
                     a.Wavelength(171*u.angstrom) | a.Wavelength(94*u.angstrom))
print(result)

Out:

Results from 2 Providers:

11 Results from the VSOClient:
   Start Time [1]       End Time [1]    Source ...   Type   Wavelength [2]
                                               ...             Angstrom
       str19               str19         str3  ...   str8      float64
------------------- ------------------- ------ ... -------- --------------
2012-03-04 00:00:00 2012-03-04 00:00:01    SDO ... FULLDISK 171.0 .. 171.0
2012-03-04 00:00:12 2012-03-04 00:00:13    SDO ... FULLDISK 171.0 .. 171.0
2012-03-04 00:00:24 2012-03-04 00:00:25    SDO ... FULLDISK 171.0 .. 171.0
2012-03-04 00:00:36 2012-03-04 00:00:37    SDO ... FULLDISK 171.0 .. 171.0
2012-03-04 00:00:48 2012-03-04 00:00:49    SDO ... FULLDISK 171.0 .. 171.0
2012-03-04 00:01:00 2012-03-04 00:01:01    SDO ... FULLDISK 171.0 .. 171.0
2012-03-04 00:01:12 2012-03-04 00:01:13    SDO ... FULLDISK 171.0 .. 171.0
2012-03-04 00:01:24 2012-03-04 00:01:25    SDO ... FULLDISK 171.0 .. 171.0
2012-03-04 00:01:36 2012-03-04 00:01:37    SDO ... FULLDISK 171.0 .. 171.0
2012-03-04 00:01:48 2012-03-04 00:01:49    SDO ... FULLDISK 171.0 .. 171.0
2012-03-04 00:02:00 2012-03-04 00:02:01    SDO ... FULLDISK 171.0 .. 171.0

10 Results from the VSOClient:
   Start Time [1]       End Time [1]    Source ...   Type   Wavelength [2]
                                               ...             Angstrom
       str19               str19         str3  ...   str8      float64
------------------- ------------------- ------ ... -------- --------------
2012-03-04 00:00:02 2012-03-04 00:00:03    SDO ... FULLDISK   94.0 .. 94.0
2012-03-04 00:00:14 2012-03-04 00:00:15    SDO ... FULLDISK   94.0 .. 94.0
2012-03-04 00:00:26 2012-03-04 00:00:27    SDO ... FULLDISK   94.0 .. 94.0
2012-03-04 00:00:38 2012-03-04 00:00:39    SDO ... FULLDISK   94.0 .. 94.0
2012-03-04 00:00:50 2012-03-04 00:00:51    SDO ... FULLDISK   94.0 .. 94.0
2012-03-04 00:01:02 2012-03-04 00:01:03    SDO ... FULLDISK   94.0 .. 94.0
2012-03-04 00:01:14 2012-03-04 00:01:15    SDO ... FULLDISK   94.0 .. 94.0
2012-03-04 00:01:26 2012-03-04 00:01:27    SDO ... FULLDISK   94.0 .. 94.0
2012-03-04 00:01:38 2012-03-04 00:01:39    SDO ... FULLDISK   94.0 .. 94.0
2012-03-04 00:01:50 2012-03-04 00:01:51    SDO ... FULLDISK   94.0 .. 94.0

Total running time of the script: ( 0 minutes 5.874 seconds)

Gallery generated by Sphinx-Gallery