How to access flight plan information?
A FlightPlan
is a structure designed to parse
flight plans in the ICAO format. Access to such field may be complicated for non
operational fellows, who may have access to different sources of data.
EUROCONTROL DDR SO6 files
- class traffic.data.eurocontrol.ddr.so6.SO6(data, *args, **kwargs)
Bases:
DataFrameMixin
Eurocontrol DDR files provide flight intentions of aircraft for a full day of traffic across Europe. This data cannot be shared so the file included in the repository has actually been generated from OpenSky ADS-B data to match so6 format.
SO6 represent a collection of trajectories, the bracket notation yields a Flight structure adapted to the specificities of the SO6 format.
from traffic.data import SO6 so6 = SO6.from_file("./data/sample_m3.so6.7z") so6.to_pickle("./data/sample_m3.pkl")
If you are going to work a lot with data for one day, it is recommended to serialize the data so that it loads faster. The structure holds a DataFrame in the data attribute.
You can then access data from the so6 file, by flight, with the bracket notation. Interactive environments (IPython, Jupyter notebooks) provide completion on the flight names.
Callsigns may not be enough to discriminate flights because of same callsigns assigned to a trip with many legs. In general, you can access a Flight from its unique ID or from its callsign
Flight HOP36PP (332206265)so6[332206265] # here equivalent to: so6['HOP36PP']
- aircraft: A319
- origin: LFML (2018-01-01 18:15:40+00:00)
- destination: LFBD (2018-01-01 18:58:00+00:00)
- at(time)
Selects all segments of the SO6 dataframe with
time
included in the segment interval.- Return type:
- between(start, stop)
Selects all segments of the SO6 dataframe with intervals intersecting [
start
,stop
].The
stop
argument may be also be written as adatetime.timedelta
.- Return type:
- classmethod from_file(filename, **kwargs)
In addition to usual formats, you can parse so6 files as text files (.so6 extension) or as 7-zipped text files (.so6.7z extension). :rtype:
Optional
[TypeVar
(SO6TypeVar
, bound= SO6)]Warning
You will need the libarchive library to be able to parse .so6.7z files on the fly.
- inside_bbox(bounds)
Selects all Flights intersecting the bounding box of the given airspace.
A tuple (west, south, east, north) is also accepted as a parameter.
>>> bdx_so6 = so6.inside_bbox(nm_airspaces["LFBBBDX"]) >>> f"before: {len(so6)} flights, after: {len(bdx_so6)} flights" before: 11043 flights, after: 1548 flights
- Return type:
- intersects(sector)
Selects all Flights intersecting the given airspace. :rtype:
SO6
Tip
See the impact of calling .inside_bbox(sector) to the bounding box before intersecting the airspace. Note that this chaining may not be safe for smaller airspaces.
noon = so6.at("2018/01/01 12:00")
%%time bdx_flights = noon.intersects(nm_airspaces['LFBBBDX']) CPU times: user 3.9 s, sys: 0 ns, total: 3.9 s Wall time: 3.9 s
%%time bdx_flights = ( noon .inside_bbox(nm_airspaces["LFBBBDX"]) .intersects(nm_airspaces["LFBBBDX"]) ) CPU times: user 1.42 s, sys: 8.27 ms, total: 1.43 s Wall time: 1.43 s
- class traffic.data.eurocontrol.ddr.so6.SO6Flight(data)
Bases:
Flight
SO6 Flight inherit from traffic.core.Flight and implement specificities of the SO6 format.
so6['HOP36PP'].data.drop( columns=['alt1', 'alt2', 'aircraft', 'callsign', 'flight_id'] )
origin destination lat1 lon1 lat2 lon2 time1 time2 65794 LFML LFBD 43.608398 4.527325 44.543555 1.178150 2018-01-01 18:15:40+00:00 2018-01-01 18:44:50+00:00 65795 LFML LFBD 44.543555 1.178150 44.726898 0.460837 2018-01-01 18:44:50+00:00 2018-01-01 18:52:10+00:00 65796 LFML LFBD 44.726898 0.460837 44.751343 -0.091422 2018-01-01 18:52:10+00:00 2018-01-01 18:58:00+00:00 - at(time=None)
Since DDR files contain few points on their trajectory, interpolation functions are provided:
>>> so6['HOP36PP'].at("2018/01/01 18:40") longitude 1.733156 latitude 44.388586 altitude 26638.857143 dtype: float64
- Return type:
Position
- between(start, stop, strict=True)
Danger
strict: bool = True is not taken into account yet.
- Return type:
- clip(shape, strict=True)
Clips the trajectory to a given shape.
For a shapely Geometry, the first time of entry and the last time of exit are first computed before returning the part of the trajectory between the two timestamps.
Most of the time, aircraft do not repeatedly come out and in an airspace, but computation errors may sometimes give this impression. As a consequence, the clipped trajectory may have points outside the shape. :rtype:
Optional
[SO6Flight
]Warning
Altitudes are not taken into account.
- clip_altitude(min_, max_)
Splits a Flight in several segments comprised between altitudes min_ and max_, with proper interpolations where needed.
EUROCONTROL B2B web services
The NM B2B web services is an interface provided by the EUROCONTROL Network Manager (NM) for system-to-system access to its services and data, allowing users to retrieve and use the information in their own systems.
Danger
This code has been moved out of the traffic library. You may install pyb2b <https://github.com/xoolive/pyb2b> for the same functionalities.