traffic/algorithms/navigation.py
def runway_change(
        self,
        airport: Union[str, "Airport", None] = None,
        dataset: Optional["Airports"] = None,
    ) -> Iterator["Flight"]:
        """Detects runway changes.

        The method yields pieces of trajectories with exactly two runway
        alignments on the same airport not separated by a climbing phase.

        In each piece of yielded trajectory, the `ILS` column contains the
        name of the runway targetted by the aircraft at each instant.
        """

        # The following cast secures the typing
        self = cast("Flight", self)

        if airport is None:
            if dataset is None:
                airport = self.landing_airport()
            else:
                airport = self.landing_airport(dataset=dataset)

        if airport is None:
            return None

        aligned = iter(self.aligned_on_ils(airport))
        first = next(aligned, None)
        if first is None:
            return

        for second in aligned:
            candidate = self.between(first.start, second.stop)
            assert candidate is not None
            candidate = candidate.assign(ILS=None)
            if candidate.phases().query('phase == "CLIMB"') is None:
                candidate.data.loc[
                    candidate.data.timestamp <= first.stop, "ILS"
                ] = first.max("ILS")
                candidate.data.loc[
                    candidate.data.timestamp >= second.start, "ILS"
                ] = second.max("ILS")

                yield candidate.assign(
                    airport=airport
                    if isinstance(airport, str)
                    else airport.icao
                )

            first = second
Detects runway changes.

        The method yields pieces of trajectories with exactly two runway
        alignments on the same airport not separated by a climbing phase.

        In each piece of yielded trajectory, the `ILS` column contains the
        name of the runway targetted by the aircraft at each instant.
        
Detects runway changes.
The method yields pieces of trajectories with exactly two runway
alignments on the same airport not separated by a climbing phase.

In each piece of yielded trajectory, the `ILS` column contains the
name of the runway targetted by the aircraft at each instant.
Detects runway changes . The method yields pieces of trajectories with exactly two runway alignments on the same airport not separated by a climbing phase . In each piece of yielded trajectory the ` ILS ` column contains the name of the runway targetted by the aircraft at each instant .
def runway_change(
        self,
        airport: Union[str, "Airport", None] = None,
        dataset: Optional["Airports"] = None,
    ) -> Iterator["Flight"]:
        self = cast("Flight", self)
        if airport is None:
            if dataset is None:
                airport = self.landing_airport()
            else:
                airport = self.landing_airport(dataset=dataset)
        if airport is None:
            return None
        aligned = iter(self.aligned_on_ils(airport))
        first = next(aligned, None)
        if first is None:
            return
        for second in aligned:
            candidate = self.between(first.start, second.stop)
            assert candidate is not None
            candidate = candidate.assign(ILS=None)
            if candidate.phases().query('phase == "CLIMB"') is None:
                candidate.data.loc[
                    candidate.data.timestamp <= first.stop, "ILS"
                ] = first.max("ILS")
                candidate.data.loc[
                    candidate.data.timestamp >= second.start, "ILS"
                ] = second.max("ILS")
                yield candidate.assign(
                    airport=airport
                    if isinstance(airport, str)
                    else airport.icao
                )
            first = second
def runway_change ( self , airport : Union [ str , "Airport" , None ] = None , dataset : Optional [ "Airports" ] = None , ) -> Iterator [ "Flight" ] : self = cast ( "Flight" , self ) if airport is None : if dataset is None : airport = self . landing_airport ( ) else : airport = self . landing_airport ( dataset = dataset ) if airport is None : return None aligned = iter ( self . aligned_on_ils ( airport ) ) first = next ( aligned , None ) if first is None : return for second in aligned : candidate = self . between ( first . start , second . stop ) assert candidate is not None candidate = candidate . assign ( ILS = None ) if candidate . phases ( ) . query ( 'phase == "CLIMB"' ) is None : candidate . data . loc [ candidate . data . timestamp <= first . stop , "ILS" ] = first . max ( "ILS" ) candidate . data . loc [ candidate . data . timestamp >= second . start , "ILS" ] = second . max ( "ILS" ) yield candidate . assign ( airport = airport if isinstance ( airport , str ) else airport . icao ) first = second
Detects runway changes.
Detects runway changes .
"""Detects runway changes.

        The method yields pieces of trajectories with exactly two runway
        alignments on the same airport not separated by a climbing phase.

        In each piece of yielded trajectory, the `ILS` column contains the
        name of the runway targetted by the aircraft at each instant.
        """ # The following cast secures the typing
self
airport
Union[str, "Airport", None]
dataset
Optional["Airports"]