def find_station(report: str) -> Station: """Returns the first ICAO ident found in a report string""" for item in report.split(): if len(item) == 4: with suppress(BadStation): return Station.from_icao(item.upper()) return None
def __init__(self, icao: str): # Raises a BadStation error if needed station.valid_station(icao) self.station = icao self.station_info = Station.from_icao(icao) self.service = service.get_service(icao, self.station_info.country)( self.__class__.__name__.lower())
def station_info(self) -> Station: """ Provide basic station info Raises a BadStation exception if the station's info cannot be found """ if self._station_info is None: self._station_info = Station.from_icao(self.station) return self._station_info
def find_station(report: str) -> Station: """ Returns the first ICAO ident found in a report string """ for item in report.split(): if len(item) == 4: try: return Station.from_icao(item.upper()) except BadStation: pass return None
def __init__(self, station_ident: str = None, lat: float = None, lon: float = None): if station_ident: station_obj = Station.from_icao(station_ident) self.station_info = station_obj lat = station_obj.latitude lon = station_obj.longitude elif lat is None or lon is None: raise ValueError("No station or valid coordinates given") self.lat = lat self.lon = lon self.service = service.NOAA("aircraftreport")
def __init__(self, icao: str): # Raises a BadStation error if needed self.icao = icao self.station = Station.from_icao(icao)
def __init__(self, icao: str): icao = icao.upper() self.icao = icao self.station = Station.from_icao(icao)