Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radar-based precipation forecast #30

Open
m-kloeckner opened this issue May 26, 2021 · 6 comments
Open

Radar-based precipation forecast #30

m-kloeckner opened this issue May 26, 2021 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@m-kloeckner
Copy link

Is your feature request related to a problem? Please describe.
Not related to a problem.

Describe the solution you'd like
I would like to build a sensor in HA, which gives a reliable precipation forecast for the next 15, 30, 60mins in a specific region. The most accurate forecast I know of is the rain radar forecast provided by DWD (radvor / radolan). I would therefore like to have the radar information provided by DWD integrated as customizable sensors (sensor for each region and future time frame, e.g., Cologne-Ehrenfeld area for the next 15mins)

Describe alternatives you've considered
I found a reference implementation here: https://github.com/ulid000/Fahrradwetter. The developer calculated precipation forecasts (5min steps for next 2h) for customizable regions (rectangles out of the 900x900 radar grid).

Additional context
To be honest, I do not know if the precipation forecast sensors that are implemented already are based on radar information - I did not find this information in the DWD documentation. As I understood it, the precipation forecasts in the mosmix are model based predictions and not based on the current radar observations.

@FL550
Copy link
Owner

FL550 commented May 26, 2021

This sounds like a nice idea. The precipitation forecast right now is, as you have already mentioned, only based on the mosmix model. So including the radar would be a nice add-on.

The reference implementation helps a lot, but right now I don't have much time to include this timely. Can you maybe assist with this?

@FL550 FL550 added enhancement New feature or request help wanted Extra attention is needed labels Sep 1, 2021
@swa72
Copy link

swa72 commented Mar 22, 2023

@alanmilinovic
Copy link

alanmilinovic commented Mar 22, 2023

You may want to check out https://www.ajfriesen.com/rain-warning-sensor-with-home-assistant/

This service (https://morgenwirdes.de) is not reliable and has a lot of incorrect information. I built my own radar based on OpenWeatherMap that can be used anywhere in the world. For germany it is also very accurate and I love it.

To get an idea, check this out.
https://community.home-assistant.io/t/morning-weather-notification-with-daily-high-temperature/385504/24

@diplix
Copy link
Contributor

diplix commented May 10, 2023

actually i found morgenwirdes.de to delivery very good rain warnings from DWDs radolan (radar) rain data. from the data i can draw a bar chart with expected rain amounts over the next 2 hours, with datapoints every 5 minutes. however every now and then the morgenwirdes.de server returns no values or an error.

i found this library https://github.com/dimitri-rebrikov/dwd_utils which can fetch the radolan data directly from DWD. you can run the script https://github.com/dimitri-rebrikov/dwd_utils/blob/main/radolan.py directly from the command line and it gets radolan data over the next 2 hours for a (german) PLZ. usage seems to consume quite some CPU cycles but if you call it only every 5 minutes thats not to bad.
i changed the code a bit so it outputs a json string that i can read with a command line sensor.

with the json data a can build my bar chart or, as an example, a spark line graph. this is an example to test the radolan data in the HA template editor:

{% set data = {"timestamp": "2023-05-09T23:50:00.000Z", "forecasts": [{"forecast": "000", "value": 0.24, "timestamp": "2023-05-09T23:50:00.000000Z"}, {"forecast": "005", "value": 0.12, "timestamp": "2023-05-09T23:55:00.000000Z"}, {"forecast": "010", "value": 0.12, "timestamp": "2023-05-10T00:00:00.000000Z"}, {"forecast": "015", "value": 0.0, "timestamp": "2023-05-10T00:05:00.000000Z"}, {"forecast": "020", "value": 0.0, "timestamp": "2023-05-10T00:10:00.000000Z"}, {"forecast": "025", "value": 0.12, "timestamp": "2023-05-10T00:15:00.000000Z"}, {"forecast": "030", "value": 0.12, "timestamp": "2023-05-10T00:20:00.000000Z"}, {"forecast": "035", "value": 0.12, "timestamp": "2023-05-10T00:25:00.000000Z"}, {"forecast": "040", "value": 0.24, "timestamp": "2023-05-10T00:30:00.000000Z"}, {"forecast": "045", "value": 0.24, "timestamp": "2023-05-10T00:35:00.000000Z"}, {"forecast": "050", "value": 0.0, "timestamp": "2023-05-10T00:40:00.000000Z"}, {"forecast": "055", "value": 0.12, "timestamp": "2023-05-10T00:45:00.000000Z"}, {"forecast": "060", "value": 0.0, "timestamp": "2023-05-10T00:50:00.000000Z"}, {"forecast": "065", "value": 0.0, "timestamp": "2023-05-10T00:55:00.000000Z"}, {"forecast": "070", "value": 0.12, "timestamp": "2023-05-10T01:00:00.000000Z"}, {"forecast": "075", "value": 0.24, "timestamp": "2023-05-10T01:05:00.000000Z"}, {"forecast": "080", "value": 0.24, "timestamp": "2023-05-10T01:10:00.000000Z"}, {"forecast": "085", "value": 0.12, "timestamp": "2023-05-10T01:15:00.000000Z"}, {"forecast": "090", "value": 0.0, "timestamp": "2023-05-10T01:20:00.000000Z"}, {"forecast": "095", "value": 0.0, "timestamp": "2023-05-10T01:25:00.000000Z"}, {"forecast": "100", "value": 0.0, "timestamp": "2023-05-10T01:30:00.000000Z"}, {"forecast": "105", "value": 0.0, "timestamp": "2023-05-10T01:35:00.000000Z"}, {"forecast": "110", "value": 0.0, "timestamp": "2023-05-10T01:40:00.000000Z"}, {"forecast": "115", "value": 0.0, "timestamp": "2023-05-10T01:45:00.000000Z"}, {"forecast": "120", "value": 0.0, "timestamp": "2023-05-10T01:50:00.000000Z"}]} %}

dwd: 

{%- for fiveminutes in data.forecasts %}
{%- if loop.index > 24 %}{{""}}
{%- else %}
{%- set rainintensity = fiveminutes.value %}
{%- if rainintensity < 0.1 %}{{"▁"}}
{%- elif 0.1 <= rainintensity < 0.5 %}{{"▂"}}
{%- elif 0.5 <= rainintensity < 1 %}{{"▃"}}
{%- elif 1 <= rainintensity < 1.5 %}{{"▄"}}
{%- elif 1.5 <= rainintensity < 2 %}{{"▅"}}
{%- elif 2 <= rainintensity < 3.5 %}{{"▆"}}
{%- elif 3.5 <= rainintensity < 5 %}{{"▇"}}
{%- elif 5 <= rainintensity < 10 %}{{"█"}}
{%- else %}{{"▓"}}
{%- endif %}
{%- endif %}
{%- endfor %}

dwd → 8: 
{%- set raindata = namespace(list=[]) -%}
{%- for n in data.forecasts -%}
{%- set raindata.list = raindata.list + [n.value] %}
{%- endfor -%}
{%- for fiveminutes in raindata.list|batch(3) %}


{%- if loop.index > 8 %}{{""}}
{%- else %}
{%- set rainintensity = fiveminutes|max|float %}
{%- if rainintensity < 0.1 %}{{"▁"}}
{%- elif 0.1 <= rainintensity < 0.5 %}{{"▂"}}
{%- elif 0.5 <= rainintensity < 1 %}{{"▃"}}
{%- elif 1 <= rainintensity < 1.5 %}{{"▄"}}
{%- elif 1.5 <= rainintensity < 2 %}{{"▅"}}
{%- elif 2 <= rainintensity < 3.5 %}{{"▆"}}
{%- elif 3.5 <= rainintensity < 5 %}{{"▇"}}
{%- elif 5 <= rainintensity < 10 %}{{"█"}}
{%- else %}{{"▓"}}
{%- endif %}
{%- endif %}
{%- endfor %}
image

i guess adding the dwd_utils library to get radolan data into this custom component shouldn’t be too hard, though my coding skills are really limited and i wouldn’t be of much help. however, if anyone is interested i can share the code of the command line sensor stuff i built so far (and which i am still testing).

@alanmilinovic
Copy link

actually i found morgenwirdes.de to delivery very good rain warnings from DWDs radolan (radar) rain data. from the data i can draw a bar chart with expected rain amounts over the next 2 hours, with datapoints every 5 minutes. however every now and then the morgenwirdes.de server returns no values or an error.

i found this library https://github.com/dimitri-rebrikov/dwd_utils which can fetch the radolan data directly from DWD. you can run the script https://github.com/dimitri-rebrikov/dwd_utils/blob/main/radolan.py directly from the command line and it gets radolan data over the next 2 hours for a (german) PLZ. usage seems to consume quite some CPU cycles but if you call it only every 5 minutes thats not to bad. i changed the code a bit so it outputs a json string that i can read with a command line sensor.

with the json data a can build my bar chart or, as an example, a spark line graph. this is an example to test the radolan data in the HA template editor:

{% set data = {"timestamp": "2023-05-09T23:50:00.000Z", "forecasts": [{"forecast": "000", "value": 0.24, "timestamp": "2023-05-09T23:50:00.000000Z"}, {"forecast": "005", "value": 0.12, "timestamp": "2023-05-09T23:55:00.000000Z"}, {"forecast": "010", "value": 0.12, "timestamp": "2023-05-10T00:00:00.000000Z"}, {"forecast": "015", "value": 0.0, "timestamp": "2023-05-10T00:05:00.000000Z"}, {"forecast": "020", "value": 0.0, "timestamp": "2023-05-10T00:10:00.000000Z"}, {"forecast": "025", "value": 0.12, "timestamp": "2023-05-10T00:15:00.000000Z"}, {"forecast": "030", "value": 0.12, "timestamp": "2023-05-10T00:20:00.000000Z"}, {"forecast": "035", "value": 0.12, "timestamp": "2023-05-10T00:25:00.000000Z"}, {"forecast": "040", "value": 0.24, "timestamp": "2023-05-10T00:30:00.000000Z"}, {"forecast": "045", "value": 0.24, "timestamp": "2023-05-10T00:35:00.000000Z"}, {"forecast": "050", "value": 0.0, "timestamp": "2023-05-10T00:40:00.000000Z"}, {"forecast": "055", "value": 0.12, "timestamp": "2023-05-10T00:45:00.000000Z"}, {"forecast": "060", "value": 0.0, "timestamp": "2023-05-10T00:50:00.000000Z"}, {"forecast": "065", "value": 0.0, "timestamp": "2023-05-10T00:55:00.000000Z"}, {"forecast": "070", "value": 0.12, "timestamp": "2023-05-10T01:00:00.000000Z"}, {"forecast": "075", "value": 0.24, "timestamp": "2023-05-10T01:05:00.000000Z"}, {"forecast": "080", "value": 0.24, "timestamp": "2023-05-10T01:10:00.000000Z"}, {"forecast": "085", "value": 0.12, "timestamp": "2023-05-10T01:15:00.000000Z"}, {"forecast": "090", "value": 0.0, "timestamp": "2023-05-10T01:20:00.000000Z"}, {"forecast": "095", "value": 0.0, "timestamp": "2023-05-10T01:25:00.000000Z"}, {"forecast": "100", "value": 0.0, "timestamp": "2023-05-10T01:30:00.000000Z"}, {"forecast": "105", "value": 0.0, "timestamp": "2023-05-10T01:35:00.000000Z"}, {"forecast": "110", "value": 0.0, "timestamp": "2023-05-10T01:40:00.000000Z"}, {"forecast": "115", "value": 0.0, "timestamp": "2023-05-10T01:45:00.000000Z"}, {"forecast": "120", "value": 0.0, "timestamp": "2023-05-10T01:50:00.000000Z"}]} %}

dwd: 

{%- for fiveminutes in data.forecasts %}
{%- if loop.index > 24 %}{{""}}
{%- else %}
{%- set rainintensity = fiveminutes.value %}
{%- if rainintensity < 0.1 %}{{"▁"}}
{%- elif 0.1 <= rainintensity < 0.5 %}{{"▂"}}
{%- elif 0.5 <= rainintensity < 1 %}{{"▃"}}
{%- elif 1 <= rainintensity < 1.5 %}{{"▄"}}
{%- elif 1.5 <= rainintensity < 2 %}{{"▅"}}
{%- elif 2 <= rainintensity < 3.5 %}{{"▆"}}
{%- elif 3.5 <= rainintensity < 5 %}{{"▇"}}
{%- elif 5 <= rainintensity < 10 %}{{"█"}}
{%- else %}{{"▓"}}
{%- endif %}
{%- endif %}
{%- endfor %}

dwd → 8: 
{%- set raindata = namespace(list=[]) -%}
{%- for n in data.forecasts -%}
{%- set raindata.list = raindata.list + [n.value] %}
{%- endfor -%}
{%- for fiveminutes in raindata.list|batch(3) %}


{%- if loop.index > 8 %}{{""}}
{%- else %}
{%- set rainintensity = fiveminutes|max|float %}
{%- if rainintensity < 0.1 %}{{"▁"}}
{%- elif 0.1 <= rainintensity < 0.5 %}{{"▂"}}
{%- elif 0.5 <= rainintensity < 1 %}{{"▃"}}
{%- elif 1 <= rainintensity < 1.5 %}{{"▄"}}
{%- elif 1.5 <= rainintensity < 2 %}{{"▅"}}
{%- elif 2 <= rainintensity < 3.5 %}{{"▆"}}
{%- elif 3.5 <= rainintensity < 5 %}{{"▇"}}
{%- elif 5 <= rainintensity < 10 %}{{"█"}}
{%- else %}{{"▓"}}
{%- endif %}
{%- endif %}
{%- endfor %}
image i guess adding the `dwd_utils` library to get radolan data into this custom component shouldn’t be too hard, though my coding skills are really limited and i wouldn’t be of much help. however, if anyone is interested i can share the code of the command line sensor stuff i built so far (and which i am still testing).

I am using OpenWeatherMaps for months now and am located in Germany. Data is very accurate and similar what DWD is returning (sometimes same) so I don't see a reason why using some custom complicated and not reliable solutions.

@diplix
Copy link
Contributor

diplix commented May 10, 2023

I am using OpenWeatherMaps for months now and am located in Germany

i know, that’s what you wrote above and it’s great if you are happy with the OWM forceasts. however the radolan/radar forecasts from DWD are very precise (24 data points for 2 hour forecast) and according to my observations very reliable, so i use the DWD radolan forecasts in addition to rain forecasts from OWM, this components DWD mosmix data and also forecasts from weatherkit.

OWM claims to also use radar data for their forecasts

We collect and process weather data from different sources such as global and local weather models, satellites, radars and a vast network of weather stations

but according to my observation the OWM forecasts lack precision and reliability (i live in berlin) this might well differ from region to region. same with the mosmix forecasts from DWD and weatherkit that seem to be purely model based and deliver more or less accurate estimates with lots of false positives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants