1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-11-18 06:11:49 -05:00

Merge pull request #119 from craigerl/wx-fixes

Fixed rain numbers from aprslib
This commit is contained in:
Walter A. Boring IV 2023-07-14 11:18:11 -04:00 committed by GitHub
commit 62eff8645d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,12 +144,22 @@ class Packet(metaclass=abc.ABCMeta):
wind_speed = raw.get("speed")
if wind_speed:
raw["wind_speed"] = wind_speed / 1.852
raw["weather"]["wind_speed"] = raw["wind_speed"]
if "speed" in raw:
del raw["speed"]
# Let's adjust the rain numbers as well, since it's wrong
raw["rain_1h"] = (raw.get("rain_1h", 0) / .254) * .01
raw["weather"]["rain_1h"] = raw["rain_1h"]
raw["rain_24h"] = (raw.get("rain_24h", 0) / .254) * .01
raw["weather"]["rain_24h"] = raw["rain_24h"]
raw["rain_since_midnight"] = (raw.get("rain_since_midnight", 0) / .254) * .01
raw["weather"]["rain_since_midnight"] = raw["rain_since_midnight"]
if "wind_direction" not in raw:
wind_direction = raw.get("course")
if wind_direction:
raw["wind_direction"] = wind_direction
raw["weather"]["wind_direction"] = raw["wind_direction"]
if "course" in raw:
del raw["course"]