Downloading and plotting LASCO C2 data

How to download SOHO/LASCO C2 data with Fido and make a plot.

import matplotlib.pyplot as plt

import sunpy.map
from sunpy.net import Fido
from sunpy.net import attrs as a

In order to download the required data, we use sunpy.net.Fido, a downloader client. We define two search variables: a timerange and the instrument.

timerange = a.Time('2002/05/24 11:06', '2002/05/24 11:07')
instrument = a.Instrument.lasco
detector = a.Detector.c2
result = Fido.search(timerange, instrument, detector)

Let’s inspect the result.

print(result)
Results from 1 Provider:

2 Results from the VSOClient:
Source: http://vso.stanford.edu/cgi-bin/search
Total estimated size: 6.313 Mbyte

       Start Time               End Time        Source ... Extent Type   Size
                                                       ...              Mibyte
----------------------- ----------------------- ------ ... ----------- -------
2002-05-24 11:05:48.000 2002-05-24 11:06:14.000   SOHO ...      CORONA 4.00977
2002-05-24 11:06:05.000 2002-05-24 11:06:31.000   SOHO ...      CORONA 2.01074

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)
Files Downloaded:   0%|          | 0/2 [00:00<?, ?file/s]


22119649.fts:   0%|          | 0.00/2.11M [00:00<?, ?B/s]

25119649.fts:   0%|          | 0.00/4.20M [00:00<?, ?B/s]


22119649.fts:   0%|          | 1.02k/2.11M [00:00<04:20, 8.10kB/s]

25119649.fts:   0%|          | 1.02k/4.20M [00:00<08:28, 8.27kB/s]

25119649.fts:  16%|#6        | 675k/4.20M [00:00<00:00, 3.61MB/s]


22119649.fts:  40%|####      | 847k/2.11M [00:00<00:00, 4.17MB/s]



Files Downloaded:  50%|#####     | 1/2 [00:00<00:00,  1.73file/s]

25119649.fts:  89%|########8 | 3.74M/4.20M [00:00<00:00, 15.0MB/s]


Files Downloaded: 100%|##########| 2/2 [00:00<00:00,  3.02file/s]
Files Downloaded: 100%|##########| 2/2 [00:00<00:00,  2.71file/s]
['/home/docs/sunpy/data/25119649.fts', '/home/docs/sunpy/data/22119649.fts']

We can then load a downloaded file into a sunpy map and plot it.

lascomap = sunpy.map.Map(downloaded_files[0])
plt.figure()
lascomap.plot()
plt.show()
LASCO-C2 Orange white-light 2002-05-24 11:05:48
INFO: Missing metadata for solar radius: assuming the standard radius of the photosphere. [sunpy.map.mapbase]

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

Gallery generated by Sphinx-Gallery