Author Topic: Saratoga Base-USA updated Radar scripts  (Read 215 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7808
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Saratoga Base-USA updated Radar scripts
« on: May 22, 2020, 04:00:20 PM »
Thanks to some feedback from lddaly, the WU-radar-inc.php (V1.14) was updated to remove all the 'dead' WeatherUnderground additional maps and just retain the ones that are still working.  This script is among the oldest as a port from Tom's script back in January, 2008.  Since WU seems bent on discontinuing much of the old WU functionality, I think using WU for radar/maps will likely be deprecated in the future.

Based on that, I asked Jerry Wilkins (https://www.gwwilkins.org/) if he'd mind if his wxusradar-hanis3 scripts could be added to Base-USA and he graciously allowed it .. a big thanks to Jerry for allowing his code to be shared in the template set.

I did a bit of renaming, so the functionality is now in the wxnwsradar*.php set of scripts added 22-May-2020.  They use the images from the NWS radar site (http://radar.weather.gov/) and animation by HAnIS (https://www.ssec.wisc.edu/hanis/index.html) for all USA/territories radar.  If you are currently using the WU-radar-inc.php with setup in Settings.php, the scripts can just be installed--the config is already done.

Note that this update includes a flyout-menu.xml update to add a link for the wxnwsradar.php page, so I suggest you NOT replace your current copy, but just add the link in your existing copy as you like.  The update to WU-radar-inc.php may require you to do a reconfiguration using WU-radar-testpage.php if you haven't installed all the settings in Settings.php

Update via the update tool with a query 22-May-2020, Base-USA, Plugin-*

 
« Last Edit: May 22, 2020, 04:11:50 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Online gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2298
    • SouthEast Lincoln, NE Weather
Re: Saratoga Base-USA updated Radar scripts
« Reply #1 on: May 23, 2020, 09:45:37 AM »
Ken's coding skills never cease to amaze me!  In short order he was able to get inside this convoluted script set, see how it worked, and modify it to fit the template set, all the while improving it.

The only thing he omitted from his post is a link to the script on his site. :grin:

Thanks, Ken, for your usual stellar work! [tup]
« Last Edit: May 23, 2020, 09:49:58 AM by gwwilk »
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline Otis

  • (aka Paul)
  • Forecaster
  • *****
  • Posts: 613
    • Lake Huron Weather
Re: Saratoga Base-USA updated Radar scripts
« Reply #2 on: May 23, 2020, 12:42:16 PM »
Ken's coding skills never cease to amaze me! 
  Agreed  [tup]

Davis Vantage Pro2, Serial Data Logger,
WD 10.37S-(b60), VWS V15.00p03, Weatherlink 6.0.3,  Fling 2.35, Broadwave 2.0, Win 7 Pro 64Bit
KMICHEBO10 - CW3699 - Cheboygan, MI

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7808
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Base-USA updated Radar scripts
« Reply #3 on: May 23, 2020, 01:41:29 PM »
You're too modest, Jerry -- the real credit goes to you for generating the original (and highly creative script set).  I went through with a bit of refactoring and some code simplification to make it easier to support in the future.  To help folks understand just how creative your code was, let me describe the overall architecture of the script set and how it works to create an interactive page without requiring the usual 'submit' to change values on the page.

The page has 3 PHP scripts and uses two JavaScripts (jQuery and HAnIS) to make the magic happen.
1) the wxnwsradar.php page sets the parameters in PHP for the other scripts, loads the usual Saratoga framework and the wxnwsradar-inc.php workhorse script.
2) the wxnwsradar-inc.php script generates the HTML for the selection controls and sets up the overall jQuery functions to respond to changes in the selection controls.  It also prints the PHP variables into inline JavaScript variables in the generated jQuery trigger functions.  It then uses jQuery to invoke wxnwsradar-iframe.php to do the heavy lifting.
3) the wxnwsradar-iframe.php uses the JavaScript variables above to then read radar.weather.gov for the specific available radar image filenames and overlay filenames, creates a HAnIs control text, and invokes the HAniS.setup() function with the control text to display the full radar+controls in the <iframe>.

Each change of a selection control (wxnwsradar-inc.php) causes jQuery to repeat the (2) and (3) so the page display is dynamically updated without a <form> or "submit" being done.  Very clever.

To help with future support, I'd developed a small page-scrape script for the homepage of radar.weather.gov to extract the currently available radar sites (id and state/location), and sort that array.
That array is shown at the bottom of wxnwsradar-inc.php and is used to dynamically create the radar selector list (previously that was a static HTML <select> list).
I'd also changed the names of the three PHP scripts to avoid interference with Jerry's script names and use the hanis_min.js from the same directory (instead of a subdirectory).

Hope you find the above helpful to understand the underpinning of the script set, and to see how innovative Jerry was to use this to create a dynamic page that doesn't need 'submit' for interaction.  Bravo Jerry!   =D&gt;  =D&gt;  =D&gt;

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Online gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2298
    • SouthEast Lincoln, NE Weather
Re: Saratoga Base-USA updated Radar scripts
« Reply #4 on: May 24, 2020, 11:10:24 AM »
Truth be told, necessity is the mother of invention.  When you have a website as bloated as mine, re-loading an entire page just to display a small change seemed wasteful of bandwidth.  So when faced with this issue I looked for potential solutions to this problem, and jQuery's 'load()' method turned out to be the answer.

I cut my teeth on my GRLevel3 Radar script set and developed the basic architecture there.  I also used it to create my GOES-16 and GOES-17 satellite scripts.

Needless to say, none of this would have been possible without Tom Whittaker's incredible HAniS (HTML Animation Script) javaScript for the display of the images and controls.
Regards, Jerry Wilkins
gwwilk@gmail.com

 

anything