Skip to content

Commit 6b2d34f

Browse files
author
“Bjarne
committed
Fixed Rounding on Temperature values
1 parent 1fe1a63 commit 6b2d34f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pysmartweatherudp/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def __init__(self, data, units):
9494
self.type = 'air'
9595
self.timestamp = data[0]
9696
self.pressure = UnitConversion.pressure(self, data[1], units)
97-
self.temperature = data[2]
97+
self.temperature = round(data[2],1)
9898
self.humidity = data[3]
9999
self.lightning_count = data[4]
100100
self.lightning_distance = UnitConversion.distance(self, data[5], units)
@@ -176,10 +176,10 @@ def getDewPoint(self, temperature, humidity):
176176
def getWindChill(self, wind_speed, temperature):
177177
""" Returns Wind Chill in Celcius """
178178
if wind_speed < 1.3:
179-
return temperature
179+
return round(temperature,1)
180180
else:
181181
windKmh = wind_speed * 3.6
182-
return round(13.12 + (0.6215 * temperature) - (11.37 * math.pow(windKmh, 0.16)) + (0.3965 * temperature * math.pow(windKmh, 0.16)), 2)
182+
return round(13.12 + (0.6215 * temperature) - (11.37 * math.pow(windKmh, 0.16)) + (0.3965 * temperature * math.pow(windKmh, 0.16)), 1)
183183

184184
def getHeatIndex(self, temperature, humidity):
185185
""" Returns Heat Index in Celcius """
@@ -222,4 +222,4 @@ def getFeelsLike(self, temperature, wind_chill, heat_index):
222222
elif temperature < 10:
223223
return wind_chill
224224
else:
225-
return temperature
225+
return round(temperature,1)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# Versions should comply with PEP440. For a discussion on single-sourcing
1717
# the version across setup.py and the project code, see
1818
# https://packaging.python.org/en/latest/single_source_version.html
19-
version='0.1.4',
19+
version='0.1.5',
2020

2121
description='Receive data from Smart Weather via UDP',
2222
long_description=" ".join(

0 commit comments

Comments
 (0)