Created
April 1, 2016 06:42
-
-
Save dpshelio/6c0220e1a253f2fde56473964427d00d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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