Skip to content

Instantly share code, notes, and snippets.

@dpshelio
Created April 1, 2016 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpshelio/6c0220e1a253f2fde56473964427d00d to your computer and use it in GitHub Desktop.
Save dpshelio/6c0220e1a253f2fde56473964427d00d to your computer and use it in GitHub Desktop.
import datetime
import matplotlib.pyplot as plt
import sunpy.map
from sunpy.time import TimeRange
from sunpy.util import scraper
from astropy.utils.data import download_file
timerange = TimeRange(datetime.datetime.now() - datetime.timedelta(hours=5),
datetime.datetime.now())
sdopattern = 'http://sdowww.lmsal.com/sdomedia/SunInTime/%Y/%m/%d/AIA%Y%m%d_%H%M%S_{wavelength:04d}.fits'
for wavelength in [211, 193, 1700]:
sdoscraper = scraper.Scraper(sdopattern, wavelength=wavelength)
urls = sdoscraper.filelist(timerange)
for url in urls:
filei = download_file(url)
# do watherver with the filei
mapi = sunpy.map.Map(filei)
plt.figure()
mapi.plot()
plt.savefig('/tmp/AIA_{wave:04.0f}_{date:%Y%m%d}.png'.format(wave=mapi.wavelength.value, date=mapi.date))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment