Homework 2

advertisement
Homework 2
Due May 29, 2015
Submissions are due by 11:59PM on the specified due date. Submissions may be made
on the Blackboard course site under the Assignments tab. Late submissions will be accepted
up to two days late with a 10% penalty for each day.
Make sure your name and FSUID are in a docstring at the top of the file. All submissions
must obtain a minimum Pylint score of 9.0/10. In this assignment, you may only use the
sys, strings, and time packages (although you do not necessarily need any of these).
Your task is to create a module called weather analyzer. The weather analyzer module works
by prompting the user for the name of a comma-separated-value (.csv) file which contains
some weather data for a variable period of time. Each day is recorded on a separate line.
The known attributes are:
• TMAX: Maximum temperature in 1/10 of a degree Celsius for a given day.
• TMIN: Minimum temperature in 1/10 of a degree Celsius for a given day.
• AWND: Average daily wind speed in 1/10 meters per second for a given day.
• PRCP: Precipitation in 1/10 of a millimeter for a given day.
• DATE: Format is YYYYMMDD.
The position of the attributes is not known beforehand - some files may contain additional
attributes. You will have to determine the position of the attributes in the file using the first
line. Your module must prompt the user for the csv file which contains the weather data
and output a couple of statements about the file. These statements include:
• The maximum temperature reading over the time period in degrees Fahrenheit (up to
two decimal places) and the day it occurred.
• The minimum difference between the maximum and minimum temperature taken (in
degrees Fahrenheit) on a specific day and the day it occurred.
• The average wind speed in meters per second over the time period.
• The total precipitation amount over the time period in millimeters.
If there are, for example, multiple days that reach the maximum temperature, take the
earliest date. For example, let’s say I have a sample file called tallahassee weather.csv. It
contains some sample data gathered over a period of two months.
$ python weather_analyzer.py
File to be analyzed (.csv only): tallahassee_weather.csv
Maximum temperature (F): 80.96 on 11/12/2014
Minimum temperature difference (F): 2.88 on 12/21/2014
Average wind speed (m/s): 2.32
Total precipitation (mm): 441.4
1
Download