Author Topic: USNO Sun-Moon problem  (Read 690 times)

0 Members and 1 Guest are viewing this topic.

Offline griffo42

  • Senior Member
  • **
  • Posts: 78
    • Carina Weather
USNO Sun-Moon problem
« on: August 12, 2019, 12:21:07 AM »
Hi all

I am getting these in my error file:

[12-Aug-2019 13:25:19 Australia/Brisbane] PHP Warning:  Invalid argument supplied for foreach() in /home/kstwx197/public_html/get-USNO-sunmoon.php on line 361
[12-Aug-2019 13:25:19 Australia/Brisbane] PHP Warning:  Invalid argument supplied for foreach() in /home/kstwx197/public_html/get-USNO-sunmoon.php on line 372
[12-Aug-2019 13:27:05 Australia/Brisbane] PHP Warning:  Invalid argument supplied for foreach() in /home/kstwx197/public_html/get-USNO-sunmoon.php on line 361
[12-Aug-2019 13:27:05 Australia/Brisbane] PHP Warning:  Invalid argument supplied for foreach() in /home/kstwx197/public_html/get-USNO-sunmoon.php on line 372

I am running the Saratoga Scripts and am running the latest version (Version 3.02 - 23-Nov-2018) of the script referred to above.

Any help will be appreciated to correct this.

Thanks

Keith
https://www.kstwx.net/index.php
Davis VantageVUE  Model #6357
Cumulus v3.2.6-b3062
Saratoga Weather World template Cumulus plugin
Carina Weather, Brisbane.

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 632
    • LexMAWeather
Re: USNO Sun-Moon problem
« Reply #1 on: August 12, 2019, 10:44:57 AM »
Your website URL?

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 632
    • LexMAWeather
Re: USNO Sun-Moon problem
« Reply #2 on: August 12, 2019, 10:48:08 AM »
Note that I'm unable to resolve api.usno.navy.mil, which happens periodically. Not sure why. This is likely the cause of the errors.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 7630
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: USNO Sun-Moon problem
« Reply #3 on: August 17, 2019, 12:41:09 AM »
Failure to resolve api.usno.navy.mil will cause those issues as the data will be missing and so cast those errors.

You can put
Code: [Select]
$SITE['useUSNO'] = false; in your Settings.php to switch get-USNO-sunmoon-inc.php to use internal calculations instead of accessing the USNO site.

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 ConligWX

  • Forecaster
  • *****
  • Posts: 422
  • #conligwx
    • conligwx.org
Re: USNO Sun-Moon problem
« Reply #4 on: August 17, 2019, 06:26:10 AM »
Ken. Since the usno service is up and down frequently could the be some sort of calculation as to then doing an internal calculation if the site doesn't respond after the set amount of time perhaps, rather than have the feature on or off?

Sent from my GM1913 using Tapatalk


Offline tmabell

  • Senior Contributor
  • ****
  • Posts: 292
Re: USNO Sun-Moon problem
« Reply #5 on: August 17, 2019, 08:21:23 AM »
Great idea!  Ken, your thoughts?

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 632
    • LexMAWeather
Re: USNO Sun-Moon problem
« Reply #6 on: August 17, 2019, 08:28:59 AM »
The current structure of the routine is:

Code: [Select]
if ($useUSNO)
  fetch data from USNO
else
  do calculations

Perhaps a mod that does this would work for any fetch failure:

Code: [Select]
if ($useUSNO)
  attempt fetch data from USNO
  if fetch fails
    $useUSNO = false;
  else
     use USNO data
if ( ! $useUSNO )
  do calculations