예제 #1
0
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
예제 #2
0
 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())
예제 #3
0
    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
예제 #4
0
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
예제 #5
0
 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")
예제 #6
0
 def __init__(self, icao: str):
     # Raises a BadStation error if needed
     self.icao = icao
     self.station = Station.from_icao(icao)
예제 #7
0
 def __init__(self, icao: str):
     icao = icao.upper()
     self.icao = icao
     self.station = Station.from_icao(icao)