mglib

Personal IDL library for M. Galloy

single page | use frames     summary     class     fields     routine details     file attributes

misc/

mg_weather.pro

includes main-level program

Uses Google weather web service to report the current weather conditions and a 4 day forecast.

The raw data from Google looks like:

<?xml version="1.0"?> <xml_api_reply version="1"> <weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0" > <forecast_information> <city data="Boulder, CO"/> <postal_code data="80303"/> <latitude_e6 data=""/> <longitude_e6 data=""/> <forecast_date data="2010-09-29"/> <current_date_time data="2010-09-29 19:43:27 +0000"/> <unit_system data="US"/> </forecast_information> <current_conditions> <condition data="Sunny"/> <temp_f data="82"/> <temp_c data="28"/> <humidity data="Humidity: 12%"/> <icon data="/ig/images/weather/sunny.gif"/> <wind_condition data="Wind: NE at 16 mph"/> </current_conditions> <forecast_conditions> <day_of_week data="Wed"/> <low data="52"/> <high data="86"/> <icon data="/ig/images/weather/cloudy.gif"/> <condition data="Windy"/> </forecast_conditions> <forecast_conditions> <day_of_week data="Thu"/> <low data="55"/> <high data="81"/> <icon data="/ig/images/weather/sunny.gif"/> <condition data="Sunny"/> </forecast_conditions> <forecast_conditions> <day_of_week data="Fri"/> <low data="54"/> <high data="83"/> <icon data="/ig/images/weather/partly_cloudy.gif"/> <condition data="Partly Cloudy"/> </forecast_conditions> <forecast_conditions> <day_of_week data="Sat"/> <low data="50"/> <high data="77"/> <icon data="/ig/images/weather/sunny.gif"/> <condition data="Sunny"/> </forecast_conditions> </weather> </xml_api_reply>

Class description for mgffweatherparser

Inheritance

Properties

Properties in mgffweatherparser

_extra init

Routines

Routines from mg_weather.pro

mgffweatherparser::print

Print the information collected during the parsing.

mgffweatherparser::startElement, uri, local, qname, attName, attValue

Called by the parser when an XML tag is started.

result = mgffweatherparser::init( [_extra=keywords])

Initialize the weather parser object.

mgffweatherparser__define

Define inheritance from IDLffXMLSAX and the instance variables.

mg_weather, location

Print the current conditions and a 4 day forecast for the given location.

Routine details

top mgffweatherparser::print

mgffweatherparser::print

Print the information collected during the parsing.

top mgffweatherparser::startElement

mgffweatherparser::startElement, uri, local, qname, attName, attValue

Called by the parser when an XML tag is started.

Parameters

uri
local
qname
attName
attValue

top mgffweatherparser::init

result = mgffweatherparser::init( [_extra=keywords])

Initialize the weather parser object.

Return value

1 for success, 0 for failure

Keywords

_extra in optional type=keywords

keywords to IDLffXMLSAX::init

top mgffweatherparser__define

mgffweatherparser__define

Define inheritance from IDLffXMLSAX and the instance variables.

top mg_weather

mg_weather, location

Print the current conditions and a 4 day forecast for the given location.

Parameters

location in required type=string

zip code or city/state name, like '80303' or 'Boulder, CO'

Examples

For example:

IDL> mg_weather, 'Boulder, CO' Weather report for Boulder, CO at 2010-09-29 22:03:04 +0000 Current conditions are 84 and Partly Cloudy Wed -> Clear 83/49 Thu -> Sunny 79/50 Fri -> Partly Cloudy 81/50 Sat -> Sunny 75/46

File attributes

Modification date: Wed May 14 15:07:14 2014
Lines: 63
Docformat: rst rst
Personal library of Michael Galloy
Contact me if you have enhancement requests or bug fixes.