Airplane Route Histogram


Please refer to the sight Open Flights. This gives us the databases for both airline locations and airline route details.
Please download the files airplane.dat and routes.dat from the source
http://www.openflights.org/data.html

We have 2 files airplane.dat and routes.dat. Latter file stores every unique flight route that open flights know. With the help of the source data our aim is to calculate how far each route travels and then plot a histogram for the same. There are 3 tasks:

1)      First task is to map the unique id to the geographical coordinates. Hence we can look up the location of each airport by the id.

2)      Through the latter source file routes.dat we would get the id of the source and destination airport . Based on the latitudes and longitudes we would be able to know the length of the route and append it to the list of all route length

3)      Plot a histogram based on the route lengths to show the distribution of different flight distances.

Task 1:List of latitudes and longitudes

The code below helps in reading the data "airports.dat" and we create a dictionary mapping from the airport id key to  geographical coordinates. Float() would convert the string value to floating number



 





Task 2: Code and output:

Since now we have latitudes and longitudes we can calculate the distance of each route. We would import the function geo_distance to calculate the geographic distance





Task 3: Code and Output: Finally we are creating a histogram which displays the frequency of flights by distance




Here 100 refers to the number of bins the histogram is divided into and facecolour refers to the colour of the graph as red .

 

Comments

Popular posts from this blog

Kabaddi Match: Lets meet at the arena!! Aa jao Dam Dikhane!!!

Apache Pig : A tutorial to learn a small exercise on how to run a pig program Big Data Assignment Part 2 for Praxis Business School

Text Analytics Using R - Part A: Extraction of reviews of galaxy s4 product reviews in flipkart