Author Topic: ec-radar.php V2.04 released  (Read 157 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7381
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
ec-radar.php V2.04 released
« on: April 17, 2019, 02:02:58 PM »
I was noticing a lot of error_log entries due to queries for non-existent radar sites with ec-radar.php, so I've updated the script to include the 'allowed' list of Environment Canada siteids that the script can use.  It returns a 'invalid site' message if the site selected is not in the known list.  Also, some improvements in the fetching of the overlay data.

Standalone: download from the script page

Saratoga template users, use the update tool with a query of Base-Canada, Plugin-*, 17-Apr-2019

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

Offline PaulMy

  • Forecaster
  • *****
  • Posts: 4483
    • KomokaWeather
Re: ec-radar.php V2.04 released
« Reply #1 on: April 17, 2019, 05:49:52 PM »
Hi Ken,
I have updated and radar appears to display correct www.komokaweather.ca
but have noticed a lot of errors in that folder.  I deleted the error file and now getting these:
Quote
[17-Apr-2019 17:25:54 America/Toronto] PHP Notice:  Undefined offset: 1 in /home/psoykkrhjuz3/public_html/komokaweather-ca/ajax-dashboard.php on line 1189
[17-Apr-2019 17:25:54 America/Toronto] PHP Notice:  Undefined offset: 2 in /home/psoykkrhjuz3/public_html/komokaweather-ca/ajax-dashboard.php on line 1190
[17-Apr-2019 17:25:54 America/Toronto] PHP Notice:  Undefined offset: 3 in /home/psoykkrhjuz3/public_html/komokaweather-ca/ajax-dashboard.php on line 1191
[17-Apr-2019 17:25:54 America/Toronto] PHP Notice:  Undefined offset: 1 in /home/psoykkrhjuz3/public_html/komokaweather-ca/ajax-dashboard.php on line 1189
[17-Apr-2019 17:25:54 America/Toronto] PHP Notice:  Undefined offset: 2 in /home/psoykkrhjuz3/public_html/komokaweather-ca/ajax-dashboard.php on line 1190
[17-Apr-2019 17:25:54 America/Toronto] PHP Notice:  Undefined offset: 3 in /home/psoykkrhjuz3/public_html/komokaweather-ca/ajax-dashboard.php on line 1191
[17-Apr-2019 17:25:57 America/Toronto] PHP Notice:  Undefined variable: radarDir in /home/psoykkrhjuz3/public_html/komokaweather-ca/index.php on line 139
[17-Apr-2019 17:25:57 America/Toronto] PHP Notice:  Undefined index: site in /home/psoykkrhjuz3/public_html/komokaweather-ca/index.php on line 139
[17-Apr-2019 17:25:57 America/Toronto] PHP Warning:  include_once(BOmaps/cache/BONorthAmerica-map.html): failed to open stream: No such file or directory in /home/psoykkrhjuz3/public_html/komokaweather-ca/index.php on line 198
[17-Apr-2019 17:25:57 America/Toronto] PHP Warning:  include_once(): Failed opening 'BOmaps/cache/BONorthAmerica-map.html' for inclusion (include_path='.:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php') in /home/psoykkrhjuz3/public_html/komokaweather-ca/index.php on line 198

The following is lines 1184 to 1191 of ajax-dashboard.php
Quote
function moonphase ($WDmoonage) {
  preg_match_all('|(\d+)|is',$WDmoonage,$matches);
//  print "<!-- matches=\n" . print_r($matches,true) . "-->\n";
  $mdays = $matches[1][0];
  $mhours = $matches[1][1];
  $mmins = $matches[1][2];
  $mpct  = $matches[1][3];

index.php line 139 is
Quote
<img src="<?php echo $radarDir . 'radar-' . $_REQUEST['site'] . '-0.png'; ?>"
and line 198 is
Quote
<?php include_once("BOmaps/cache/BONorthAmerica-map.html"); ?>
The BOmaps seem to display and current on the homepage www.komokaweather.ca

Could the radar issue be related to the ec-radar.php update or just coincidental with the BOmaps issue?

Thanks,
Paul
Davis Vantage Pro 2 Plus 24-FARS Wireless
Envoy/USB DataLogger/Cumulus v.1.9.4   -   Vue Console/WiFiLogger/CumulusMX
Komoka, ON  Canada
www.komokaweather.ca   www.komokaweather.com   www.komokaweather.com/weather28/  
www.komokaweather.com/pws/index.php
Blitzortung Station #1076 www.lightningmaps.org/blitzortung7/america/index.php?bo_page=statistics&bo_show=network&lang=en&bo_station_id=969


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7381
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: ec-radar.php V2.04 released
« Reply #2 on: April 17, 2019, 06:25:18 PM »
Hmmm... an update to ec-radar.php would not cause/influence any of the above errata AFAIK.

You're using Cumulus on your site, so the moonage stuff should come from the routines in common.php and get-USNO-sunmoon-inc.php

The moon display is showing 'New Moon (Moon at 12 days in cycle) 95% Illuminated' but really should say 'Waxing Gibbous (Moon at 13 days in cycle) 97% Illuminated'.  The view-source of your index page shows
Quote
<!-- get-USNO-sunmoon.php - Version 3.02 - 23-Nov-2018 -->
<!-- refetch seconds=3600 -->
<!-- using Cached version of ./cache/USNO-moondata.txt -->
<!-- processing JSON entries for Moon data -->
<!-- json_decode returns  - No errors -->
<!-- USNOdata
Array
(
    [beginciviltwilight] => 06:12
    [beginciviltwilightdate] => 17/04/2019
    [sunrise] => 06:41
    [sunrisedate] => 17/04/2019
    [suntransit] => 13:25
    [suntransitdate] => 17/04/2019
    [sunset] => 20:10
    [sunsetdate] => 17/04/2019
    [endciviltwilight] => 20:40
    [endciviltwilightdate] => 17/04/2019
    [moonset] => 06:05
    [moonsetdate] => 17/04/2019
    [moonrise] => 18:09
    [moonrisedate] => 17/04/2019
    [moonriseprior] => 16:54
    [moonrisepriordate] => 16/04/2019
    [moontransitprior] => 23:35
    [moontransitpriordate] => 16/04/2019
    [moonphase] => Waxing Gibbous
    [illumination] => 95%
    [hoursofpossibledaylight] => 13:29
    [databy] => USNO
)
 -->
so I don't know where the 'Full Moon' comes from.  Nevertheless, the PHP moonphase() function is intended to parse a WD-style $moonphase variable, not something from Cumulus ?!?

Regarding the ec-radar link in the <img> statement, in the stock wxindex.php there is
Code: [Select]
<?php 
// fetch fresh national radar image if needed .. you can chang it to
// 'NAT' = National radar view
// 'PAC' = Pacific region
// 'WRN' = Praries region
// 'ONT' = Ontario
// 'QUE' = Quebec
// 'ERN' = Atlantic region
  $_REQUEST['site'] = 'NAT'// one of the sites above, or your radar designator
  $doPrint false;
  include_once("ec-radar.php");
?>

<img src="<?php echo $radarDir 'radar-' $_REQUEST['site'] . '-0.png'?>"
alt="Radar, courtesy of Environment Canada"
title="Radar, courtesy of Environment Canada" />
to ensure that $_REQUEST['site'] is set before the img statement.

For the BOmaps issue, your map is really at http://www.komokaweather.com/BOmaps/cache/BONorthAmerica-ani.gif so the map file would be at http://www.komokaweather.com/BOmaps/cache/BONorthAmerica-map.html
Since the site is really at http://www.komokaweather.com/komokaweather-ca/, I think the include statement should read as
Code: [Select]
<?php include_once("../BOmaps/cache/BONorthAmerica-map.html"); ?> to have it work correctly.

Whew...



 
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 PaulMy

  • Forecaster
  • *****
  • Posts: 4483
    • KomokaWeather
Re: ec-radar.php V2.04 released
« Reply #3 on: April 17, 2019, 06:59:42 PM »
Thanks Ken,
The path change has stopped that BOmap error message.  And the Undefined variable and index: radarDir notice has also disappeared by itself.

Enjoy,
Paul

Davis Vantage Pro 2 Plus 24-FARS Wireless
Envoy/USB DataLogger/Cumulus v.1.9.4   -   Vue Console/WiFiLogger/CumulusMX
Komoka, ON  Canada
www.komokaweather.ca   www.komokaweather.com   www.komokaweather.com/weather28/  
www.komokaweather.com/pws/index.php
Blitzortung Station #1076 www.lightningmaps.org/blitzortung7/america/index.php?bo_page=statistics&bo_show=network&lang=en&bo_station_id=969


 

anything