FL550 / dwd_weather

Deutscher Wetterdienst integration for Home-Assistant
MIT License
181 stars 11 forks source link

Possibly wrong weather forecast data? #27

Closed Jpsy closed 2 years ago

Jpsy commented 3 years ago

Version of home_assistant

core-2021.4.6 with Home Assistant OS 5.13 on RPi4b 8Gb

Version of the custom_component

v1.2.10

Describe the bug

I am actually not sure, whether something is wrong. But I am creating this issue to give a chance for timely comparison of current weather forecasts:

The current 5 day weather forecast through this custom integration for my region deviates substantially from other reliable forecasts. I am not sure whether this is a normal deviation. Usually DWD is very reliable and the current weather situation is stable and predictable. And up to version 1.2.8 I did not witness such deviations.

Integration settings: Station-ID J907 = GOLDENE BREMM
(close to Saarbrücken)

Card settings: type: weather-forecast entity: weather.dwd_weather_goldene_bremm

Result in weather card: image

Kachelmann forecast for comparison: Neither cloud coverage nor temperature profile seem to match. https://kachelmannwetter.com/de/vorhersage/2842647-saarbruecken/kompakt/deu-hd image

Debug log


(No conspicuous log entries.)
Jpsy commented 3 years ago

Here is DWD's own forecast for Saarbrücken as of today. Same discrepancy.

image

HA still shows this:

image

FL550 commented 3 years ago

Can you please also add the file from https://opendata.dwd.de/weather/local_forecasts/mos/MOSMIX_L/single_stations/J907/kml/MOSMIX_L_LATEST_J907.kmz when you are comparing the forecasts? The forecast is generated from this file.

FL550 commented 3 years ago

Here is DWD's own forecast for Saarbrücken as of today. Same discrepancy.

image

HA still shows this:

image

This is Saarbrücken Airport, which can be a little different from the station you have selected within HA.

Jpsy commented 3 years ago

Can you please also add the file from https://opendata.dwd.de/weather/local_forecasts/mos/MOSMIX_L/single_stations/J907/kml/MOSMIX_L_LATEST_J907.kmz when you are comparing the forecasts? The forecast is generated from this file.

I'm not sure I understand what I should do. Do you want me to add this file somewhere in HA or next time I report an issue?

I actually just tried to import the KMZ file into My Maps but unfortunately the file seems to be to big or otherwise malformed to be imported.

This is Saarbrücken Airport, which can be a little different from the station you have selected within HA.

Yes true, but the distance is 10km and I can actually look over to the airport. There may be a slight difference in temperature. But have you seen the cloud coverage in the forecast? This is what I'm talking about. We have a totally stable high pressure system for the next days all over the region. Blue skies and sun - no trace of clouds anywhere. But the integration shows full cloud coverage for today and 4 days into the future. There is even a heavy discrepancy between within the card itself:

image

I also have Dark Sky and Clima Cell integrated in HA and they all agree that there will be nothing but blue skies.

FL550 commented 3 years ago

Yes, please upload the file the next time you report the discrepancy.

Ok, maybe I understand the issue. The condition is reported every hour and right now, I scan the conditions for the day and report the worst condition during that time period. So there is possibly one hour where clouds are reported and the integration takes this for the whole day. Maybe I should weight the conditions for the day and show that instead.

Jpsy commented 3 years ago

Oh, I see. An interesting problem. It is not so obvious which algorithm should be used to boil the hourly forecasts down into one single meaningful symbol for the whole day. Some thoughts from my side:

Doesn't DWD already provide a single symbol for the whole day somewhere in their data? So you wouldn't need to do all the math yourself?

Jpsy commented 3 years ago

Here is the current report of Dark Sky for comparison. It shows EXACTLY the icons that I would expect looking at the detailed data (i.e. of Kachelmann):

image

BTW: I very much prefer that you show rounded temperature values without a decimal place. It is much faster to read at a glance and it is kind of ridiculous to imply 10-th of degree precision on a 5 day forecast (like Dark Sky does).

Kachelmann to see the detailed prognosis for comparison to the above HA weather card:

image

BTW: I very much prefer that you use rounded temperature values in your integration. This is much faster to read and it is kind of ridiculous to show 10th of degrees Celsius on a 5 day forecast.

FL550 commented 3 years ago

Doesn't DWD already provide a single symbol for the whole day somewhere in their data? So you wouldn't need to do all the math yourself?

Unfortunately not.

  • Most people will perceive the weather only during daylight hours, probably mostly from 7 am to 8 pm when they are outside and exposed to the weather conditions.
  • A first and simple approach might be to simply use the weather symbol that appears most frequently during these daylight hours.
  • BUT: On a day with a sunny morning and a cloudy afternoon it might be much better to chose a sun+cloud symbol, although this symbol might occur in the data only for a short time while the weather changes. So an algorithm that really represents the perceived weather in one symbol, is a challenge.

I totally aggree with you. Problems on which icons to show appear in many situations. E.g. :

The next problem is, I am limited to these values: https://developers.home-assistant.io/docs/core/entity/weather/#recommended-values-for-state-and-condition

FL550 commented 3 years ago

Maybe the model can work like this:

  1. Count the occurences of each event and take the highest.
  2. If there is a at least one hour with significant weather take that.

We then have to define which of the values are "significant".

Jpsy commented 3 years ago

Maybe it would be much easier to not calculate the needed data from data that is itself already compiled. Instead it might be much better, to build on the original weather data.

What I mean is: If you have a look at all the graphs in the Kachelmann sample above, you see that it might be much easier to use the graphs at the bottom - cloud coverage and precipitation - to decide what weather the day brings. It should be quite easy to calculate a medium cloud coverage value over the daylight hours as well as a total precipitation value. With these two values alone you could already move along the sun/cloud/rain axis of conditions like this:

sunny -> partlycloudy -> cloudy -> rainy -> pouring

I am not sure which other elementary data you can build on, but I guess it will not be too difficult to find out if there is rain mixed with snow or only snow.

Fog, lightning and hail might be more difficult, depending on the raw data.

FL550 commented 3 years ago

I don't really understand the benefit from using the raw data. I only have aggregated values for every hour. And the condition indicator already tells the most significant weather phenomena within that hour.

Jpsy commented 3 years ago

Hi, did you just close this issue or will there be a change to the algorithm? Couldn't find any correlating code changes.

FL550 commented 3 years ago

Sorry, my fault.

No I haven't changed the code yet. I am still unsure which method to use.

FL550 commented 3 years ago

I finally got some time. I have implemented a very basic solution: https://github.com/FL550/simple_dwd_weatherforecast/commit/262c85c08577157073667a863567f431cedb4845

What are your thoughts on this?

FL550 commented 3 years ago

I just released a beta where the change is included. I also requested people to report their experiences with the beta here or in the HA forum.

Jpsy commented 3 years ago

Hi, thanks for working on this issue. Here are some results from my latest tests. As you can see the forecast icons are still way off compared to dark sky. Kachelmann diagrams included for comparison.

Screenshot_20210527-232654

Screenshot_20210527-232017

FL550 commented 3 years ago

In my location it's working as expected right now. I'll keep watching it and I will also release another version tomorrow, which includes debugging messages for the weather condition. Maybe we can then track this down better.

larena1 commented 3 years ago

Weather still pretty off unfortunately

Screenshot_20210825-015017

Wasn't sunny at 2 am in the morning, forecast still shows yesterday's weather and rainy vs sunny / cloudy forecast. Upper card is Dark Sky

FL550 commented 3 years ago

Without further informations I can not find the reason for your discrepancy.

Please, get your station id, find the corresponding folder from the dwd server and attach the file MOSMIX_LLATEST**.kmz to this thread with a screenshot of the forecast which you think is wrong.