weather-widget-2 icon indicating copy to clipboard operation
weather-widget-2 copied to clipboard

Forecast times for metno

Open Whyhow314 opened this issue 2 years ago • 4 comments

The forecast near the bottom of the widget uses correct time zones for OWM, but not met.no. At about 12pm EST, for example, the widget shows a forecast for 3pm in NYC when using OWM but does not for met.no. The date labels on the met.no forecast are also wrong; the one in the screenshot lists Tue 20 twice. I suspect it's related to some kind of incorrect conversion to or from UTC, as the widget is 5 hours off, e.g. the widget's forecast for 9pm matches yr.no at 4pm. The bug is not affected by the timezone choice in the widget settings, or by changing the timezone associated with the location (though both settings do affect the meteogram).

metno (incorrect) metno OWM (correct) owm

Whyhow314 avatar Feb 20 '24 21:02 Whyhow314

Dealing with timezones frequently has me tearing my hair out in frustration - it's amazing I'm not completely bald! Trying to write code that will display the time in Bangkok, for a user in LA, when Javascript wants to convert everything into UTC is tricky to say the least...

At the moment I am rewriting substantial parts of code to get it working on Plasma 6 - including the timezone related code - and will backport it for the Plasma 5 widget when I'm done.

blackadderkate avatar Feb 21 '24 13:02 blackadderkate

Met.no is definitely better (with version 3.0/plasma 6), but there seems to be a daylight saving time issue, as the temperatures listed are 1 hour off from the ones at yr.no. The meteogram has related problems: it starts at different places for local timezone and location timezone when the two timezones are the same (incorrectly for location timezone). The temperature graph is an hour off for local timezone (in the same direction as the listed temperatures) and 2 hours off for the location timezone, one of which comes from the offset start time. Screenshot_20240325_112620 Screenshot_20240325_112713

However OWM is now having the reverse issue to what met.no originally had, e.g. listing a forecast for 9am at 11:30am EST. It's harder for me to tell exactly what is going on there, since openweathermap.org doesn't have hourly forecasts in text format, but graphically the peak of the meteogram for NYC appears to be 4 hours off when the widget is set to local timezone, and is correct when it's set to UTC.

Whyhow314 avatar Mar 25 '24 15:03 Whyhow314

I think I have fixed the MetNo "Daylight Savings Time" code - please can you try Release 3.0.3 and let me know?

For reasons I can't quite fathom, my code seemed to be loading the Daylight Savings offset correctly, and then immediately discarding it in favour of the Standard-Time offset. I changed the order it does things, and simplified the code and it now seems to behave the way it's supposed to...

Assuming all is now OK, I will start porting my timezone code to the OWM routine.

blackadderkate avatar Apr 03 '24 17:04 blackadderkate

The temperature forecasts at the bottom definitely work now for met.no, though I haven't checked whether it drops previous forecasts at the right time. I can also confirm that when location time and local time are the same, switching between them does nothing. (Also switching to UTC only affects the meteogram, not the 3/9/3/9 forecasts, but I have no idea whether or not that's intended behavior). I think the only thing that's off now is that the meteogram lists its start as the most recent hour rather than the upcoming hour (e.g. showing weather starting at 4 when it is currently 4:30). Consequently, the precipitation and temperature on the meteogram are an hour off: the amount it lists at 4 is what yr.no predicts at 5. If the label on the meteogram read one hour later, it would match perfectly.

Whyhow314 avatar Apr 03 '24 20:04 Whyhow314