Do not rely solely on "maximum temps for the rest of the day" to show the most relevant (worst) temperature for weather forecasts
In #982 it was discovered that gcal-weather-service.c is not using an average of temperatures to show as part of the forecast for each day, but actually uses "maximum" temperature of the remaining hours of each day... Indeed, the code mentions this in a comment somewhere:
Note: I checked three different gweather consumers and they all pick different values. So here is my take: I pick up the worst weather for icons and the highest temperature. I basically want to know whether I need my umbrella for my appointment. Not sure about the right temperature. It is probably better to pick-up the median of all predictions during daytime.
If I am not mistaken, this was in the original implementation by @flb.
The problem with the current approach
Taking the "maximum" temperature might sort of work if you live in an oceanic climate where temperatures almost never go below 0 °C, or a mediterranean/equatorial climate where it never goes below 15-20 °C, or if you live in very hot areas where the maximum temperature is the determinant factor in whether you can survive or not... but I can't imagine this thing working for nordic climates during the winter season.
Indeed, up here the determining factor on whether we will do anything outside in the winter, besides precipitation/wind/humidity, is how cold it is. Like, how fast your eyelids freeze. 20, 15, 10, 0, -5 °C? Sure, I'll go outside. -29 °C? I'll, uh, think about it. And yet, we also have very hot summers, so in the summer season I would be looking at the "maximum" numbers instead.
Possible approaches
Trying to think of a better way to convey the "worst temperature" of each day, I can imagine two or three ways to approach this problem:
- Use a geometric mean for everything. I'm no math geek, but I think it's better than a simple average or median. GeoMean will give you the central tendency or typical value of a set of numbers by using the product of their values (as opposed to the arithmetic mean which uses their sum).
- Potential caveat (from what I found out with the geomean function in LibreOffice Calc): it seems a regular geomean will cause an error with negative numbers. Apparently there's a mathematical workaround, but I don't know if that works well and is easily implemented.
- Show both min/max temps in the UI, but that uses up space (and is best kept for the tooltip instead)
- Use either the minimum, average/geomean, or maximum temperatures depending on which is considered the most relevant ("worst") depending on the hot vs cold situation. For example, if temperatures are above 25 °C, I'd say we can/should show the maximum temp; if below 10 °C, show the minimum temp; if between 10 and 25, show the geomean. This might allow for showing the "worst" temperatures in both hot and cold climates, and otherwise pretty accurate temperatures in milder conditions.
- The problem with "minimum" temperatures though, is that they will be heavily influenced by evening/nighttime... so if you're a nightwalker that's good, but if you are a daywalker, they may or may not be correct... although it is always better to "over-dress" in the winter than to be cold.
Does anyone have any opinions on this?