Updated US blocks (nwsForecast, radarUS, warningsUSRegions) - PHP 8 compatibility, improved functionality
Posted: Mon Oct 13, 2025 8:40 pm
Some time back, I moved my web server to a different platform, and I finally got around to getting Meteotemplate 19.0 running on the new system. And when I did, well, it looked like the blocks that depend on the US National Weather Service hadn't seen any love for quite some time (the most recent update I saw was 2018).
I'm not a coder, nor do I play one on the Internet, but I know a little PHP, and ChatGPT was quite helpful here. So I've largely rewritten a few of the blocks; more may come with time.
nwsForecast
My first project was the nwsForecast block. Rather than scraping HTML, it now gets its data from the NWS API. It shows the full seven-day forecast, both in the summary view (where the old block showed fewer periods) and the detail view. The icons now show up for me, which was the problem that launched me into this project in the first place.
radarUS
I then turned my attention to radarUS. It depended on the NWS RIDGE radar system, which NWS decommissioned (or at least deprecated) in 2020, replacing it with RIDGE-II. At the same time, it seems that many of the radar products went away. The new block successfully pulls radar images for the available products that I've been able to find.
warningsUSRegions
As with nwsForecast, warningsUSRegions has been rewritten to use the NWS API. It now accepts locations as lat/long pairs, rather than the zone codes (e.g., NYZ123) that were previously required. The detail pop-up for the warning is now inline rather than in a separate window.
Compatibility
I'm running PHP 8.3.19, and these blocks work for me. phpcodechecker.org reports no errors for any of these blocks under PHP 7.4, but I haven't tested them there. It shouldn't affect anything, but I serve my site via HTTPS, and they work there.
The Future
I'm not sure how many more of these I'll do--probably the multiple forecast one at least. I may get around to modifying the warningsUSRegions block to disappear entirely unless there are active alerts.
Where to find them
The most up-to-date blocks will be at my GitHub repo:
https://github.com/danb35/MTBlocks
That's also the best place to raise issues with them, suggest improvements, and/or contribute improvements. I hope these are helpful.
I'm not a coder, nor do I play one on the Internet, but I know a little PHP, and ChatGPT was quite helpful here. So I've largely rewritten a few of the blocks; more may come with time.
nwsForecast
My first project was the nwsForecast block. Rather than scraping HTML, it now gets its data from the NWS API. It shows the full seven-day forecast, both in the summary view (where the old block showed fewer periods) and the detail view. The icons now show up for me, which was the problem that launched me into this project in the first place.
radarUS
I then turned my attention to radarUS. It depended on the NWS RIDGE radar system, which NWS decommissioned (or at least deprecated) in 2020, replacing it with RIDGE-II. At the same time, it seems that many of the radar products went away. The new block successfully pulls radar images for the available products that I've been able to find.
warningsUSRegions
As with nwsForecast, warningsUSRegions has been rewritten to use the NWS API. It now accepts locations as lat/long pairs, rather than the zone codes (e.g., NYZ123) that were previously required. The detail pop-up for the warning is now inline rather than in a separate window.
Compatibility
I'm running PHP 8.3.19, and these blocks work for me. phpcodechecker.org reports no errors for any of these blocks under PHP 7.4, but I haven't tested them there. It shouldn't affect anything, but I serve my site via HTTPS, and they work there.
The Future
I'm not sure how many more of these I'll do--probably the multiple forecast one at least. I may get around to modifying the warningsUSRegions block to disappear entirely unless there are active alerts.
Where to find them
The most up-to-date blocks will be at my GitHub repo:
https://github.com/danb35/MTBlocks
That's also the best place to raise issues with them, suggest improvements, and/or contribute improvements. I hope these are helpful.