parse_metar_to_dataframe

metpy.io.parse_metar_to_dataframe(metar_text, *, year=None, month=None)[source]

Parse a single METAR report into a Pandas DataFrame.

Takes a METAR string in a text form, and creates a pandas.DataFrame including the essential information (not including the remarks)

The parser follows the WMO format, allowing for missing data and assigning nan values where necessary. The WMO code is also provided for current weather, which can be utilized when plotting.

Parameters
  • metar_text (str) – The METAR report

  • 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 output 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