def getAirports(self):
     for row in self.airportsDb.itervalues():
         if len(row['ICAO Code'])>0 and len(row['Country'])>0:
             airport = Airport(
                                 Name = row['City']+'-'+row['Airport Name'] ,
                                 LatitudeDegrees = row['LatitudeDegrees'] , 
                                 LongitudeDegrees = row['LongitudeDegrees'] , 
                                 fieldElevationAboveSeaLevelMeters = float(row['AltitudeFeet'])*feetToMeters,
                                 ICAOcode = row['ICAO Code'] ,
                                 Country = row['Country'] )
             yield airport
예제 #2
0
    def test_airport(self):

        print("=========== Airport  =========== " + time.strftime("%c"))

        airportICAOcode = 'LFPG'
        CharlesDeGaulle = Airport(Name='CharlesDeGaulle',
                                  ICAOcode=airportICAOcode,
                                  Country='France')
        self.assertTrue(not (CharlesDeGaulle is None))

        runWaysDatabase = RunWayDataBase()
        self.assertTrue(runWaysDatabase.read(), 'run ways DB read correctly')

        self.assertTrue(CharlesDeGaulle.hasRunWays(runWaysDatabase))
        print('airport= {0} has run-ways= {1}'.format(CharlesDeGaulle,
                                                      CharlesDeGaulle.hasRunWays(
                                                          runWaysDatabase)))

        print("=========== Airport run ways ONE =========== " + time.strftime(
            "%c"))

        for runway in CharlesDeGaulle.getRunWaysAsDict(runWaysDatabase):
            print(runway)

        print("=========== Airport run ways TWO =========== " + time.strftime(
            "%c"))

        for runway in CharlesDeGaulle.getRunWays(runWaysDatabase):
            print(runway)
 def getAirportFromICAOCode(self, ICAOcode=""):
     if self.airportsDb is None: return None
     airport = None
     ''' internal airport is a dictionary '''
     for key, airportInternal in self.airportsDb.iteritems():
         if key == ICAOcode:
             airport = Airport(
                             Name = airportInternal['City']+'-'+airportInternal["Airport Name"] ,
                             LatitudeDegrees = airportInternal["LatitudeDegrees"] , 
                             LongitudeDegrees = airportInternal["LongitudeDegrees"] , 
                             fieldElevationAboveSeaLevelMeters = float(airportInternal["AltitudeFeet"])*feetToMeters,
                             ICAOcode = ICAOcode,
                             Country = airportInternal['Country'] )
             return airport
     return None