PythonMETAR
Python library for aeronautical METAR (METeorological Aerodrome Report).
Datas, informations and analysis provided don't have ANY WARRANTLY. Informations, datas and analysis MUST ALWAYS BE CHECKED by captain before a flight.
Installation
PIP
You can use pip in order to install package.
pip install PythonMETAR
Usage
Import
Use
from PythonMETAR import *
Declare a METAR
Retrieve a live METAR
#example = Metar('OACICODE')
example = Metar('LFLY') #Lyon-Bron Airport (LFLY)
Declare a METAR with data
#example = Metar('ICAOCODE','METARDATAS')
example = Metar('LFQN','METAR LFQN 201630Z 18005KT 4000 -SHRA SCT030 BKN050 18/12 Q1014 NOSIG=') #Saint-Omer Airfield (LFLY)
Get informations
List of attributes analyzed
airport
(string): ICAO code of METAR airportdata_date
(string): Date provided by NOAA server. None if text enter manuallymetar
(string): Complete METAR messagechangements
(string) : Changementsauto
(boolean): Define if a METAR isfrom an automatic station or notdate_time
(tuple): Tuple of date with day, hour & minuteswind
(dictionary): Dictionary with wind informationrvr
(tuple): Tuple of dictionaries with RVR informationweather
(dictionary): Dictionary of tuple with significant weather informationcloud
(tuple): Tuple of dictionaries with cloud detected informationtemperatures
(dictionary): Dictionary of integers with temperature and dewpoint informationqnh
(integer OR float): Information of QNH (integer if hPA, float if inHG)visibility
(integer): Information about visibilityproperties
(dictionary): Dictionary of attributevmc
(dictionnary):Dictionary of 2 booleans
VMC
VMC analysis are based on conditions from SERA 2017 French Reglementation for an aircraft flying below 140 knots
Getter
All properties
In order to get all properties from METAR, you can use getAll()
method.
example = Metar('LFLY') #Lyon-Bron airport
properties = example.getAll() #Get a dictionnary with all properties
If you want to display this dictionary, set display
argument to True. Default to False
An attribute
In order to get one attribute from METAR, you can use getAttribute(attribute)
method.
List of attributes is available above.
example = Metar('LFLY') #Lyon-Bron airport
properties = example.getAttribute() #Get attribute
Origin of data
Data are provided by NOAA. FTP server is available here : https://tgftp.nws.noaa.gov/data/observations/metar/stations/
Errors
NOAAServError
Exception raised if a connection problem encountered during connection with NOAA Servor.
Check your Internet connection & settings.
ReadingMETARError
Exception raised during parsing METAR with one method. It's a general error.
ReadFileError
ReadFileError
is an exception based on Exception basic class. This exception is raised in methods of Metar
class if an error occurred during reading of file downloaded in temp file by readlines()
method. Try to execute your program as administrator.