stucka / weathersky

Post urgent National Weather Service watches and warnings to Bluesky
MIT License
1 stars 0 forks source link

Improving tornado alerts with visuals #2

Open stucka opened 1 month ago

stucka commented 1 month ago

Visuals would help. @fishcharlie in https://github.com/fishcharlie/AirportStatusBot has shown a way to get near-real-time weather radar dropped atop a features map. That might be worth pursuing, with the additional layer of the warning itself from the NWS geo field, which may not always be present. Need to figure out easy, FAST, low-memory ways to calculate centroids or bounding boxes or whatever to properly focus on the correct area. This could require async efforts and and multithreading on the existing server is probably not going to work well.

As with the nwstornado feed on Twitter, could include some text with hail, how it was detected, etc. Sometimes there's a community list that could be more helpful.

Also need to build alt text.

fishcharlie commented 1 month ago

Let me know if you have any questions about how I did this!

Also need to build alt text

Really curious what you come up with here. Or even just what you are thinking about.

I was working on this recently. It's not an easy problem to solve (at least if you want the alt text to be high quality and descriptive).

I basically took an image of just the weather radar layer, and for each pixel took the color and converted that into the intensity at that point. Then I grouped the intensities together into different categories (extremely light, very light, light, moderate, heavy & extremely heavy). From there, I grouped them into directions from the center point (north, south, east, west). Then if the direction has > 95% of the pixels being transparent (ie. no reflectivity), I discard it. The remaining directions I get the highest intensity category from earlier, and build the alt text based on that. It doesn't really work the best tho.

I restarted the bot since the last image was posted. But once another image is posted I can show you an example of what alt text is generated. Right now it's only getting logged out on my server and not posted since I don't think alt text is very high quality.

I'm kinda considering trying to convert the pixel data into a GeoJSON object with polygons, and trying to analyze regions or entire storm cells as opposed to just doing it based on direction.

I think also I might need to write some alt text manually for some of these images and try to work backwards from there.

stucka commented 1 month ago

Alt-text wise, I'm not sure. The Twitter presentation (tornado indicated by radar, no hail expected) has text beside the map that should definitely go in the alt-text; hail and method of detection both seem likely to be present most or all of the time in a structured format.

There are some things in the bodies of at least some of the alerts that I might be able to split off with some reliability that should probably go in the alt text as sort of a map description by proxy, e.g. at least some of the time there's text like this included within a larger blob:

Locations impacted include...\nHilton Head Island, Bluffton, Rose Hill, Pritchardville, Sun City,\nCalawassie Island, Palmetto Bluff, Myrtle Island and Brighton\nBeach.

I can probably make a decent run at sampling that and now have a corpus of about 200 tornado warnings to work against, at least. That seems like an ideal description of the map itself, if I can pull it off.

////

On your airport stuff -- do you have any data showing the general path of the storm, and to what extent would that be relevant? Like, if the storm is headed northeast than it seems like you might want to focus on the weather pattern to the southwest because it's approaching. Or maybe you don't, because low-level stuff might be off-axis but still affecting flight operations. I don't know.

fishcharlie commented 1 month ago

On your airport stuff -- do you have any data showing the general path of the storm, and to what extent would that be relevant?

I don't. I'm not getting any direct weather data beyond png tile images. I mean I could try to get them overtime and do some type of difference algorithm. Or use some other weather service. But not doing that now.

stucka commented 1 month ago

Maybe see if you can extract some basic stuff off the METAR? Just say, hey, thunderstorm reported, 3 mile visibility, clouds at 5,000 feet, winds at 23mph? It wouldn't quite describe the image, but it's trying to describe the reality the image is trying to describe, if that makes any sense ...

Not sure if there's an official API, but appending the airport abbreviation here seems to work:

https://aviationweather.gov/cgi-bin/data/metar.php?hours=0&order=id%2C-obs&sep=true&ids=

e.g.,

https://aviationweather.gov/cgi-bin/data/metar.php?hours=0&order=id%2C-obs&sep=true&ids=KDEN