# CS 368-1 (2010 Summer) — Day 14 Homework

Due Thursday, August 5th, at the start of class.

## Weather Forecast Analysis, Part IV

The purpose of this four-part project is to compare weather forecasts against actual weather observations. In this fourth and final part, you will write a script that compares the archived forecasts and the archived observations and that generates a simple text report.

### Details

You have archived weather forecast data. You have archived, reduced weather observation data. Now it is time to compare the two.

When comparing the data, we want to know whether the actual observed high temperature for the day was within the forecast high range, higher than forecast, or lower than forecast. For example:

Forecast Text Forecast Range Observed High Result
IN THE LOWER 80S 81–83 82.235 correct forecast!
IN THE UPPER 70S 77–79 82.235 higher than forecast
AROUND 80 79–81 78.120 lower than forecast

Note: The “Forecast Range” values above are my own! Yours may differ a little bit, and that is OK.

There are many ways in which this task is hard. Make sure that your code handles all of these issues correctly:

• The forecast temperatures are in degrees Fahrenheit, but the observed temperatures are in degrees Celsius.
• The forecast timestamps are given in the local (Central) time zone, but the RIG data is in UTC time.
• When the forecast says TONIGHT and predicts the LOWS, it really means for the following early morning.

### Report Format #1 — Direct Comparisons

There are two suggested formats for the output. Choose only one!

If you want a simpler task, use a report format like this. The exact details of the format are up to you, but it should be similar in content and it must be wrapped text.

```On July 30, the forecast high was 81-83F and the actual high was 82.2F
(correct); the forecast low was 61-63F and the actual low was 64.2F
(high).

On July 31, the forecast high was 83-85F and the actual high was 86.2F
(high); the forecast low was 61-63F and the actual low was 61.1F
(correct).

On August 1, the forecast high was 83-85F and the actual high was
82.1F (low); the forecast low was 59-61F and the actual low was 60.5F
(correct).```

### Report Format #2 — Challenge!

There are two suggested formats for the output. Choose only one!

For a more interesting task, use a report format like the one shown in today’s slides. The main difference is that there is an extra step of figuring out some statistics about the forecast deviations. The exact details of the format are up to you, but it should be similar in content and it must be wrapped text.

```There are 5 days of data available between 31 July 2010 and 6 August
2010.  The forecast high was accurate on 3 days (60%); the actual high
temperature was higher than forecast on 2 days by an average of 1.6
degrees Fahrenheit.  The forecast low was accurate on 2 days (40%);
the actual low temperature was lower than forecast on 1 day by 2.0
degrees Fahrenheit, and the actual low temperature was higher than
forecast on 2 days by an average of 1.8 degrees Fahrenheit.```

## Required Features

• Correctly compare forecast and observed highs and lows, using consistent units and times
• Print a text report of the results, wrapped to 70 columns
• Use the configuration settings to limit the dates to compare and to choose the correct output units

## Optional Features

• Do the Challenge! report format
• Write unit tests for your code

## Questions for Thought

• If you get results, how will you know if they are correct?
• How will you match forecast dates/times and their corresponding observations?
• How will your script handle the floating-point data?

## Reminders

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(s). 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.