diff --git a/bin/user/weewx_wdc.py b/bin/user/weewx_wdc.py index f13a2eaf..99be89bc 100644 --- a/bin/user/weewx_wdc.py +++ b/bin/user/weewx_wdc.py @@ -2045,12 +2045,14 @@ def get_windrose_data(self, start_ts, end_ts, context): # Calculate percentages. num_of_values = len(list(windSpeed_vt[0])) - for index, data in enumerate(windrose_data): - for p_index, percent in enumerate(data["r"]): - windrose_data[index]["r"][p_index] = round( - # todo: division by zero - (percent / num_of_values) * 100 - ) + + if num_of_values > 0: + for index, data in enumerate(windrose_data): + for p_index, percent in enumerate(data["r"]): + windrose_data[index]["r"][p_index] = round( + # todo: division by zero + (percent / num_of_values) * 100 + ) return windrose_data diff --git a/changelog.md b/changelog.md index 79aa8cc0..2a7742a6 100644 --- a/changelog.md +++ b/changelog.md @@ -724,6 +724,7 @@ See https://github.com/Daveiano/weewx-wdc/compare/v3.2.0...11eed6b3#diff-ba225fb - Bugfix: Removed accidentally added Climatogram on year and stats page - Bugfix: Fixed encoding issue when using special chars in oridinate labels - Bugfix: Wind and Gust speed have a space between unit and comma (and added missing apostrophe to Yesterday's and Today's) GH-200 +- Bugfix: Division by zero in get_windrose_data GH-192 - Added `show_min_max` configuration to gauges config, added ordinal display for windDir gauge min/max - Only show 3 decimals for the geocode provided by weewx-forecast GH-191 - Make sidebar scrollable (if there are too many items) GH-193