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_speed’: Wind speed, measured in knots

  • ‘wind_gust’: Wind gust, measured in knots

  • ‘visibility’: Visibility distance, measured in meters

  • ‘current_wx1’: Current weather (1 of 3)

  • ‘current_wx2’: Current weather (2 of 3)

  • ‘current_wx3’: Current weather (3 of 3)

  • ‘low_cloud_type’: Low-level sky cover (ex. FEW)

  • ‘low_cloud_level’: Height of low-level sky cover, measured in feet

  • ‘medium_cloud_type’: Medium-level sky cover (ex. OVC)

  • ‘medium_cloud_level’: Height of medium-level sky cover, measured in feet

  • ‘high_cloud_type’: High-level sky cover (ex. FEW)

  • ‘high_cloud_level’: Height of high-level sky cover, measured in feet

  • ‘highest_cloud_type’: Highest-level Sky cover (ex. CLR)

  • ‘highest_cloud_level:’: Height of highest-level sky cover, measured in feet

  • ‘cloud_coverage’: Cloud cover measured in oktas, taken from maximum of sky cover values

  • ‘air_temperature’: Temperature, measured in degrees Celsius

  • ‘dew_point_temperature’: Dew point, measured in degrees Celsius

  • ‘altimeter’: Altimeter value, measured in inches of mercury

  • ‘remarks’: Any remarks section in the report

  • ‘current_wx1_symbol’: Current weather symbol (1 of 3), WMO integer code from [WMO306] Attachment IV

  • ‘current_wx2_symbol’: Current weather symbol (2 of 3), WMO integer code from [WMO306] Attachment IV

  • ‘current_wx3_symbol’: Current weather symbol (3 of 3), WMO integer code from [WMO306] Attachment IV

  • ‘air_pressure_at_sea_level’: Sea level pressure, derived from temperature, elevation and altimeter value

  • ‘eastward_wind’: Eastward component (u-component) of the wind vector, measured in knots

  • ‘northward_wind’: Northward component (v-component) of the wind vector, measured in knots