Example: Downloading Data Using Fido

Jupyter Notebook

Reference http://docs.sunpy.org/en/stable/guide/acquiring_data/fido.html

See also: Example: downloading data from JSOC

1
2
3
import astropy.units as u

from sunpy.net import Fido, attrs

To be clear, here we use

1
from sunpy.net import Fido, attrs
instead of examples in http://docs.sunpy.org/en/stable/guide/acquiring_data/jsoc.html
1
from sunpy.net import Fido, attrs as a

Searching for data

1
2
3
4
5
6
7
response = Fido.search(
attrs.Time('2014-01-01T00:00:00', '2014-01-01T00:01:00'),
# UTC time as default
attrs.Instrument('aia'),
attrs.Wavelength(304 * u.AA) | attrs.Wavelength(171 * u.AA)
)
response
Results from 2 Providers:

5 Results from the VSOClient:
QTable length=5
Start Time [1] End Time [1] Source Instrument Type Wavelength [2]
Angstrom
str19 str19 str3 str3 str8 float64
2014-01-01 00:00:07 2014-01-01 00:00:08 SDO AIA FULLDISK 304.0 .. 304.0
2014-01-01 00:00:19 2014-01-01 00:00:20 SDO AIA FULLDISK 304.0 .. 304.0
2014-01-01 00:00:31 2014-01-01 00:00:32 SDO AIA FULLDISK 304.0 .. 304.0
2014-01-01 00:00:43 2014-01-01 00:00:44 SDO AIA FULLDISK 304.0 .. 304.0
2014-01-01 00:00:55 2014-01-01 00:00:56 SDO AIA FULLDISK 304.0 .. 304.0

5 Results from the VSOClient:
QTable length=5
Start Time [1] End Time [1] Source Instrument Type Wavelength [2]
Angstrom
str19 str19 str3 str3 str8 float64
2014-01-01 00:00:11 2014-01-01 00:00:12 SDO AIA FULLDISK 171.0 .. 171.0
2014-01-01 00:00:23 2014-01-01 00:00:24 SDO AIA FULLDISK 171.0 .. 171.0
2014-01-01 00:00:35 2014-01-01 00:00:36 SDO AIA FULLDISK 171.0 .. 171.0
2014-01-01 00:00:47 2014-01-01 00:00:48 SDO AIA FULLDISK 171.0 .. 171.0
2014-01-01 00:00:59 2014-01-01 00:01:00 SDO AIA FULLDISK 171.0 .. 171.0


Indexing

  • First index: client (still necessary even if results are only found for a single client)

  • Second index: rows (must be integers or slices, not list)

See also http://docs.sunpy.org/en/stable/guide/acquiring_data/fido.html#indexing-search-results

1
response[1]
Results from 1 Provider:

5 Results from the VSOClient:
QTable length=5
Start Time [1] End Time [1] Source Instrument Type Wavelength [2]
Angstrom
str19 str19 str3 str3 str8 float64
2014-01-01 00:00:11 2014-01-01 00:00:12 SDO AIA FULLDISK 171.0 .. 171.0
2014-01-01 00:00:23 2014-01-01 00:00:24 SDO AIA FULLDISK 171.0 .. 171.0
2014-01-01 00:00:35 2014-01-01 00:00:36 SDO AIA FULLDISK 171.0 .. 171.0
2014-01-01 00:00:47 2014-01-01 00:00:48 SDO AIA FULLDISK 171.0 .. 171.0
2014-01-01 00:00:59 2014-01-01 00:01:00 SDO AIA FULLDISK 171.0 .. 171.0


1
response[1, ::2]
Results from 1 Provider:

3 Results from the VSOClient:
QTable length=3
Start Time [1] End Time [1] Source Instrument Type Wavelength [2]
Angstrom
str19 str19 str3 str3 str8 float64
2014-01-01 00:00:11 2014-01-01 00:00:12 SDO AIA FULLDISK 171.0 .. 171.0
2014-01-01 00:00:35 2014-01-01 00:00:36 SDO AIA FULLDISK 171.0 .. 171.0
2014-01-01 00:00:59 2014-01-01 00:01:00 SDO AIA FULLDISK 171.0 .. 171.0


1
response[0, 1]
Results from 1 Provider:

1 Results from the VSOClient:
QTable length=1
Start Time [1] End Time [1] Source Instrument Type Wavelength [2]
Angstrom
str19 str19 str3 str3 str8 float64
2014-01-01 00:00:19 2014-01-01 00:00:20 SDO AIA FULLDISK 304.0 .. 304.0


Downloading data

Download the entire results:

1
res = Fido.fetch(response, path='./data')

Download a subset:

1
res = Fido.fetch(response[0, 0], path='./data')

Fido.fetch will output a progress bar by default.