runways are not required. can be extracted out of required arrival routes
This commit is contained in:
@@ -8,12 +8,6 @@ import sys
|
|||||||
from formats.SctEseFormat import SctEseFormat
|
from formats.SctEseFormat import SctEseFormat
|
||||||
|
|
||||||
class Airport:
|
class Airport:
|
||||||
def parseAirport(self, airport):
|
|
||||||
if None == airport.get('runways'):
|
|
||||||
return False
|
|
||||||
self.runways = airport['runways'].split(':')
|
|
||||||
return True
|
|
||||||
|
|
||||||
def findGngData(data, path):
|
def findGngData(data, path):
|
||||||
if None == data.get('gngwildcard'):
|
if None == data.get('gngwildcard'):
|
||||||
return None, None
|
return None, None
|
||||||
@@ -32,41 +26,23 @@ class Airport:
|
|||||||
return latestSct, latestEse
|
return latestSct, latestEse
|
||||||
|
|
||||||
def parsePlanning(self, planning):
|
def parsePlanning(self, planning):
|
||||||
for key in planning:
|
if None == planning.get('routes'):
|
||||||
# check if the runways match
|
return []
|
||||||
rwy = key.upper()
|
return planning['routes'].split(':')
|
||||||
if rwy not in self.runways:
|
|
||||||
sys.stderr.write('Unable to find ' + rwy + ' in defined runways')
|
|
||||||
return False
|
|
||||||
|
|
||||||
# check if arrivals are defined
|
|
||||||
arrivals = planning[key].split(':')
|
|
||||||
if 0 == len(arrivals):
|
|
||||||
sys.stderr.write('No arrival routes for ' + rwy)
|
|
||||||
return False
|
|
||||||
|
|
||||||
# assign the arrival routes to the runways
|
|
||||||
self.arrivalRoutes[rwy] = arrivals
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
def __init__(self, filepath : str, icao : str):
|
def __init__(self, filepath : str, icao : str):
|
||||||
self.runways = []
|
|
||||||
self.arrivalRoutes = {}
|
self.arrivalRoutes = {}
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(filepath)
|
config.read(filepath)
|
||||||
|
|
||||||
dataConfig = None
|
dataConfig = None
|
||||||
airportConfig = None
|
|
||||||
planningConfig = None
|
planningConfig = None
|
||||||
|
|
||||||
# search the required sections
|
# search the required sections
|
||||||
for key in config:
|
for key in config:
|
||||||
if 'DATA' == key:
|
if 'DATA' == key:
|
||||||
dataConfig = config['DATA']
|
dataConfig = config['DATA']
|
||||||
elif 'AIRPORT' == key:
|
|
||||||
airportConfig = config['AIRPORT']
|
|
||||||
elif 'PLANNING' == key:
|
elif 'PLANNING' == key:
|
||||||
planningConfig = config['PLANNING']
|
planningConfig = config['PLANNING']
|
||||||
|
|
||||||
@@ -76,22 +52,14 @@ class Airport:
|
|||||||
sys.stderr.write('No GNG-files found')
|
sys.stderr.write('No GNG-files found')
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
# parse the airport information
|
|
||||||
if None == airportConfig or False == self.parseAirport(airportConfig):
|
|
||||||
sys.stderr.write('No or no valid airport configuration found')
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
# parse the planning information
|
# parse the planning information
|
||||||
if None == planningConfig or False == self.parsePlanning(planningConfig):
|
if None == planningConfig or False == self.parsePlanning(planningConfig):
|
||||||
sys.stderr.write('No or no valid planning configuration found')
|
sys.stderr.write('No planning configuration found')
|
||||||
|
sys.exit(-1)
|
||||||
|
requiredArrivalRoutes = self.parsePlanning(planningConfig)
|
||||||
|
if 0 == len(requiredArrivalRoutes):
|
||||||
|
sys.stderr.write('No valid planning configuration found')
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
# get all required arrival routes and avoid duplicates
|
|
||||||
requiredArrivalRoutes = []
|
|
||||||
for rwy in self.arrivalRoutes:
|
|
||||||
for arrival in self.arrivalRoutes[rwy]:
|
|
||||||
if arrival not in requiredArrivalRoutes:
|
|
||||||
requiredArrivalRoutes.append(arrival)
|
|
||||||
|
|
||||||
# parse the GNG data
|
# parse the GNG data
|
||||||
print('Used GNG-Data: ' + eseFile)
|
print('Used GNG-Data: ' + eseFile)
|
||||||
|
|||||||
Reference in New Issue
Block a user