#!/usr/bin/env python import pytz from datetime import datetime from aman.com import AircraftReport_pb2 from aman.sys.WeatherModel import WeatherModel from aman.types.PerformanceData import PerformanceData class Inbound: def __init__(self, report : AircraftReport_pb2.AircraftReport, performanceData : PerformanceData): self.Report = report self.Callsign = report.aircraft.callsign self.CurrentPosition = report.position self.ReportTime = datetime.strptime(report.reportTime + '+0000', '%Y%m%d%H%M%S%z').replace(tzinfo = pytz.UTC) self.EnrouteArrivalTime = None self.InitialArrivalTime = None self.RequestedRunway = None self.MaximumTimeToGain = None self.PlannedArrivalTime = None self.PlannedRunway = None self.PlannedStar = None self.PlannedArrivalRoute = None self.PlannedTrackmiles = None self.FixedSequence = False self.ExpectedRunway = None self.AssignmentMode = None self.HasValidSequence = False self.WTC = None # analyze the WTC wtc = report.aircraft.wtc.upper() if 'L' == wtc or 'M' == wtc or 'H' == wtc or 'J' == wtc: self.WTC = wtc # analyze the requested runway if '' != report.requestedRunway: self.RequestedRunway = report.requestedRunway # search performance data -> fallback to A320 if self.Report.aircraft.type in performanceData.Aircrafts: self.PerformanceData = performanceData.Aircrafts[self.Report.aircraft.type] if None == self.PerformanceData: self.PerformanceData = performanceData.Aircrafts['A320']