Python scripts 1 to 6

In this assignment, you will analyze weather data. You can find the data in the file that is attached to this assignment. You need to write a program (in Perl or Python) that will implement the following tasks:

1.      Filter the attached file by keeping the following columns only: STATION, NAME/LOCATION, DATE, AWND, SNOW. Name the new file filteredData.csv. Make sure the columns are separated by a delimiter preferably a tab (i.e. \t) in the .csv file for this task and the following ones. 

2.      For each NAME/LOCATION, calculate the average snow amount per month. Save the results in two separate .csv files (one for 2016 and the other for 2017) name the files average2016.csv and average2017.csv. Those files will have the following fields  NAME/LOCATION, Month,  and average snow amount per month.

3.      For each NAME/LOCATION, calculate the total/sum snow amount per month. Save the results in two separate .csv files (one for 2016 and the other for 2017) name the files total2016.csv and total2017.csv.  Those files will have the following fields  NAME/LOCATION, Month,  and total snow amount per month. 

4.      Sort the data in the files average2016.csv  and average2017.csv (sort the column average snow amount per month). Store only the top 3 locations from each file. The top 3 locations data will be stored in one file, name it top3.csv. Each column in the top3.csv file will store the results of each year. Thus, the top3.csv file will have the columns 2016 and 2017.

5.      From the 2 year data, find the top 10 readings/rows of AWND. Store the result in a .csv file and name it top10AWND.csv. The new file will have all columns from filteredData.csv, but only the top 10 AWND.

6.      Print the first row of the files top3.csv and top10AWND.csv

 

Submit:

·        The code

·        The design and test document file

·        All .csv files required in the above tasks

Make sure you zip your submission. Do not upload individual files.

Note, the weather data were downloaded from the National Centers for Environmental Information (NOAA)

 

 
Powered by