mirror of https://github.com/chubin/wttr.in
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
541 B
25 lines
541 B
import csv
|
|
|
|
AIRPORTS_DAT_FILE = "/home/igor/wttrin-geo/share/airports.dat"
|
|
|
|
|
|
def load_aiports_index():
|
|
file_ = open(AIRPORTS_DAT_FILE, "r")
|
|
reader = csv.reader(file_)
|
|
airport_index = {}
|
|
|
|
for line in reader:
|
|
airport_index[line[4]] = line
|
|
|
|
return airport_index
|
|
|
|
|
|
AIRPORTS_INDEX = load_aiports_index()
|
|
|
|
|
|
def get_airport_gps_location(iata_code):
|
|
if iata_code in AIRPORTS_INDEX:
|
|
airport = AIRPORTS_INDEX[iata_code]
|
|
return "%s,%s airport" % (airport[6], airport[7]) # , airport[1])
|
|
return None
|