Skip to content

Instantly share code, notes, and snippets.

@erget
Created October 7, 2016 13:11
Show Gist options
  • Save erget/9e356ea4bef4b653f51f7699017cd7a4 to your computer and use it in GitHub Desktop.
Save erget/9e356ea4bef4b653f51f7699017cd7a4 to your computer and use it in GitHub Desktop.
Download most recent Meteosat RGB composite at 0°
#!/usr/bin/env python3
# -*- coding: <encoding name> -*-
"""Download most recent Meteosat RGB composite at 0°"""
from selenium import webdriver
from urllib.request import urlopen
from argparse import ArgumentParser
URL = "http://oiswww.eumetsat.org/IPPS/html/MSG/RGB/NATURALCOLOR/FULLRESOLUTION/index.htm"
def download_current_meteosat():
"""Download current Meteosat 0 full disc view."""
browser = webdriver.PhantomJS()
browser.get(URL)
img_element = browser.find_element_by_name("mainImage")
img_url = img_element.get_attribute("src")
browser.quit()
return urlopen(img_url).read()
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument("outfile")
outfile = parser.parse_args().outfile
with open(outfile, "wb") as out:
out.write(download_current_meteosat())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment