Computer Sciences Department logo

CS 368-1 (2010 Summer) — Day 11 Homework

Due Friday, July 30th, at the start of class.

Weather Forecast Analysis, Part I

The purpose of this four-part project is to compare weather forecasts against actual weather observations. In this first part, you will write a script that downloads the current weather forecast and parses it.


Every day, sometimes several times during the day, there is a text weather forecast for Madison posted at the following URL:

The forecast is generally for the next several days. But, we are simply interested in the forecast for today. Here is a sample of the actual HTML that includes the forecast for one day:

<H1>Madison Forecast</H1>
Local Madison Forecast
300 AM CDT THU JUL 29 2010
<br><br><font size=+1><B>TODAY...</B></font>SUNNY. HIGHS IN THE LOWER 80S. NORTHWEST WINDS UP TO
5 MPH.
<br><br><font size=+1><B>TONIGHT...</B></font>PARTLY CLOUDY. LOWS AROUND 60. NORTHWEST WINDS UP TO

Note: The sample above does not include most of the actual HTML page downloaded from the URL above. There are many more lines in the real file!

The goal for today is to parse enough of the downloaded forecast to get a Unix time for the forecast time, and actual numeric forecast predictions for the high and low temperatures.

Required Features

For today, your script must:

Optional Features

Questions for Thought


Do the work yourself, consulting reasonable reference materials as needed; any reference material that gives you a complete or nearly complete solution to this problem or a similar one is not OK to use. Asking the instructors for help is OK, asking other students for help is not.

Hand In

A printout of your script on a single sheet of paper. Be sure to put your own name in the initial comment block of the code. Identifying your work is important, or you may not receive appropriate credit.