From af1e7e05c1b5c781d566b60419873a4985e854d2 Mon Sep 17 00:00:00 2001 From: sapostoluk Date: Tue, 16 Feb 2021 23:56:53 -0500 Subject: [PATCH 1/2] Implemented wind speed rounding for non-beaufort units, as the round_windspeed option previously didn't actually round the windspeed --- inkycal/modules/inkycal_weather.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inkycal/modules/inkycal_weather.py b/inkycal/modules/inkycal_weather.py index 25a102c..3ed3cad 100644 --- a/inkycal/modules/inkycal_weather.py +++ b/inkycal/modules/inkycal_weather.py @@ -442,11 +442,11 @@ class Weather(inkycal_module): if self.units == 'metric': logging.debug('getting windspeed in metric unit') - wind = str(weather.wind(unit='meters_sec')['speed']) + 'm/s' + wind = str(round(weather.wind(unit='meters_sec')['speed']), ndigits=dec_wind) + 'm/s' elif self.units == 'imperial': logging.debug('getting windspeed in imperial unit') - wind = str(weather.wind(unit='miles_hour')['speed']) + 'miles/h' + wind = str(round(weather.wind(unit='miles_hour')['speed']), ndigits=dec_wind) + 'miles/h' dec = decimal.Decimal moonphase = get_moon_phase() From ad683876421a1ec4d83a4df21395a33e69741318 Mon Sep 17 00:00:00 2001 From: sapostoluk Date: Wed, 17 Feb 2021 00:36:13 -0500 Subject: [PATCH 2/2] Fixed misplaced parentheses for rounding windspeed, abbreviated 'miles/h' to 'mph', and added space before wind units --- inkycal/modules/inkycal_weather.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inkycal/modules/inkycal_weather.py b/inkycal/modules/inkycal_weather.py index 3ed3cad..7c1b3ae 100644 --- a/inkycal/modules/inkycal_weather.py +++ b/inkycal/modules/inkycal_weather.py @@ -442,11 +442,11 @@ class Weather(inkycal_module): if self.units == 'metric': logging.debug('getting windspeed in metric unit') - wind = str(round(weather.wind(unit='meters_sec')['speed']), ndigits=dec_wind) + 'm/s' + wind = str(round(weather.wind(unit='meters_sec')['speed'], ndigits=dec_wind)) + ' m/s' elif self.units == 'imperial': logging.debug('getting windspeed in imperial unit') - wind = str(round(weather.wind(unit='miles_hour')['speed']), ndigits=dec_wind) + 'miles/h' + wind = str(round(weather.wind(unit='miles_hour')['speed'], ndigits=dec_wind)) + ' mph' dec = decimal.Decimal moonphase = get_moon_phase()