traffic.algorithms.metadata
This module is about the inference of common metadata that is usually accessible on closed sources of information, but lacking in ADS-B data.
Classes here provide information about origin and destination airports, runways, possible diversions and emergency situations.
Airport detection
- class traffic.algorithms.metadata.airports.AirportInferenceBase(*args, **kwargs)
- class traffic.algorithms.metadata.airports.LandingAirportInference(dataset=None, warning_distance=None)
Returns the most probable landing airport based on the last location in the trajectory.
>>> from traffic.data.samples import belevingsvlucht >>> belevingsvlucht.infer_airport("landing") Airport(icao='EHAM', iata='AMS', name='Amsterdam Airport Schiphol', ...)
When data is missing near the ground, it may be relevant to specify a subset of airports as a keyword parameter.
>>> missing_data = belevingsvlucht.before("2018-05-30 20:00") >>> missing_data.infer_airport("landing") Airport(icao='NL-0092', name='De Kreupel Helipad', ...)
>>> from traffic.data import airports >>> large_airports = airports.query("type == 'large_airport'") >>> missing_data.infer_airport("landing", dataset=large_airports) Airport(icao='EHAM', iata='AMS', name='Amsterdam Airport Schiphol', ...)
- class traffic.algorithms.metadata.airports.TakeoffAirportInference(dataset=None, warning_distance=None)
Returns the most probable takeoff airport based on the first location in the trajectory.
>>> from traffic.data.samples import belevingsvlucht >>> belevingsvlucht.infer_airport("takeoff") Airport(icao='EHAM', iata='AMS', name='Amsterdam Airport Schiphol', ...)
When data is missing near the ground, it may be relevant to specify a subset of airports as a keyword parameter.
>>> missing_data = belevingsvlucht.after("2018-05-30 15:30") >>> missing_data.infer_airport("takeoff") Airport(icao='NL-0114', name='Netherlands Traffic Center Heliport', ...)
>>> from traffic.data import airports >>> large_airports = airports.query("type == 'large_airport'") >>> missing_data.infer_airport("takeoff", dataset=large_airports) Airport(icao='EHAM', iata='AMS', name='Amsterdam Airport Schiphol', ...)
Flight plan inference
- class traffic.algorithms.metadata.flightplan.FlightPlanBase(*args, **kwargs)
- class traffic.algorithms.metadata.flightplan.FlightPlanInference(navaids=None, buffer=0.1)
This functions recomputes the most probable alignments on navigational points on the trajectory.
- Parameters:
navaid –
By default, all navaids of the default database are considered, but limited to a buffered bounding box around the trajectory.
It should be good practice to limit the size of the navaid dataset: the smaller the data, the faster the computation will be.
>>> from traffic.data import navaids >>> from traffic.data.samples import savan >>> flight = savan["SAVAN01"] >>> vor = navaids.query("type == 'VOR'") >>> df = flight.infer_flightplan(vor) >>> for _, line in df.iterrows(): ... print(f"aligned on {line.navaid} ({line.type}) for {line.duration}") aligned on CFA (VOR) for 0 days 00:21:19 aligned on POI (VOR) for 0 days 00:15:42 aligned on CAN (VOR) for 0 days 00:14:38 aligned on DPE (VOR) for 0 days 00:16:19 aligned on CHW (VOR) for 0 days 00:15:45 aligned on BRY (VOR) for 0 days 00:19:27
For more insights about this example: Calibration flights with SAVAN trajectories
Once computed, the following Altair snippet may be useful to display the trajectory as a succession of segments:
import altair as alt segments = ( alt.Chart(df.drop(columns="duration")).encode( alt.X("start", title=None), alt.X2("stop"), alt.Y("navaid", sort="x", title=None), alt.Color("type", title="Navigational point"), alt.Tooltip(["navaid", "distance", "shift_mean"]), ) .mark_bar(size=10) .configure_legend( orient="bottom", labelFontSize=14, titleFontSize=14, labelFont="Ubuntu" ) .configure_axis(labelFontSize=14, labelFont="Ubuntu") )