OpenSky flight trajectories¶
NOTE: This dataset is also explorable through the Datashader example dashboard. From inside the examples directory, run:
DS_DATASET=opensky panel serve --show dashboard.ipynb
We'll only use some of the fields provided by OpenSky, out of: icao24, callsign, origin, time_position, time_velocity, longitude, latitude, altitude, on_ground, velocity, heading, vertical_rate, sensors, timestamp
Here, we'll load the data and declare that some fields are categorical (which isn't information fully expressed in the Parquet file):
%%time import pandas as pd flightpaths = pd.read_parquet('./data/opensky.parq') flightpaths['origin'] = flightpaths.origin.astype('category') flightpaths['ascending'] = flightpaths.ascending.astype('category') flightpaths.tail()
CPU times: user 1.34 s, sys: 547 ms, total: 1.89 s Wall time: 1.88 s
The default database has about 10 million points, with some metadata for each.
Now let's define a datashader-based processing pipeline to render images:
import datashader as ds import datashader.transfer_functions as tf from colorcet import fire import numpy as np plot_width = 850 plot_height = 600 x_range = (-2.0e6, 2.5e6) y_range = (4.1e6, 7.8e6)
We can use this function to get a dump of all of the trajectory information:
cvs = ds.Canvas(plot_width, plot_height, x_range, y_range) %time agg = cvs.line(flightpaths, 'longitude', 'latitude', ds.count()) tf.set_background(tf.shade(agg, cmap=fire), 'black')
CPU times: user 2.28 s, sys: 80.6 ms, total: 2.36 s Wall time: 2.36 s
This plot shows all of the trajectories in this database, overlaid in a way that avoids overplotting. With this "fire" color map, a single trajectory shows up as black, while increasing levels of overlap show up as brighter colors.
A static image on its own like this is difficult to interpret, but if we overlay it on a map we can see where these flights originate, and can zoom in to see detail in specific regions:
import holoviews as hv from holoviews import opts from holoviews.operation import datashader as hd hv.extension('bokeh', 'matplotlib')