Getting data from CDAWeb#

How to download data from the Coordinated Data Analysis Web (CDAWeb).

CDAWeb stores data from from current and past space physics missions, and is full of heliospheric insitu datasets.

from import Fido
from import attrs as a
from sunpy.timeseries import TimeSeries is the primary interface to search for and download data and will automatically search CDAWeb when the cdaweb.Dataset attribute is provided to the search. To lookup the different dataset IDs available, you can use the form at

trange = a.Time('2021/07/01', '2021/07/08')
dataset = a.cdaweb.Dataset('SOLO_L2_MAG-RTN-NORMAL-1-MINUTE')
result =, dataset)

Let’s inspect the results. We can see that there’s seven files, one for each day within the query.

Results from 1 Provider:

7 Results from the CDAWEBClient:

            Dataset                    Start time               End time
------------------------------- ----------------------- -----------------------
SOLO_L2_MAG-RTN-NORMAL-1-MINUTE 2021-07-01 00:00:29.000 2021-07-01 23:59:30.000
SOLO_L2_MAG-RTN-NORMAL-1-MINUTE 2021-07-02 00:00:29.000 2021-07-02 23:59:30.000
SOLO_L2_MAG-RTN-NORMAL-1-MINUTE 2021-07-03 00:00:29.000 2021-07-03 23:59:30.000
SOLO_L2_MAG-RTN-NORMAL-1-MINUTE 2021-07-04 00:00:29.000 2021-07-04 23:59:30.000
SOLO_L2_MAG-RTN-NORMAL-1-MINUTE 2021-07-05 00:00:29.000 2021-07-05 23:59:30.000
SOLO_L2_MAG-RTN-NORMAL-1-MINUTE 2021-07-06 00:00:29.000 2021-07-06 23:59:30.000
SOLO_L2_MAG-RTN-NORMAL-1-MINUTE 2021-07-07 00:00:29.000 2021-07-07 23:59:30.000

Let’s download the first two files

downloaded_files = Fido.fetch(result[0, 0:2])
['/home/docs/sunpy/data/solo_l2_mag-rtn-normal-1-minute_20210701_v01.cdf', '/home/docs/sunpy/data/solo_l2_mag-rtn-normal-1-minute_20210702_v01.cdf']

Finally we can load and take a look at the data using TimeSeries This requires an installation of the cdflib Python library to read the CDF file.

solo_mag = TimeSeries(downloaded_files, concatenate=True)
solo_mag.peek(columns=['B_RTN_0', 'B_RTN_1', 'B_RTN_2'])
search cdaweb

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

Gallery generated by Sphinx-Gallery