Computer Science 217
Assignment #2

John Aycock

Due: 4pm Friday, 17 February 2012



Purpose

To input and visualize data; to use conditional statements; to translate a calculation into code.

Important Notes

Assignment

Write a program that reads a temperature data file from the standard input and plots its data using the turtle. The plot you'll be making is a simple heat map showing what days in the month had zero/above-zero temperatures (red), and which days had below-zero temperatures (blue).

Your program will be run by typing

python3 as2.py < datafile
which will make standard input become the data file instead of the keyboard as it was in the last lab assignment. Important: if you use a greater than sign by mistake, your data file will be erased.

Data files and example plots, all from measurements at the Calgary International Airport:

November 2010 Plot
December 2010 Plot
November 2011 Plot
December 2011 Plot

Your TA will be testing your programs using these files as well as others you have not seen. Additional test files the TAs use will conform to the data file format given, however.

Data File Format

The file format used for temperature data is as follows:

  1. The first line is the month in human-readable format.
  2. The second line is the month's number (1-12).
  3. The third line is the year.
  4. The fourth line is the number of temperatures that follow.
  5. Fifth and later lines are the temperatures.

You may assume that there is one temperature reading in the file for each day in the given month.

Hints

Assignment Submission

To hand the assignment in, send one email to your TA containing:

You are responsible for getting your assignment to your TA on time; keep in mind that email can take a few minutes to deliver! To be safe, you should CC yourself a copy of the email too.

Evaluation

You cannot be given a grade above zero if:

Your assignment will be given a grade as follows:

Acknowledgments

The temperature data is from the ``historical weather'' area of the Environment Canada website, i.e., the National Climate Data and Information Archive, and is used under the terms of non-commercial reproduction. Per those terms, I must state that the data are a `copy of an official work that is published by the Government of Canada and that the reproduction has not been produced in affiliation with or with the endorsement of the Government of Canada.'



John Aycock 2012-01-25