gedai.utils package

gedai.utils.legs

Functions to identify and split by legs.

gedai.utils.legs.identify_legs(obj: DataFrame, soure: str) DataFrame[source]
gedai.utils.legs.identify_legs(obj: Flight, source: str) Flight

Applies leg identification to the input DataFrame or Flight object, modifying it in place. The function adds a new column “leg” with integers denoting the corresponding leg.

Parameters:
  • obj (Union[pd.DataFrame, Flight]) – ADS-B data

  • source (str) – ADS-B source (e.g., “adsb_exchange”).

Returns:

Same type as input, with added ‘leg’ column.

Return type:

Union[pd.DataFrame, Flight]

Raises:

ValueError – If unknown source is provided.

gedai.utils.legs.leg_split_condition(f1: Flight, f2: Flight) bool[source]

Condition for the .split() method of traffic’s Flight object.

Parameters:
  • f1 (Flight) – Flight 1

  • f2 (Flight) – Flight 2

Raises:

ValueError – If the column “leg” is not found.

Returns:

Where to split the data.

Return type:

bool

gedai.utils.legs.split_by_leg(flight: Flight, source: str = 'custom') FlightIterator[source]

Split Flight by the leg number using the flight_iterator decorator.

Parameters:
  • flight (Flight) – Flight to be split

  • source (str) – ADS-B source (e.g., “adsb_exchange”). Defaults to “custom”.

Yields:

Flight – Flight split by the leg.