parse_metar_file

metpy.io.parse_metar_file(filename, *, year=None, month=None)[source]

Parse a text file containing multiple METAR reports and/or text products.

Parameters
  • filename (str or file-like object) – If str, the name of the file to be opened. If filename is a file-like object, this will be read from directly.

  • year (int, optional) – Year in which observation was taken, defaults to current year. Keyword-only argument.

  • month (int, optional) – Month in which observation was taken, defaults to current month. Keyword-only argument.

Returns

pandas.DataFrame

Notes

The returned pandas.DataFrame has the following columns: ‘station_id’: Station Identifier (ex. KLOT) ‘latitude’: Latitude of the observation, measured in degrees ‘longitude’: Longitude of the observation, measured in degrees ‘elevation’: Elevation of the observation above sea level, measured in meters ‘date_time’: Date and time of the observation, datetime object ‘wind_direction’: Direction the wind is coming from, measured in degrees ‘wind_spd’: Wind speed, measured in knots ‘current_wx1’: Current weather (1 of 3) ‘current_wx2’: Current weather (2 of 3) ‘current_wx3’: Current weather (3 of 3) ‘skyc1’: Sky cover (ex. FEW) ‘skylev1’: Height of sky cover 1, measured in feet ‘skyc2’: Sky cover (ex. OVC) ‘skylev2’: Height of sky cover 2, measured in feet ‘skyc3’: Sky cover (ex. FEW) ‘skylev3’: Height of sky cover 3, measured in feet ‘skyc4’: Sky cover (ex. CLR) ‘skylev4:’: Height of sky cover 4, measured in feet ‘cloudcover’: Cloud coverage measured in oktas, taken from maximum of sky cover values ‘temperature’: Temperature, measured in degrees Celsius ‘dewpoint’: Dew point, measured in degrees Celsius ‘altimeter’: Altimeter value, measured in inches of mercury, float ‘current_wx1_symbol’: Current weather symbol (1 of 3), integer ‘current_wx2_symbol’: Current weather symbol (2 of 3), integer ‘current_wx3_symbol’: Current weather symbol (3 of 3), integer ‘sea_level_pressure’: Sea level pressure, derived from temperature, elevation and altimeter value, float

Examples using metpy.io.parse_metar_file