Uploaded by Tayyaba Arif

SL Asg3 F20

advertisement
COMSATS University Islamabad, Attock Campus
Department of Computer Science
Program: BSE
Assignment 3
Course: - Scripting Languages
Deadline: Nov 30, 2020
Marks: 10
In this assignment, you may only use the sys, strings, and time packages (although you do not
necessarily need any of these).
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 us say I have a sample file called weather.csv. It contains some sample data
gathered over a period of two months.
$ python weather_analyzer.py
File to be analyzed (.csv only): weather.csv
Maximum temperature (F): 80.96 on 11/12/2020
Minimum temperature difference (F): 2.88 on 12/28/2020
Average wind speed (m/s): 2.32
Total precipitation (mm): 441.4
Download