def _evaluate_airports(self, airports, lowest_lat, lowest_lon, lowest_hdg, appr_ils_freq):
        '''
        pre filter cirteria on airprots
        '''
        annotated_airports = {}
        for airport in airports:
            ils_match = None
            heading_match = False
            min_rwy_start_dist = None
            for runway in airport.get('runways', []):
                if not filter_runway_heading(runway, lowest_hdg):
                    # Heading does not match runway
                    continue
                heading_match = True
                if ut.convert(runway.get('localizer', {}).get('frequency', 0), ut.KHZ, ut.MHZ) == appr_ils_freq:
                    ils_match = True
                if runway.get('start') and lowest_lat is not None and lowest_lon is not None:
                    start_dist = great_circle_distance__haversine(
                        runway['start']['latitude'],
                        runway['start']['longitude'],
                        lowest_lat, lowest_lon,
                    )
                    min_rwy_start_dist = min(min_rwy_start_dist, start_dist) if min_rwy_start_dist else start_dist

            annotated_airports[airport['id']] = {'airport': airport,
                                                 'heading_match': heading_match,
                                                 'ils_match': ils_match,
                                                 'min_rwy_start_dist': min_rwy_start_dist,
                                                 'distance': airport['distance']}

        return annotated_airports
Пример #2
0
    def _evaluate_airports(self, airports, lowest_lat, lowest_lon, lowest_hdg, appr_ils_freq):
        '''
        pre filter cirteria on airprots
        '''
        annotated_airports = {}
        for airport in airports:
            ils_match = None
            heading_match = False
            min_rwy_start_dist = None
            for runway in airport.get('runways', []):
                if not filter_runway_heading(runway, lowest_hdg):
                    # Heading does not match runway
                    continue
                heading_match = True
                if ut.convert(runway.get('localizer', {}).get('frequency', 0), ut.KHZ, ut.MHZ) == appr_ils_freq:
                    ils_match = True
                if runway.get('start') and lowest_lat is not None and lowest_lon is not None:
                    start_dist = great_circle_distance__haversine(
                        runway['start']['latitude'],
                        runway['start']['longitude'],
                        lowest_lat, lowest_lon,
                    )
                    min_rwy_start_dist = min(min_rwy_start_dist, start_dist) if min_rwy_start_dist else start_dist

            annotated_airports[airport['id']] = {'airport': airport,
                                                 'heading_match': heading_match,
                                                 'ils_match': ils_match,
                                                 'min_rwy_start_dist': min_rwy_start_dist,
                                                 'distance': airport['distance']}

        return annotated_airports