This is a group project. You should work in groups of 2 to 4 (not alone and not more than 4). If this is a problem, please let me know ahead of time.
- Mireya Smith
- Richard Lobo
- Norman Andino
It is my hope that is can be turned in on Friday, May 22nd, but I will take it until May 26th at the latest.
I have provided a dataset that you will use for this. The dataset and it's description are on the cluster as well as in github.
- The dataset is at:
/ufrc/bsc4452/share/Class_Files/data/flights.May2017-Apr2018.csv - The metadata (description of the data) is at:
/ufrc/bsc4452/share/Class_Files/data/flights_metadata.md- It is also nicely rendered on github.
The goal of this project is to write a Bash script that does the following:
- Counts the number of flights that were delayed more than 15 minutes into or out of Gainesville, FL (airport code GNV) during the timeframe covered by the dataset. (2 points)
Grading: 2pts
grep GNV /ufrc/bsc4452/share/Class_Files/data/flights.May2017-Apr2018.csv >> ./GNV.flights
grep -E '\s\w\w\"\,\"\w{2}\",\"[[:digit:]]*\",[[:digit:]]*\.[[:digit:]]*,1' GNV.flights | wc -l
Result: 803 delayed flights
- Produce a table (text is fine) with the data to fill in this table (13 points):
| GNV to: | Total flights | Total flights delayed (>15min) | Total flights delayed due to Weather |
|---|---|---|---|
| ATL | 1476 | 262 | 15 |
| CLT | 476 | 107 | 3 |
| MIA | 205 | 30 | 0 |
Total
grep -E 'GNV\"\,\"Gainesville, FL\"\,\"FL\"\,\"ATL' GNV.flights >> GNVtoATL
wc –l GNVtoATL
1476 flight
Delayed 15 min
grep -E 'GNV\"\,\"Gainesville, FL\"\,\"FL\"\,\"ATL\"\,\"Atlanta\, GA\"\,\"GA\"\,\"[[:digit:]]*\",[[:digit:]]*\.[[:digit:]]*\,1' GNV.flights | wc –l
262 flight
Delayed by wether
awk -F, '{print $24}' GNVtoATL | sort
15 flights
Total
grep -E 'GNV\"\,\"Gainesville, FL\"\,\"FL\"\,\"CLT' GNV.flights >> GNVtoCLT
wc –l GNVtoCLT
476 flight
Delayed 15 min
grep -E 'GNV\"\,\"Gainesville, FL\"\,\"FL\"\,\"CLT\"\,\"Charlotte\, NC\"\,\"NC\"\,\"[[:digit:]]*\",[[:digit:]]*\.[[:digit:]]*\,1' GNV.flights | wc –l
107 flight
Delayed by wether
awk -F, '{print $24}' GNVtoATL | sort
3 flights
Total
grep -E 'GNV\"\,\"Gainesville, FL\"\,\"FL\"\,\"MIA' GNV.flights >> GNVtoMIA
wc –l GNVtoMIA
205 flight
Delayed 15 min
grep -E 'GNV\"\,\"Gainesville, FL\"\,\"FL\"\,\"MIA\"\,\"Miami\, FL\"\,\"FL\"\,\"[[:digit:]]*\",[[:digit:]]*\.[[:digit:]]*\,1' GNV.flights | wc –l
30 flight
Delayed by wether
awk -F, '{print $24}' GNVtoATL | sort
0 flights
- Within a function, print a list of all unique airport codes contained in the dataset. (3 points)
Grading: 3pts. Not a function, but taking off for that in q2.
awk -F',' '{print $7}' /ufrc/bsc4452/share/Class_Files/data/flights.May2017-Apr2018.csv >> ./test1/airport.code2
sort test1/airport.code2 | uniq >> uniq.airport.code2
wc -l uniq.airport.code2
grep -v '\"DEST_CITY_NAME\"' test1/uniq.airport.code | wc -l
Total of 350 airports
- Within a function list the cities in Florida that have airports in the dataset. (2 points)
Grading: 2pts.
awk -F',' '{print $3,$4,$5}' /ufrc/bsc4452/share/Class_Files/data/flights.May2017-Apr2018.csv >> test1/question4
grep 'FL\"$' test1/question4 | sort | uniq | wc –l
20 cities
"DAB" "Daytona Beach FL"
"ECP" "Panama City FL"
"EYW" "Key West FL"
"FLL" "Fort Lauderdale FL"
"GNV" "Gainesville FL"
"JAX" "Jacksonville FL"
"MCO" "Orlando FL"
"MIA" "Miami FL"
"MLB" "Melbourne FL"
"PBI" "West Palm Beach/Palm Beach FL"
"PGD" "Punta Gorda FL"
"PIE" "St. Petersburg FL"
"PNS" "Pensacola FL"
"RSW" "Fort Myers FL"
"SFB" "Sanford FL"
"SRQ" "Sarasota/Bradenton FL"
"TLH" "Tallahassee FL"
"TPA" "Tampa FL"
Bonus question: Asks for user input (see chapter 28) to enter either a airport code or city, state name and then calculates the number of flights as in question 1. (5 points extra credit)
You should submit your answer as one or more scripts in a git repository. Submit the link in Canvas.
You should start in Canvas, creating your group and then create the same group in github.
Be sure to edit this README.md file with the names of the group members.
For questions, 1, 3 and 4, I will mostly be looking for the right answer.
Your score on 1,3,4 (I'll fill this in when I grade):
For question 2, you will receive points for:
| Rubric item | Points | Your score |
|---|---|---|
| Using github | 1 point | 1 |
| Having at least one commit from each member of the team | 2 points | 2--don't see any commits from Mireya, but Ok. |
| Using meaningful commit messages | 2 points | 2--In the future, have more than "update X", what was changed?? |
| Using functions correctly | 2 points | 0--no functions |
| Using comments in code | 2 points | 2--no comments, but fairly clear |
| Using spacing to make code readable | 2 points | 2--make better use of spacing |
| Getting the correct answer | 2 points | 2 |
| Total for question 2 | 13 | 11 |
| Extra credit: | ||
| No extra credit |
Total points: 18/20