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

        The method yields pieces of trajectories with exactly two landing
        attempts (aligned on one runway) on the same airport separated by
        exactly one climbing phase.
        """

        # 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

        first_attempt = next(self.aligned_on_ils(airport), None)

        while first_attempt is not None:
            after_first_attempt = self.after(first_attempt.start)
            assert after_first_attempt is not None

            climb = after_first_attempt.phases().query('phase == "CLIMB"')
            if climb is None:
                return

            after_climb = self.after(next(climb.split("10T")).stop)
            if after_climb is None:
                return

            next_attempt = next(after_climb.aligned_on_ils(airport), None)

            if next_attempt is not None:
                goaround = self.between(first_attempt.start, next_attempt.stop)
                assert goaround is not None

                goaround = goaround.assign(
                    ILS=None,
                    airport=airport
                    if isinstance(airport, str)
                    else airport.icao,
                )
                goaround.data.loc[
                    goaround.data.timestamp <= first_attempt.stop, "ILS"
                ] = first_attempt.max("ILS")
                goaround.data.loc[
                    goaround.data.timestamp >= next_attempt.start, "ILS"
                ] = next_attempt.max("ILS")
                yield goaround

            first_attempt = next_attempt
Detects go-arounds.

        The method yields pieces of trajectories with exactly two landing
        attempts (aligned on one runway) on the same airport separated by
        exactly one climbing phase.
        
Detects go-arounds.
The method yields pieces of trajectories with exactly two landing
attempts (aligned on one runway) on the same airport separated by
exactly one climbing phase.
Detects go - arounds . The method yields pieces of trajectories with exactly two landing attempts ( aligned on one runway ) on the same airport separated by exactly one climbing phase .
def go_around(
        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
        first_attempt = next(self.aligned_on_ils(airport), None)
        while first_attempt is not None:
            after_first_attempt = self.after(first_attempt.start)
            assert after_first_attempt is not None
            climb = after_first_attempt.phases().query('phase == "CLIMB"')
            if climb is None:
                return
            after_climb = self.after(next(climb.split("10T")).stop)
            if after_climb is None:
                return
            next_attempt = next(after_climb.aligned_on_ils(airport), None)
            if next_attempt is not None:
                goaround = self.between(first_attempt.start, next_attempt.stop)
                assert goaround is not None
                goaround = goaround.assign(
                    ILS=None,
                    airport=airport
                    if isinstance(airport, str)
                    else airport.icao,
                )
                goaround.data.loc[
                    goaround.data.timestamp <= first_attempt.stop, "ILS"
                ] = first_attempt.max("ILS")
                goaround.data.loc[
                    goaround.data.timestamp >= next_attempt.start, "ILS"
                ] = next_attempt.max("ILS")
                yield goaround
            first_attempt = next_attempt
def go_around ( 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 first_attempt = next ( self . aligned_on_ils ( airport ) , None ) while first_attempt is not None : after_first_attempt = self . after ( first_attempt . start ) assert after_first_attempt is not None climb = after_first_attempt . phases ( ) . query ( 'phase == "CLIMB"' ) if climb is None : return after_climb = self . after ( next ( climb . split ( "10T" ) ) . stop ) if after_climb is None : return next_attempt = next ( after_climb . aligned_on_ils ( airport ) , None ) if next_attempt is not None : goaround = self . between ( first_attempt . start , next_attempt . stop ) assert goaround is not None goaround = goaround . assign ( ILS = None , airport = airport if isinstance ( airport , str ) else airport . icao , ) goaround . data . loc [ goaround . data . timestamp <= first_attempt . stop , "ILS" ] = first_attempt . max ( "ILS" ) goaround . data . loc [ goaround . data . timestamp >= next_attempt . start , "ILS" ] = next_attempt . max ( "ILS" ) yield goaround first_attempt = next_attempt
Detects go-arounds.
Detects go - arounds .
"""Detects go-arounds.

        The method yields pieces of trajectories with exactly two landing
        attempts (aligned on one runway) on the same airport separated by
        exactly one climbing phase.
        """ # The following cast secures the typing
self
airport
Union[str, "Airport", None]
dataset
Optional["Airports"]