Author Topic: Saratoga USNO-moondata  (Read 2424 times)

0 Members and 1 Guest are viewing this topic.

Offline bob_linux_user

  • Member
  • *
  • Posts: 8
    • W4LCS Weather
Saratoga USNO-moondata
« on: January 30, 2018, 08:38:55 PM »
Good evening,

I am a long time (10year) wview user that just switched to weewx. I have been using the Saratoga AJAX.PHP templates for about 8 years. After my switch to weewx I noticed that my wxastronomy.php was reporting moon data from 1969. I also observed that I did not have a USNO-moondata.txt in my cache folder.  I confirmed that I have the latest get-USNO-sunmoon.php and wxastronomy.php. I can use the url with hand entered coordinates, date and TZ and obtain the USNO data. I created a text file with the data that I got back from USNO but the display is still old data. The sunrise/sunset data is correct but it comes from a different location. I actually hard coded the url in get-USNO-sunmoon.php to see if the problem was the date format but it still does not retrieve the file. Any help would be appreciated.

System Specifics:
Raspberry Pi2 - Debian Jessee
weewx - engine
Saratoga - Templates (latest updates)
Weather Display extension to provide testtags.php for Saratoga
Davis Vantage Pro2 - Hardware

Bob

« Last Edit: January 30, 2018, 08:50:33 PM by bob_linux_user »

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga USNO-moondata
« Reply #1 on: January 30, 2018, 10:43:14 PM »
Hi Bob,
You have a combination (weewx pretending to be Weather-Display) that causes the get-USNO-sunmoon.php script to not be invoked in the ajax-dashboard.php and wxastronomy.php pages.

Your testtags.php?sce=view shows
Code: [Select]
$sunset = '17:12';// sunset time
$moonrisedate = 'N/A';// moon rise date
$moonrise = 'N/A';// moon rise time
$moonsetdate = 'N/A';// moon set date
$moonset = 'N/A';// moon set time
$moonage = 'N/A';// current age of the moon (days since new moon)
$moonphase = '97%';// Moon phase %
$moonphasename = 'Full'; // 10.36z addition
$marchequinox = 'N/A';// March equinox date
$junesolstice = 'N/A';// June solstice date
$sepequinox = 'N/A';// September equinox date
$decsolstice = 'N/A';// December solstice date
$newmoon = 'N/A';// Date/time of the previous new moon
$nextnewmoon = 'N/A';// Date/time of the next new moon for next month
$firstquarter = 'N/A';// Date/time of the next/last first quarter moon
$lastquarter = 'N/A';// Date/time of the next/last last quarter moon
$fullmoon = 'N/A';// Date/time of the next/last full moon
$fullmoondate = 'N/A';// Date of the next/last full moon (date only)
$moonperihel = '09:33 UTC 03 January 2019';// Next Moon perihel date
$moonaphel = '16:14 UTC 06 July 2018';// Next moon perihel date
$moonperigee = '14:49 UTC 27 February 2018';// Next moon perigee date
$moonapogee = '14:16 UTC 11 February 2018';// Next moon apogee date
$suneclipse = '20:51 UTC 15 February 2018';// Next sun eclipse
$mooneclipse = '13:29 UTC 31 January 2018';// Next moon eclipse date
while a Weather-Display system (like mine) shows
Code: [Select]
$sunset =  '5:30 pm'; // sunset time
$moonrisedate =  '01/30/18'; // moon rise date
$moonrise =  '4:58 pm'; // moon rise time
$moonsetdate =  '01/31/18'; // moon set date
$moonset =  '7:16 am'; // moon set time
$moonage =  'Moon age: 14 days,6 hours,56 minutes,100%'; // current age of the moon (days since new moon)
$moonphase =  '100%'; // Moon phase %
$moonphasename = 'Full Moon'; // 10.36z addition
$morningciviltwilight = '6:44 am'; // morning civil  twilight time (when the sun is 6 degrees below the horizon)
$eveningciviltwilight = '5:58 pm'; // evening civil twilight time
$morningastrotwilight = '5:42 am'; // morning astronimcal twilight time (when the sun is 12 to 18 degrees below the horizon)
$eveningastrotwilight = '7:00 pm'; // evening astronimcal twilight time (when the sun is 12 to 18 degrees below the horizon)
$marchequinox =  '16:16 UTC March 20 2018'; // March equinox date
$junesolstice =  '10:08 UTC June 21 2018'; // June solstice date
$sepequinox =  '01:55 UTC September 23 2018'; // September equinox date
$decsolstice =  '22:23 UTC December 21 2018'; // December solstice date
$moonperihel =  '22:33 UTC January 3 2019'; // Next Moon perihel date
$moonaphel =  '07:26 UTC July 5 2018'; // Next moon perihel date
$moonperigee =  '14:50 UTC February 27 2018'; // Next moon perigee date
$moonapogee =  '14:16 UTC February 11 2018'; // Next moon apogee date
$newmoon =  '02:18 UTC January 17 2018'; // Date/time of the next/last new moon
$nextnewmoon =  '21:06 UTC February 15 2018'; // Date/time of the next new moon for next month
$firstquarter =  '22:21 UTC January 24 2018'; // Date/time of the next/last first quarter moon
$lastquarter =  '15:55 UTC February 7 2018'; // Date/time of the next/last last quarter moon
$fullmoon =  '13:27 UTC January 31 2018'; // Date/time of the next/last full moon
$fullmoondate =  'January 31 2018'; // Date of the next/last full moon (date only)
$suneclipse =  '20:02 UTC July 12 2018 Eclipse Partial'; // Next sun eclipse
$mooneclipse =  '05:31 UTC January 31 2018 Eclipse Total'; // Next moon eclipse date
Because weewx (imitating Weather-Display) doesn't provide the needed data, the moon info is not available.

You may be able to finesse ajax-dashboard.php into invoking get-USNO-sunmoon.php by changing
Code: [Select]
if($SITE['WXsoftware'] == 'WD') { to
Code: [Select]
if(false and $SITE['WXsoftware'] == 'WD') { to force it to use get-USNO-sunmoon.php instead.
Make sure your $SITE['latitude'] and $SITE['longitude'] are set correctly as that is what is used with the USNO query.

A similar change can be made in wxastronomy.php
Code: [Select]
if(isset($SITE['WXsoftware']) and $SITE['WXsoftware'] == 'WD') {
to
Code: [Select]
if(false and isset($SITE['WXsoftware']) and $SITE['WXsoftware'] == 'WD') {

Hope this helps...

Best regards,
Ken
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

Online gjr80

  • Member
  • *
  • Posts: 45
Re: Saratoga USNO-moondata
« Reply #2 on: January 30, 2018, 11:51:16 PM »
Bob,

When you installed weeWX did you install PyEphem? WeeWX requires PyEphem to provide extended ephemeris data (ie anything more than sunrise/sunset), the lack of moon, equinox and solstice data is consistent with PyEphem not being installed. You will find the instructions for installing PyEphem at this link http://weewx.com/docs/setup.htm, refer to the last Install Prerequisites entry. Once installed you will need to stop then start weeWX and then wait for the next report cycle.

Gary

Offline bob_linux_user

  • Member
  • *
  • Posts: 8
    • W4LCS Weather
Re: Saratoga USNO-moondata
« Reply #3 on: January 31, 2018, 10:46:24 AM »
The problem was that I had not installed PyEphem. I installed it on my development system and now testtags.php has the moon data and it is displayed properly. When I tried to install PyEphem on my Raspberry Pi, it would not install. I also discovered that I had not upgraded this Pi from wheezy to jessie. I read about an SSL problem with older versions of pip. My pip log indicates that the site access is "Forbidden" so I think I will have to upgrade to jessie to get pip to work. Thanks to all for your help. I will have to backup my sd card before the upgrade to jessie just for protection.

Thanks again,
Bob