gjr80 / weewx-realtime_gauge-data

Near realtime support for updating of SteelSeries Weather Gauges by WeeWX
GNU General Public License v3.0
9 stars 5 forks source link

Division by zero in wind calculations after midnight before first archive has been processed after midnight #5

Closed bakerkj closed 7 years ago

bakerkj commented 7 years ago

Just after midnight, before the archive has been processed rtgdthread produces these errors:

Apr 25 00:00:16 HOSTNME weewx[29890]: rtgdthread: Traceback (most recent call last): Apr 25 00:00:16 HOSTNME weewx[29890]: rtgdthread: File "/usr/share/weewx/user/rtgd.py", line 926, in process_packet Apr 25 00:00:16 HOSTNME weewx[29890]: rtgdthread: data = self.calculate(cached_packet) Apr 25 00:00:16 HOSTNME weewx[29890]: rtgdthread: File "/usr/share/weewx/user/rtgd.py", line 1560, in calculate Apr 25 00:00:16 HOSTNME weewx[29890]: rtgdthread: self.wind_group).value/self.day_stats['wind'].count Apr 25 00:00:16 HOSTNME weewx[29890]: rtgdthread: ZeroDivisionError: float division by zero

I believe this is because self.day_stats['wind'].count is zero because there is no wind data between midnight and 5 minutes after midnight.

gjr80 commented 7 years ago

This was fixed at commit 92a4a777ba635088378c0a643535b0efc81c7f66 which was to be released as v0.2.12 but for some reason I did not release v0.2.12. v0.2.13 will include the fix.