You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As requested in the "map home marker" issue, I will explain my approach to rain prediction via radar map in this feature request. As I mentioned in the other issue, my approach is quite hacky and may not be what you are looking for. Nevertheless I'll explain it here as it has been working for me fine so far.
First of all, thanks for implementing a fix for the marker issue so quickly. Greatly appreciated!
A disclaimer to the issue regarding rain prediction: I've managed to get the prediction working for me. My use case is specialized, meaning my approach will not work for general predictions out of the box. But I suppose it could be enhanced to that end. My use case is: I want my electric roof windows to close when rain is approaching (meaning they need to be closed before it starts raining. Also it's fine for my use case if the windows close a couple of minutes before that). The windows can the opened again when the rain is over, or a couple of minutes after that. Again, for my use case, I don't need high precision, I just want to be on the safe side regarding rain.
A note about the different radar maps available: I noticed that all the different maps seem to be off regarding aspect ratio. Especially the local ones with higher "zoom" levels. That makes calculating distances inaccurate. That is why I decided to only use the "all of Germany" map, as that one seemed somewhat less off with the aspect ratio. Also it has an easy to use white background. A satellite image will not work for this approach.
An assumption I made is that the relative map coordinates for a given location are always the same (I don't know if that assumption is correct though).
I'm working with screenshots of the HomeAssistant camera for rain radar evaluation. I have set the radar image to only show the very last image. Otherwise I cannot guarantee that my screenshots are in the correct order. (I don't want to use character recognition on the timestamps. That would be overkill.)
Most of the time, the resolution of the camera picture is constant, but sometimes the screenshot is way smaller and sometimes it is way bigger. That is why I decided to work with a normalized coordinate system (0 -1). I referenced two easy to find points on the german border in opposite corners. Then I used the pixel coordinates and lat lon coordinates to create a mapping function from lat lon to the normalized coordinate system. That way I can calculate at which pixel my home is, no matter the size of the screenshot.
So now I have the pixel that I need to check the color of. But unfortunately, if that pixel shows rain, it is already raining at my location. I need to know beforehand! That is why I check the next pixels all around my location. The radius of my check depends on the desired distance (let's say 5km). That radius can be converted into pixels around my location. I check those pixels and get a more conservative metric. Exactly what I'm looking for with my windows!
There are a couple of improvements that come to my mind immediately:
Image aspect ratio of 1 (distance calculation in north-south and east-west direction could be improved)
Currently I'm looking at every direction around my location. This could be narrowed down by using the ground wind direction (+30 degrees for approximation of the wind direction in 1000m above ground) and checking the pixels along that direction or inside a sector in that direction.
Crazy idea: since you probably have access to the images of the radar video in the correct order, you could use more than just one image for prediction: Loop over all images and note the closest distance to rain for each time. Do a quadratic curve fitting and make a time prediction by finding the zero crossing if one exists.
If you are interested in the code (about 100 lines) or if you have any further questions, let me know. Feel free to ignore/delete this feature request, if it doesn't meet your requirements.
Cheers
The text was updated successfully, but these errors were encountered:
As requested in the "map home marker" issue, I will explain my approach to rain prediction via radar map in this feature request. As I mentioned in the other issue, my approach is quite hacky and may not be what you are looking for. Nevertheless I'll explain it here as it has been working for me fine so far.
First of all, thanks for implementing a fix for the marker issue so quickly. Greatly appreciated!
A disclaimer to the issue regarding rain prediction: I've managed to get the prediction working for me. My use case is specialized, meaning my approach will not work for general predictions out of the box. But I suppose it could be enhanced to that end. My use case is: I want my electric roof windows to close when rain is approaching (meaning they need to be closed before it starts raining. Also it's fine for my use case if the windows close a couple of minutes before that). The windows can the opened again when the rain is over, or a couple of minutes after that. Again, for my use case, I don't need high precision, I just want to be on the safe side regarding rain.
A note about the different radar maps available: I noticed that all the different maps seem to be off regarding aspect ratio. Especially the local ones with higher "zoom" levels. That makes calculating distances inaccurate. That is why I decided to only use the "all of Germany" map, as that one seemed somewhat less off with the aspect ratio. Also it has an easy to use white background. A satellite image will not work for this approach.
An assumption I made is that the relative map coordinates for a given location are always the same (I don't know if that assumption is correct though).
I'm working with screenshots of the HomeAssistant camera for rain radar evaluation. I have set the radar image to only show the very last image. Otherwise I cannot guarantee that my screenshots are in the correct order. (I don't want to use character recognition on the timestamps. That would be overkill.)
Most of the time, the resolution of the camera picture is constant, but sometimes the screenshot is way smaller and sometimes it is way bigger. That is why I decided to work with a normalized coordinate system (0 -1). I referenced two easy to find points on the german border in opposite corners. Then I used the pixel coordinates and lat lon coordinates to create a mapping function from lat lon to the normalized coordinate system. That way I can calculate at which pixel my home is, no matter the size of the screenshot.
So now I have the pixel that I need to check the color of. But unfortunately, if that pixel shows rain, it is already raining at my location. I need to know beforehand! That is why I check the next pixels all around my location. The radius of my check depends on the desired distance (let's say 5km). That radius can be converted into pixels around my location. I check those pixels and get a more conservative metric. Exactly what I'm looking for with my windows!
There are a couple of improvements that come to my mind immediately:
If you are interested in the code (about 100 lines) or if you have any further questions, let me know. Feel free to ignore/delete this feature request, if it doesn't meet your requirements.
Cheers
The text was updated successfully, but these errors were encountered: