traffic.algorithms.ground
Airport graphs
- class traffic.algorithms.ground.graphs.AirportGraph(graph, projection)
Create a graph from an airport.
- buffer_meter(shape, buffer=18)
Add a buffer around the geometric shape.
Useful to simulate for the width of taxiways. The buffer parameter is in meters.
- Return type:
BaseGeometry
- fix_airport_graph()
Builds an airport graph based on available information. :rtype:
Self
merge duplicate nodes
for each edge, detect every node that is geographically on the segment (linestring) and split the edge into two.
The resulting graph should be (at least very close to) a single connected component graph.
- intersection_with_flight(flight)
Compute the intersection of a flight trajectory with all edges of the airport graph.
- Return type:
DataFrame
- make_parts(flight)
Make a table with statistics of the trajectory along the highlighted segments.
- Return type:
DataFrame
- map_flight(g)
Get the most probable path along edges with a pathfinding algorithm.
Returns segment one after the other.
- marker_edge(data, **kwargs)
Visualisation function to include edges on a Leaflet widget.
- Return type:
- merge_duplicate_nodes()
Relabel the graph to deal with nodes with identical coordinates.
This function helps rebuilding a topologically correct graph based on OpenStreetMap data.
Among the issues with raw OpenStreetMap data, we are bothered by few nodes which have a different id but the same coordinates.
- Return type:
Self
- snap_and_split(graph, u, v, k, tolerance)
Recursive companion function to split edges when an extra node is located on another edge, without being topologically connected. :rtype:
None
u, v are the indices of the nodes
k is the key (because of the MultiGraph)
- tolerance (in m) allows snapping points that do not fall exactly on a
segment
- split_line_based_on_point(line, splitter)
Split a LineString with a Point
- Return type:
Kalman Filter with taxiway constraints
- class traffic.algorithms.ground.kalman_taxiway.KalmanTaxiway(airport, projection, closest=None, option='xs')
A Kalman filter that adds a contraint to snap a trajectory to documented taxiways of an airport.
- Parameters:
airport (
str
) – The airport ICAO code to be considered.projection (
Projection
) – A local projection used to compute x and y.
Movement detection
- class traffic.algorithms.ground.movement.StartMoving(speed_threshold=2, time_threshold='30s', filter_dict={'compute_gs': 3}, resample_rule='5s')
Returns the part of the trajectory after the aircraft starts moving.
Warning
This method has been extensively tested on aircraft taxiing before take-off. It should be adapted/taken with extra care for trajectories after landing.
- traffic.algorithms.ground.movement.mrr_diagonal(geom)
Returns the length of the diagonal of the minimum rotated rectangle around a given shape.
Consider using a
project_shape()
method before applying this method if you need a distance in meters.- Return type:
Parking-position detection
- class traffic.algorithms.ground.parking_position.ParkingPositionGeometricIntersection(airport, buffer_size=1e-05, parking_positions=None)
Generates possible parking positions at a given airport.
- Parameters:
The algorithm looks at the intersection between the trajectory and a buffered version of the parking positions.
As a noisy trajectory may intersect several parking positions, it is recommended to use the max() method to select the trajectory segment with the longest duration.
Example usage:
>>> from traffic.data.samples import elal747 >>> parking = elal747.parking_position('LIRF').max() >>> parking.duration Timedelta('0 days 00:05:20') >>> parking.parking_position_max '702'
Warning
This method has been well tested for aircraft taking off, but should be double checked for landing trajectories.
Pushback detection
- class traffic.algorithms.ground.pushback.ParkingAreaBasedPushback(airport, stand_areas=None)
Returns the pushback part of the trajectory on ground.
The method identifies the start of the movement, an intersection with a documented apron area and the moment the aircraft suddenly changes direction in the computed track angle.
- Parameters:
>>> from traffic.data.samples import zurich_airport >>> flight = zurich_airport["AEE5ZH"] >>> pushback = flight.pushback('LSZH', method="parking_area") >>> pushback.duration Timedelta('0 days 00:04:26')
Warning
The method has poor performance when trajectory point on ground are lacking. This is often the case for data recorded from locations far from the airport.
- class traffic.algorithms.ground.pushback.ParkingPositionBasedPushback(airport, filter_dict={'compute_gs': 21, 'compute_track': 21, 'compute_track_unwrapped': 21}, track_threshold=90, parking_positions=None)
Returns the pushback part of the trajectory on ground.
The method identifies the start of the movement, the parking_position and the moment the aircraft suddenly changes direction in the computed track angle.
- Parameters:
>>> from traffic.data.samples import zurich_airport >>> flight = zurich_airport["AEE5ZH"] >>> pushback = flight.pushback('LSZH', method="parking_position") >>> pushback.duration Timedelta('0 days 00:01:45')
Warning
The method has poor performance when trajectory point on ground are lacking. This is often the case for data recorded from locations far from the airport.
Runway detection
- class traffic.algorithms.ground.runway.RunwayAlignment(airport)
Iterates on all segments of trajectory matching a runway of the given airport.
Example usage:
>>> from traffic.data.samples import belevingsvlucht
Count the number of segments aligned with a runway (take-off or landing):
>>> sum(1 for _ in belevingsvlucht.aligned("EHAM", method="runway")) 2
Get timestamps associated with the first segment matching a runway:
>>> segment = belevingsvlucht.next("aligned('EHAM', method='runway')") >>> f"{segment.start:%H:%M %Z}, {segment.stop:%H:%M %Z}" '20:17 UTC, 20:18 UTC'
Get the minimum altitude for the aircraft landing:
>>> segment.mean('altitude') # Schiphol below the sea level -26.0