Updated US blocks (nwsForecast, radarUS, warningsUSRegions) - PHP 8 compatibility, improved functionality

Post Reply
danb35
Observer
Observer
Posts: 20
Joined: Sat Jan 20, 2018 4:14 pm
Station model: Davis Pro 2
Software: WeeWX

Updated US blocks (nwsForecast, radarUS, warningsUSRegions) - PHP 8 compatibility, improved functionality

Post by danb35 » 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.
Last edited by danb35 on Mon Oct 20, 2025 10:48 am, edited 1 time in total.

rogers
Observer
Observer
Posts: 15
Joined: Sun Aug 20, 2017 8:10 pm
Location: Lindale, GA USA
Contact:

Re: Updated US blocks

Post by rogers » Sun Oct 19, 2025 10:23 am

Thank you, greatly appreciated.

User avatar
MonyMony
Forecaster
Forecaster
Posts: 192
Joined: Sun Aug 20, 2017 12:54 pm
Location: Elkton, Maryland, US
Station model: Davis Pro 2
Software: WeatherCat/Meteobridge
Contact:

Re: Updated US blocks (nwsForecast, radarUS, warningsUSRegions) - PHP 8 compatibility, improved functionality

Post by MonyMony » Wed Dec 10, 2025 3:38 pm

Thank you!

I’ve done very little to update my site lately other than making sure it keeps running, but want to do some changes in 2026. These updates will certainly help and are very much appreciated.
Image

User avatar
BobW55
Forecaster
Forecaster
Posts: 115
Joined: Thu Sep 28, 2017 11:43 pm
Location: Michigan USA
Station model: Davis Pro2
Software: Cumulus
Contact:

Re: Updated US blocks (nwsForecast, radarUS, warningsUSRegions) - PHP 8 compatibility, improved functionality

Post by BobW55 » Tue Dec 30, 2025 8:57 pm

You sir are a genius......
I have been playing with thiis off and on since the NWS shut down the old radar maps.

THANK YOU
http://melvinweather.com/template/indexDesktop.php
Davis Vantage Pro2 wired
Solar/UV sensors
Sky Cam
Ham radio K8pos

User avatar
Sperry Russ
Observer
Observer
Posts: 18
Joined: Sun Aug 20, 2017 1:07 pm
Location: Florida
Station model: Davis Pro 2 Cabled
Software: CumulusMX V. 3
Contact:

Re: Updated US blocks (nwsForecast, radarUS, warningsUSRegions) - PHP 8 compatibility, improved functionality

Post by Sperry Russ » Fri Feb 06, 2026 4:13 am

Thanks for your work on this. I have been trying to figure out how to get these blocks working again. I installed all 3 of them. One of them is not working right. I placed details of the problem on your Github page.

Post Reply