Skip to content

Commit

Permalink
Improve consistency of changes from PR Unidata#1876
Browse files Browse the repository at this point in the history
Updates parse_metar_to_dataframe() to return a dataframe with columns named current_wx1_symbol, current_wx2_symbol, and current_wx3_symbol, instead of current_weather, past_weather, and past_weather2
  • Loading branch information
23ccozad committed Jun 11, 2021
1 parent d9c7ef2 commit 84ec7b6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions src/metpy/io/metar.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
'dew_point_temperature': 'degC',
'altimeter': 'inHg',
'air_pressure_at_sea_level': 'hPa',
'present_weather': None,
'past_weather': None,
'past_weather2': None}
'current_wx1_symbol': None,
'current_wx2_symbol': None,
'current_wx3_symbol': None}


@exporter.export
Expand Down Expand Up @@ -110,9 +110,9 @@ def parse_metar_to_dataframe(metar_text, *, year=None, month=None):
* 'air_temperature': Temperature, measured in degrees Celsius
* 'dew_point_temperature': Dew point, measured in degrees Celsius
* 'altimeter': Altimeter value, measured in inches of mercury, float
* 'present_weather': Current weather symbol, integer
* 'past_weather': Past weather (1 of 2), integer
* 'past_weather2': Past weather (2 of 2), integer
* '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
* 'air_pressure_at_sea_level': Sea level pressure, derived from temperature, elevation
and altimeter value, float
* 'eastward_wind': Eastward component (u-compoment) of the wind vector, measured in knots
Expand Down Expand Up @@ -152,9 +152,9 @@ def parse_metar_to_dataframe(metar_text, *, year=None, month=None):
'air_temperature': metar_vars.temperature,
'dew_point_temperature': metar_vars.dewpoint,
'altimeter': metar_vars.altimeter,
'present_weather': metar_vars.current_wx1_symbol,
'past_weather': metar_vars.current_wx2_symbol,
'past_weather2': metar_vars.current_wx3_symbol},
'current_wx1_symbol': metar_vars.current_wx1_symbol,
'current_wx2_symbol': metar_vars.current_wx2_symbol,
'current_wx3_symbol': metar_vars.current_wx3_symbol},
index=[metar_vars.station_id])

# Convert to sea level pressure using calculation in metpy.calc
Expand Down Expand Up @@ -484,7 +484,7 @@ def parse_metar_file(filename, *, year=None, month=None):
* 'air_pressure_at_sea_level': Sea level pressure, derived from temperature, elevation
and altimeter value, float
* 'eastward_wind': Eastward component (u-compoment) of the wind vector, measured in knots
* 'northward_wind' Northward component (v-compoment) of the wind vector, measured in knots
* 'northward_wind': Northward component (v-compoment) of the wind vector, measured in knots
"""
# Defaults year and/or month to present reported date if not provided
Expand Down
6 changes: 3 additions & 3 deletions tests/io/test_metar.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ def test_missing_values():
assert_almost_equal(df.current_wx1.values, np.nan)
assert_almost_equal(df.current_wx2.values, np.nan)
assert_almost_equal(df.current_wx3.values, np.nan)
assert_almost_equal(df.present_weather.values, 0)
assert_almost_equal(df.past_weather.values, 0)
assert_almost_equal(df.past_weather2.values, 0)
assert_almost_equal(df.current_wx1_symbol.values, 0)
assert_almost_equal(df.current_wx2_symbol.values, 0)
assert_almost_equal(df.current_wx3_symbol.values, 0)
assert_almost_equal(df.low_cloud_type.values, np.nan)
assert_almost_equal(df.medium_cloud_type.values, np.nan)
assert_almost_equal(df.high_cloud_type.values, np.nan)
Expand Down

0 comments on commit 84ec7b6

Please sign in to comment.