From 94067daf7d2bc07e0fac2ae43c0037cd78330515 Mon Sep 17 00:00:00 2001 From: Connor Cozad <23ccozad@gmail.com> Date: Fri, 11 Jun 2021 10:18:14 -0400 Subject: [PATCH] Improve consistency of changes from PR #1876 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 --- src/metpy/io/metar.py | 18 +++++++++--------- tests/io/test_metar.py | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/metpy/io/metar.py b/src/metpy/io/metar.py index a488ad09497..9d2fa75d7f5 100644 --- a/src/metpy/io/metar.py +++ b/src/metpy/io/metar.py @@ -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 @@ -114,7 +114,7 @@ def parse_metar_to_dataframe(metar_text, *, year=None, month=None): * '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, float + and altimeter value * '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 @@ -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 @@ -482,9 +482,9 @@ def parse_metar_file(filename, *, year=None, month=None): * '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, float + and altimeter value * '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 diff --git a/tests/io/test_metar.py b/tests/io/test_metar.py index e29a0f8c3ab..870e32b1d6b 100644 --- a/tests/io/test_metar.py +++ b/tests/io/test_metar.py @@ -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)