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 and needs to be opened in text mode (i.e. read() needs to return a string, not bytes).

  • 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

Examples using metpy.io.parse_metar_file#

Station Plot

Station Plot

Using Predefined Areas with MetPy

Using Predefined Areas with MetPy

MetPy Declarative Syntax Tutorial

MetPy Declarative Syntax Tutorial