I have a basic script that can parse the temperature, dew point, altimeter, etc. However, how can I parse a conditional string like the sky condition? I'd like to parse the data and have it print: "Sky Condition: few at 2000 ft AGL" for example.
import xml.etree.ElementTree as ET
from urllib import urlopen
link = urlopen('http://weather.aero/dataserver_current/httpparam?dataSource=metars& requestType=retrieve&format=xml&stationString=KSFO&hoursBeforeNow=1')
tree = ET.parse(link)
root = tree.getroot()
data = root.findall('data/METAR')
for metar in data:
print metar.find('temp_c').text