1 | # -*- coding: utf-8 -*-
|
---|
2 |
|
---|
3 | import sys
|
---|
4 |
|
---|
5 | #-----------------------------------------------------------------------------
|
---|
6 |
|
---|
7 | ## @package mlx.airports
|
---|
8 | #
|
---|
9 | # The mapping of ICAO codes to airport names.
|
---|
10 | #
|
---|
11 | # This module contains the mapping of ICAO codes to airport cities and names,
|
---|
12 | # as well as a \ref getWelcomeMessage "function" to produce a welcome message
|
---|
13 | # for a certain airport.
|
---|
14 |
|
---|
15 | #-----------------------------------------------------------------------------
|
---|
16 |
|
---|
17 | ## The mapping of the ICAO codes
|
---|
18 | airportNames = {
|
---|
19 | "VTBS" : ("Bangkok", "Suvarnabhumi"),
|
---|
20 | "KJFK" : ("New York", "J. F. Kennedy"),
|
---|
21 | "CYYZ" : ("Toronto", "Lester B. Pearson"),
|
---|
22 | "UUEE" : ("Moscow", "Sheremetevo"),
|
---|
23 | "UKBB" : ("Kiev", "Borispol"),
|
---|
24 | "UKOO" : ("Odessa", None),
|
---|
25 | "USSS" : ("Yekaterinburg", "Koltsovo"),
|
---|
26 | "LTBA" : ("Istanbul", "Atatürk"),
|
---|
27 | "LLBG" : ("Tel-Aviv", "Ben Gurion"),
|
---|
28 | "HECA" : ("Cairo", None),
|
---|
29 | "LCLK" : ("Larnaca", None),
|
---|
30 | "LGAV" : ("Athens", "Eleftherios Venizelos"),
|
---|
31 | "OLBA" : ("Beirut", "Rafic Hariri"),
|
---|
32 | "OSDI" : ("Damascus", None),
|
---|
33 | "LGTS" : ("Thessaloniki", "Makedonia"),
|
---|
34 | "LIRF" : ("Rome", "Fiumicino"),
|
---|
35 | "LIPZ" : ("Venezia", "Tessera"),
|
---|
36 | "LATI" : ("Tirana", "Rinas"),
|
---|
37 | "LWSK" : ("Skopje", None),
|
---|
38 | "LQSA" : ("Sarajevo", "Butmir"),
|
---|
39 | "BKPR" : ("Pristina", None),
|
---|
40 | "LDZA" : ("Zagreb", "Pleso"),
|
---|
41 | "LDSP" : ("Split", "Kastela"),
|
---|
42 | "LDDU" : ("Dubrovnik", "Cilipi"),
|
---|
43 | "LYPG" : ("Podgorica", "Titograd"),
|
---|
44 | "EDDS" : ("Stuttgart Echterdingen", None),
|
---|
45 | "EDDF" : ("Frankfurt", "Main"),
|
---|
46 | "EDDM" : ("Munich", "Franz-Josef Strauss"),
|
---|
47 | "EDDH" : ("Hamburg", None),
|
---|
48 | "LFPG" : ("Paris", "Charles de Gaulle"),
|
---|
49 | "LFLL" : ("Lyon", "Satolas"),
|
---|
50 | "LSGG" : ("Geneva", "Cointrin"),
|
---|
51 | "LEMD" : ("Madrid", "Barajas"),
|
---|
52 | "EBBR" : ("Brussels", "Zaventem"),
|
---|
53 | "EGKK" : ("London", "Gatwick"),
|
---|
54 | "EIDW" : ("Dublin", "Collinstown"),
|
---|
55 | "EICK" : ("Cork", None),
|
---|
56 | "EHAM" : ("Amsterdam", "Schiphol"),
|
---|
57 | "EDDT" : ("Berlin", "Tegel"),
|
---|
58 | "EFHK" : ("Helsinki", "Vantaa"),
|
---|
59 | "EKCH" : ("Copenhagen", "Kastrup"),
|
---|
60 | "ESSA" : ("Stockholm", "Arlanda"),
|
---|
61 | "ESGG" : ("Gothenburg", None),
|
---|
62 | "LKPR" : ("Prague", "Ruznye"),
|
---|
63 | "LBSF" : ("Sofia", "Vrhazdebna"),
|
---|
64 | "EPWA" : ("Warsaw", "Okecie"),
|
---|
65 | "LROP" : ("Bucharest", "Otopeni"),
|
---|
66 | "LRTR" : ("Timisoara", None),
|
---|
67 | "LRCK" : ("Constanta", None),
|
---|
68 | "LRTM" : ("Tirgu Mures", "Vidrasau"),
|
---|
69 | "LHBP" : ("Budapest", "Ferihegy"),
|
---|
70 | "LHDC" : ("Debrecen", None)
|
---|
71 | }
|
---|
72 |
|
---|
73 | #-----------------------------------------------------------------------------
|
---|
74 |
|
---|
75 | def getWelcomeMessage(icao):
|
---|
76 | """Get the welcome message for the airport with the given ICAO code."""
|
---|
77 | message = "Welcome to "
|
---|
78 | if icao in airportNames:
|
---|
79 | (town, airportName) = airportNames[icao]
|
---|
80 | message += town if airportName is None else (airportName + " Airport")
|
---|
81 | else:
|
---|
82 | message += icao
|
---|
83 | message += "."
|
---|
84 | return message
|
---|
85 |
|
---|
86 | #-----------------------------------------------------------------------------
|
---|
87 |
|
---|
88 | if __name__ == "__main__":
|
---|
89 | for (town, airport) in airportNames.itervalues():
|
---|
90 | print town, airport
|
---|
91 | print getWelcomeMessage("LIRF")
|
---|
92 | print getWelcomeMessage("LHDC")
|
---|
93 | print getWelcomeMessage("LIRN")
|
---|
94 |
|
---|
95 | #-----------------------------------------------------------------------------
|
---|