Author Topic: Saratoga Base-USA update-add animated GIF regional radar  (Read 695 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8386
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Saratoga Base-USA update-add animated GIF regional radar
« on: January 06, 2021, 03:08:12 PM »
I found that https://aviationweather.gov/radar offered regional radar images similar to the ones that were available on radar.weather.gov before their 'makeover' in December, 2020.  I've created a new script (NWS-regional-radar-animate.php) to fetch/annotate/cache the selected image set and create an animated GIF.  Since the regions now used are somewhat different than the old region graphics used on radar.weather.gov, some other mods were made to USA-regional-maps-inc.php to support new region designations if needed.

Note that NWS-regional-radar-animate.php DOES NOT load Settings.php (to improve speed with some Plugins), so when you install,
be sure to check the internal settings to match your current site settings.. especially cache file directory and timezone.

At the same time, I've decided to deprecate (and mark for removal) the HAniS based wxnwsradar-*.php scripts as they no longer have source data to work with on radar.weather.gov.  A V2.00 of wxnwsradar.php will just display your selected regional radar GIF and a USA (CONUS) animated GIF.

The README file has additional details, and there's a PDF showing the old and new 'regions' for the NWS regional radars.

Update using the update tool with query Base-USA, Plugin-*, 06-Jan-2021
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

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2224
    • http://www.cnyweather.com
Re: Saratoga Base-USA update-add animated GIF regional radar
« Reply #1 on: January 06, 2021, 03:15:41 PM »
Hey Ken.

Trying to get the regional radar the image is blank and I get this on the end of the URL with the region blank.

.........../NWS-regional-radar-animate.php?region=

Here's my region settings:

Code: [Select]
$NWSregion = 'alb'; // see below $validRegions entries for valid regions to use
# Note: 2 letter old $NWSregion regions will be translated to 3 letter regions
#
# 'ak', 'hi', 'carib' sites are not displaying data on aviationweather.gov site
#
# Select radar type:
$NWStype = 'cref';  // ='rala' for 'Reference at low altitude'
#                   // ='cref' for 'Composite Reflectivity'
#                   // ='tops-18' for 'Echo Tops - 18dbz'
Tony




Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8386
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Base-USA update-add animated GIF regional radar
« Reply #2 on: January 06, 2021, 03:19:36 PM »
Do you have in Settings.php
Code: [Select]
$SITE['NWSregion'] = 'alb'; .. if not, add that setting.

The USA-regional-maps-inc.php script will honor the $SITE['NWSregion'] setting.
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

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2224
    • http://www.cnyweather.com
Re: Saratoga Base-USA update-add animated GIF regional radar
« Reply #3 on: January 06, 2021, 03:25:44 PM »
I didnt have $SITE['NWSregion'] in my settings. Added it and all set. THANK YOU!
Tony




Online gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2436
    • SouthEast Lincoln, NE Weather
Re: Saratoga Base-USA update-add animated GIF regional radar
« Reply #4 on: January 06, 2021, 06:56:05 PM »
Thanks, Ken!  Up and running on my website.

Your fine work is very much appreciated, as always. =D> \:D/ =D>
Regards, Jerry Wilkins
gwwilk@gmail.com

Online gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2436
    • SouthEast Lincoln, NE Weather
Re: Saratoga Base-USA update-add animated GIF regional radar
« Reply #5 on: January 07, 2021, 11:23:43 AM »
I've refrained from creating a universal-access script in order to avoid an inordinate number of accesses to the hosting site.  The NOAA/NWS gate-keepers have been known to retaliate...
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8386
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Base-USA update-add animated GIF regional radar
« Reply #6 on: January 07, 2021, 02:36:42 PM »
I've been able to adapt my old national/regional radar page to the new ones that Ken found.
Cannot get animated gifs out of their code but the static images work pretty good for now.
Thanks Ken for the discovery of the images.

http://vermilionweather.com/radarsnationalpage.php
I've refrained from creating a universal-access script in order to avoid an inordinate number of accesses to the hosting site.  The NOAA/NWS gate-keepers have been known to retaliate...
The NWS-regional-radar-animate.php script was intended to be used to provide an animated GIF for display via a <img src=...> for a website.
The cache life of 600 seconds ensures that most accesses to the script will result in the cached GIF being returned.  When a cache expires, it will take 3-5 seconds to load the HTML and 15 images from aviationweather.gov, save the annotated individual GIFs and combine them to make a single animated GIF.  It should not run afoul of future NWS-imposed limits on accesses as it only uses 16 HTTPS queries to produce the animated GIF, and that happens only every 5 minutes.

Jerry's comment is very apt .. we need to be aware that the NWS is going to limit accesses (likely at 60/minute) from a single IP address as that will be done via their load balancer hardware .. they haven't engaged it yet, but are likely to engage it this spring.

So, I'd strongly recommend that you NOT try to create any more than two regional radar animated GIFs on your site using the script.  I did change the wxnwsradar.php script distributed in Base-USA to remove the (now defunct) HAniS animations from radar.weather.gov to use this simple code to display the selected regional radar and a CONUS radar as animated GIFS.

Code: [Select]
<div id="main-copy">
  <div align="center">
  <?php if(file_exists('NWS-regional-radar-animate.php')) { ?>
  <h2 align="center">Regional Radar Loop</h2>
  <img src="NWS-regional-radar-animate.php?region=<?php echo $SITE['NWSregion']; ?>" alt="Regional Radar" width="620"/> 
   
  <h2 align="center">USA (CONUS) Radar Loop</h2>
  <img src="NWS-regional-radar-animate.php?region=us" alt="USA (CONUS) Radar" width="620"/> 
  <?php } else { ?>
  <h2>The NWS Regional Radar Loop displays are not available.</h2>
  <p>The <i>NWS-regional-radar-animate.php</i> script was not found.</p>
  <?php ?>
   
  </div><!-- end align=center -->
</div><!-- end main-copy -->
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

Offline JupiterJoe

  • Contributor
  • ***
  • Posts: 139
  • JupiterWX.com
    • Live Jupiter, FL Weather
Re: Saratoga Base-USA update-add animated GIF regional radar
« Reply #7 on: January 09, 2021, 11:14:34 AM »
Hi Ken,
The script is great, thank you, it works well and looks good.
I had one question. Is there a way to get the image to load after the Ajax starts loading? The site waits to update weather data until after that image loads. Itís no problem now, but I was thinking ahead if there was ever a problem with their site or whatever that it could hang the weather data until after that image loads. I hope this makes sense.
Thank you for any advice!

www.JupiterWX.com

Online gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2436
    • SouthEast Lincoln, NE Weather
Re: Saratoga Base-USA update-add animated GIF regional radar
« Reply #8 on: January 09, 2021, 11:27:51 AM »
Hi Ken,
The script is great, thank you, it works well and looks good.
I had one question. Is there a way to get the image to load after the Ajax starts loading? The site waits to update weather data until after that image loads. Itís no problem now, but I was thinking ahead if there was ever a problem with their site or whatever that it could hang the weather data until after that image loads. I hope this makes sense.
Thank you for any advice!

www.JupiterWX.com
I'll jump in here, Joe.  Your site's testtags.php loads immediately.  What delays a few seconds are the clientraw.txt updates.  I don't think this is a very high price to pay in order to have the regional radar on our dashboards.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8386
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Base-USA update-add animated GIF regional radar
« Reply #9 on: January 09, 2021, 11:50:45 AM »
Hi Joe,
You might want to look at https://developer.mozilla.org/en-US/docs/Web/Performance/How_browsers_work for details about how the page is loaded and rendered in the browser.  One reason for the slower start to display updated weather data is due to the ajaxWDwx3.js AJAX script -- it is very much larger than the stock ajaxWDwx.js script, so takes longer to load/parse/execute (but is required to use the alt ajax-dashboard you are using).   There are several scripts that produce images on the page (and are invoked by <img> statements (the regional radar animation, cloud height, heaven-pie), but the browser loads images (along with CSS files) in parallel, generally 4 concurrent loads at a time.  Rendering of the page starts at the top of the HTML, and each JavaScript encountered has to be loaded/parsed/executed in the order it is seen.  The background CSS and image loads can take place then, but won't be fully 'revealed' until the page is fully processed.

I hope this helps...
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

Offline JupiterJoe

  • Contributor
  • ***
  • Posts: 139
  • JupiterWX.com
    • Live Jupiter, FL Weather
Re: Saratoga Base-USA update-add animated GIF regional radar
« Reply #10 on: January 09, 2021, 12:20:14 PM »
Thank you.
Gwwilk, I wasnít complaining, not even a little. I appreciate the work you do and I donít think itís a high price to pay at all. I was just curious if there was a way to change load order is all.


« Last Edit: January 09, 2021, 12:28:44 PM by JupiterJoe »

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8386
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Base-USA update-add animated GIF regional radar
« Reply #11 on: January 26, 2021, 05:09:39 PM »
I've done a minor update to NWS-regional-radar-animate.php V1.02 to add error messages to the "Not Available" image to help in diagnosing issues.

Also.. looks like the aviationweather.gov site has started producing Hawaii, Alaska and Caribbean 'rala' images on 26-Jan-2021.
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