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

0 Members and 1 Guest are viewing this topic.

Offline griffo42

  • Contributor
  • ***
  • Posts: 101
    • 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 Vantage Pro2 Model #6152AU
Cumulus latest version
Saratoga Weather World template Cumulus plugin
Carina Weather, Brisbane.

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 949
    • LexMAWeather
Re: USNO Sun-Moon problem
« Reply #1 on: August 12, 2019, 10:44:57 AM »
Your website URL?
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 949
    • 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.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • 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, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline ConligWX

  • Forecaster
  • *****
  • Posts: 843
  • #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

Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •


Offline tmabell

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

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 949
    • 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

https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

 

anything