If you use Cumulus, please donate Image

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

Error regarding USNO Sunmoon data

Discussion of Ken True's web site templates

Moderator: saratogaWX

weatherist34
Posts: 391
Joined: Wed Apr 13, 2016 11:09 am
Weather Station: Fine Offset HP1000/2000
Operating System: OS X Sierra
Location: Istanbul
Contact:

Re: Error regarding USNO Sunmoon data

Postby weatherist34 » Fri Aug 18, 2017 1:22 pm

Toxic17 wrote:nice.

I was going to see if i could fix that but I just had a hard disk failure! good job i have a cloned imaged:)


toxic you can adjust the offset in easyweathersetup its been an option from day one ..see attached image

yes i minified code (you can unminify it) to reduce the file size as this particular file does a lot of other things so keep it too a minimum file size improved the performance .
You do not have the required permissions to view the files attached to this post.

User avatar
Toxic17
Posts: 528
Joined: Mon May 19, 2014 10:45 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Debian 9.1 Stretch
Location: Bangor, NI
Contact:

Re: Error regarding USNO Sunmoon data

Postby Toxic17 » Fri Aug 18, 2017 6:41 pm

Hi Brian yep figured that out. Didn't look hard enough! Also too busy last night from a failed ssd. On my cumulusmx server!
Regards Simon
https://www.conligwx.org
https://www.conligwx.org/pws/
Davis Vantage Pro2+ - CumulusMX v3.0.0 (build 3043) + Saratoga/PWS
Image

User avatar
saratogaWX
Posts: 830
Joined: Wed May 06, 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows XP SP3
Location: Saratoga, CA, USA
Contact:

Re: Error regarding USNO Sunmoon data

Postby saratogaWX » Thu Oct 12, 2017 1:29 am

After several months of testing/tweaking, the get-USNO-sunmoon.php script has been revised to V3.00.

The major changes are:
1) switch to using curl to access api.usno.navy.mil API (better timeout control) and
2) addition of built-in calculations to supply sun/moon rise/set and moon %illumination and phase (thanks to Jachym and others for sharing the code!)

You can add a new setting to Settings.php where you can optionally switch the script from using the USNO to using the internal calculations.

$SITE['useUSNO'] = true; // =true; default -- use the USNO api.usno.navy.mil JSON for data

$SITE['useUSNO'] = false; // =false: use the internal calculations and no access to the USNO api.usno.navy.mil server

Note that the internal calculations are within a couple of minutes of the more-accurate USNO data, and likewise the % illumination is within a couple percent. For best accuracy, continue to use the USNO. If the USNO server has issues, then switch to using the internal calculations to free your website page load from externally caused delays with the USNO server.

Standalone download here

Saratoga template: use the update tool (Base-*, Plugin-*, 11-Oct-2017)
(note that get-metar-conditions-inc.php V1.16 is included in the update, and for USA templates, advforecast2.php V5.04 (JSON) is included)

Best regards,
Ken

User avatar
Toxic17
Posts: 528
Joined: Mon May 19, 2014 10:45 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Debian 9.1 Stretch
Location: Bangor, NI
Contact:

Re: Error regarding USNO Sunmoon data

Postby Toxic17 » Thu Oct 12, 2017 10:18 pm

Thanks Ken for the update. Much appreciated!
Regards Simon
https://www.conligwx.org
https://www.conligwx.org/pws/
Davis Vantage Pro2+ - CumulusMX v3.0.0 (build 3043) + Saratoga/PWS
Image

User avatar
HRVistaWeather
Posts: 161
Joined: Mon Apr 09, 2012 2:38 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 (64bit)
Location: Franklin, Huon Valley, Tasmania

Re: Error regarding USNO Sunmoon data

Postby HRVistaWeather » Sat Oct 14, 2017 6:30 am

Hi Ken,
Again thank you as always for a brilliant update: get-USNO-sunmoon.php ( V3.00 ).

I found using the :

Code: Select all

$SITE['useUSNO'] = false;
worked better for me.
Sun Times where out by one or 2 mins if I used USNO rather than Internal (however I did compare against "www.timeanddate.com" which I am not sure is 100% accurate), but the bonus is it results in yet another non reliance on external data capture which is great.

I also decided to utilise the array in the "Common.php" to make the "Lunar Cycles" more timely, as they where always displaying past times.

Code: Select all

#  tman1991 mods for cell.php add-on
   $moonD = array($NM, $Q1, $Q2, $Q3, $Q4, $Q1Moons[$mi], $fullMoons[$mi], $Q3Moons[$mi] );
   $moonP = array("New Moon", "First Quarter", "Full Moon", "Last Quarter", "New Moon", "First Quarter", "Full Moon", "Last Quarter");
   $moonI = array("NM", "Q1, "FM", "Q3", "NM", "Q1", "FM", "Q3");
   foreach($moonD as $key=>$mdate) {
      if ($mdate>$date) {
         $info->moons[] = array ($moonP[$key], $mdate, $moonI[$key], date("r",$mdate));
     }
   }
#  end tman1991 mods for cell.php add-on


Original : (most Times are Historic) : Current Date is : 14/10/2017 "AEDT" ("UTC" +11)
almanacold.PNG


New : (All Times are in the Future) : and dynamically adjust left to right according to Date/Time. :
Current Date is : 14/10/2017 "AEDT" ("UTC" +11)
Note: I also changed the old "GMT" to "UTC".
almanacnew.PNG


To Enable this change : I did the following :

In my "wxalmanac.php" or ( "wxastronomy.php" or "sunmoon.php" ) which ever file users have, I changed :
FROM : (NOTE: my files are .png vs users may have .jpg)

Code: Select all

<div align="center">
  <table width="99%" cellpadding="0" border="0" cellspacing="0">
    <tr>
      <td width="25%" align="center"><?php langtrans('First Quarter Moon') ;?></td>
      <td width="25%" align="center"><?php langtrans('Full Moon'); ?></td>
      <td width="25%" align="center"><?php langtrans('Last Quarter Moon'); ?></td>
      <td width="25%" align="center"><?php langtrans('New Moon'); ?></td>
    </tr>
    <tr>
      <td align="center">
      <img src="<?php print $SITE['imagesDir']; ?>moon-firstquar.png" width="100" height="100"
     alt="<?php langtrans('First Quarter Moon'); ?>"
     title="<?php langtrans('First Quarter Moon'); ?>"/></td>
      <td align="center">
      <img src="<?php print $SITE['imagesDir']; ?>moon-fullmoon.png" width="100" height="100"
     alt="<?php langtrans('Full Moon'); ?>"
     title="<?php langtrans('Full Moon'); ?>"/></td>
      <td align="center">
      <img src="<?php print $SITE['imagesDir']; ?>moon-lastquar.png" width="100" height="100"
     alt="<?php langtrans('Last Quarter Moon'); ?>"
     title="<?php langtrans('Last Quarter Moon'); ?>"/></td>
      <td align="center">
      <img src="<?php print $SITE['imagesDir']; ?>moon-newmoon.png" width="100" height="100"
     alt="<?php langtrans('New Moon'); ?>"
     title="<?php langtrans('New Moon'); ?>"/></td>
    </tr>
   <?php $sourceMonths = $SITE['monthNames']; // from Settings.php file for WD month names ?>
    <tr>
      <td width="25%" align="center">
     <?php echo get_localdate($firstquarter); ?><br/>
     <small><?php echo get_utcdate($firstquarter); ?></small></td>
      <td width="25%" align="center">
     <?php echo get_localdate($fullmoon); ?><br/>
     <small><?php echo get_utcdate($fullmoon); ?></small></td>
      <td width="25%" align="center">
     <?php echo get_localdate($lastquarter); ?><br/>
     <small><?php echo get_utcdate($lastquarter); ?></small></td>
      <td width="25%" align="center">
     <?php echo get_localdate($nextnewmoon); ?><br/>
     <small><?php echo get_utcdate($nextnewmoon); ?></small></td>
    </tr>
  </table>
</div>

TO : (NOTE: my files are .png vs users may have .jpg)

Code: Select all

<div align="center">
  <table width="100%" cellpadding="0" border="0" cellspacing="0">
    <tr>
      <td width="25%" align="center"><?php echo langtransstr($moon->moons[0][0]); ?></td>
      <td width="25%" align="center"><?php echo langtransstr($moon->moons[1][0]); ?></td>
      <td width="25%" align="center"><?php echo langtransstr($moon->moons[2][0]); ?></td>
      <td width="25%" align="center"><?php echo langtransstr($moon->moons[3][0]); ?></td>
    </tr>
    <tr>
      <td width="25%" align="center">
      <img src="<?php print $SITE['imagesDir'].$moon->moons[0][2].'.png'; ?>" width="100" height="100" alt  ="<?php echo langtransstr($moon->moons[0][0]); ?>" title="<?php echo langtransstr($moon->moons[0][0]); ?>"/></td>
      <td width="25%" align="center">
      <img src="<?php print $SITE['imagesDir'].$moon->moons[1][2].'.png'; ?>" width="100" height="100" alt  ="<?php echo langtransstr($moon->moons[1][0]); ?>" title="<?php echo langtransstr($moon->moons[1][0]); ?>"/></td></td>
      <td width="25%" align="center">
      <img src="<?php print $SITE['imagesDir'].$moon->moons[2][2].'.png'; ?>" width="100" height="100" alt  ="<?php echo langtransstr($moon->moons[2][0]); ?>" title="<?php echo langtransstr($moon->moons[2][0]); ?>"/></td></td>
      <td width="25%" align="center">
      <img src="<?php print $SITE['imagesDir'].$moon->moons[3][2].'.png'; ?>" width="100" height="100" alt  ="<?php echo langtransstr($moon->moons[3][0]); ?>" title="<?php echo langtransstr($moon->moons[3][0]); ?>"/></td></td>
    </tr>
   <?php $sourceMonths = $SITE['monthNames']; // from Settings.php file for WD month names ?>
    <tr>
      <td width="25%" align="center">
     <?php echo date("l",$moon->moons[0][1]); ?><br/>    
     <?php echo date("d/m/Y H:i",$moon->moons[0][1]); ?> <small><?php echo date("T",$moon->moons[0][1]); ?></small><br/>
     <small><?php echo date("d F Y H:i",$moon->moons[0][1]-date("Z",$moon->moons[0][1])).' '.'UTC'; ?></small>
     </td>
      <td width="25%" align="center">
     <?php echo date("l",$moon->moons[1][1]); ?><br/>    
     <?php echo date("d/m/Y H:i",$moon->moons[1][1]); ?> <small><?php echo date("T",$moon->moons[1][1]); ?></small><br/>
     <small><?php echo date("d F Y H:i",$moon->moons[1][1]-date("Z",$moon->moons[1][1])).' '.'UTC'; ?></small>
     </td>
      <td width="25%" align="center">
     <?php echo date("l",$moon->moons[2][1]); ?><br/>    
     <?php echo date("d/m/Y H:i",$moon->moons[2][1]); ?> <small><?php echo date("T",$moon->moons[2][1]); ?></small><br/>
     <small><?php echo date("d F Y H:i",$moon->moons[2][1]-date("Z",$moon->moons[2][1])).' '.'UTC'; ?></small>
     </td>
      <td width="25%" align="center">
     <?php echo date("l",$moon->moons[3][1]); ?><br/>    
     <?php echo date("d/m/Y H:i",$moon->moons[3][1]); ?> <small><?php echo date("T",$moon->moons[3][1]); ?></small><br/>
     <small><?php echo date("d F Y H:i",$moon->moons[3][1]-date("Z",$moon->moons[3][1])).' '.'UTC'; ?></small>
     </td>
    </tr>
  </table>
</div>

In order to have the $moon Array available :
in same file around row (141) I added :

Code: Select all

$moon = cgetMoonInfo();
:
Example :

Code: Select all

       if(file_exists("get-USNO-sunmoon.php")) {
         include_once("get-USNO-sunmoon.php");
     $USNOdata = getUSNOsunmoon();
      }
   if(isset($USNOdata['sunrise']))                 {$sunrise =     $USNOdata['sunrise']; } 
   if(isset($USNOdata['sunrisedate']))             {$sunrisedate = $USNOdata['sunrisedate']; } 
   if(isset($USNOdata['sunset']))                  {$sunset =      $USNOdata['sunset']; } 
   if(isset($USNOdata['sunsetdate']))              {$sunsetdate =  $USNOdata['sunsetdate']; } 
   if(isset($USNOdata['moonrise']))                {$moonrise =    $USNOdata['moonrise']; } 
   if(isset($USNOdata['moonrisedate']))            {$moonrisedate= $USNOdata['moonrisedate']; } 
   if(isset($USNOdata['moonset']))                 {$moonset =     $USNOdata['moonset']; } 
   if(isset($USNOdata['moonsetdate']))             {$moonsetdate = $USNOdata['moonsetdate']; } 
   if(isset($USNOdata['moonphase']))               {$moonphasename = $USNOdata['moonphase']; } 
   if(isset($USNOdata['illumination']))            {$moonphase = $USNOdata['illumination']; } 
   if(isset($USNOdata['hoursofpossibledaylight'])) {$hoursofpossibledaylight = $USNOdata['hoursofpossibledaylight'];}
 } 
$moon = cgetMoonInfo();
?>


Then I Copied/Renamed the following Moon Images : (to work with the array) :
(NOTE: my files are .png vs users may have .jpg)

moon-firstquar.png = Q1.png
moon-fullmoon.png = FM.png
moon-lastquar.png = Q3.png
moon-newmoon.png = NM.png

That's it, well I would like to make the "Solar Cycle" (Season) section dynamic as well, however that will sit on the drawing board for a while till I figure out a way to turn it into an array , which would then I suppose remove the requirement for the "get_localdate" and "get_utcdate" for it, or at worst have to adjust them.

I also modified the Class Moon() in Brians "LiveData.php" file as per your mods :

Code: Select all

// $timezone = (int)($lon / 15);
   $date = self::modifiedJulianDate($month, $day, $year);
// $date -= $timezone / 24;
   $timezone = date('Z')/3600; // KT
   $date -= $timezone / 24;


And that works perfect, removing the need to use the Homeweather Templates (Moon/Fine Tuning) requirement in "easyweathersetup.php".

That coupled with the recent mod I made to remove the need to adjust the Homeweather Templates "UTC" Offset every time we swing from "ST" to "DST" now means the Homeweather Template can run in auto without having to change either of the above mentioned settings.
(ref: images below). The first Moon/Fine Adjustment image (displays a "1") as it's an old image, in my case that is now "0" and will remain that way.
Image
Image


Again, Thanks Ken (Legend).

PS. Forgot to add:
In the "Common.php" : To change the "GMT" to "UTC" : (For Solar Cycle/Season)
FROM: (Around Line "715")

Code: Select all

// -----------------------------------------------------------------------------
// SEASON FUNCTIONS  return season dates based on USNO dates for Spring, Summer, Fall, Winter                                                             .
// -----------------------------------------------------------------------------
function cGetSeasonInfo ($YY=0) { // feed it the year
  $seasonList = array( // seasons from USNO in WD date format
  // year => 'Spring|Summer|Autumn|Winter'
   '2009' => '11:44 GMT 20 March 2009|05:46 GMT 21 June 2009|21:19 GMT 22 September 2009|17:47 GMT 21 December 2009|',
   '2010' => '17:32 GMT 20 March 2010|11:28 GMT 21 June 2010|03:09 GMT 23 September 2010|23:38 GMT 21 December 2010|',
   '2011' => '23:21 GMT 20 March 2011|17:16 GMT 21 June 2011|09:05 GMT 23 September 2011|05:30 GMT 22 December 2011|',
   '2012' => '05:14 GMT 20 March 2012|23:09 GMT 20 June 2012|14:49 GMT 22 September 2012|11:12 GMT 21 December 2012|',
   '2013' => '11:02 GMT 20 March 2013|05:04 GMT 21 June 2013|20:44 GMT 22 September 2013|17:11 GMT 21 December 2013|',
   '2014' => '16:57 GMT 20 March 2014|10:51 GMT 21 June 2014|02:29 GMT 23 September 2014|23:03 GMT 21 December 2014|',
   '2015' => '22:45 GMT 20 March 2015|16:38 GMT 21 June 2015|08:21 GMT 23 September 2015|04:48 GMT 22 December 2015|',
   '2016' => '04:30 GMT 20 March 2016|22:34 GMT 20 June 2016|14:21 GMT 22 September 2016|10:44 GMT 21 December 2016|',
   '2017' => '10:29 GMT 20 March 2017|04:24 GMT 21 June 2017|20:02 GMT 22 September 2017|16:28 GMT 21 December 2017|',
   '2018' => '16:15 GMT 20 March 2018|10:07 GMT 21 June 2018|01:54 GMT 23 September 2018|22:23 GMT 21 December 2018|',
   '2019' => '21:58 GMT 20 March 2019|15:54 GMT 21 June 2019|07:50 GMT 23 September 2019|04:19 GMT 22 December 2019|',
   '2020' => '03:50 GMT 20 March 2020|21:44 GMT 20 June 2020|13:31 GMT 22 September 2020|10:02 GMT 21 December 2020|',
  ); // end of seasonList


TO:

Code: Select all

// -----------------------------------------------------------------------------
// SEASON FUNCTIONS  return season dates based on USNO dates for Spring, Summer, Fall, Winter                                                             .
// -----------------------------------------------------------------------------
function cGetSeasonInfo ($YY=0) { // feed it the year
  $seasonList = array( // seasons from USNO in WD date format
  // year => 'Spring|Summer|Autumn|Winter'
   '2009' => '11:44 UTC 20 March 2009|05:46 UTC 21 June 2009|21:19 UTC 22 September 2009|17:47 UTC 21 December 2009|',
   '2010' => '17:32 UTC 20 March 2010|11:28 UTC 21 June 2010|03:09 UTC 23 September 2010|23:38 UTC 21 December 2010|',
   '2011' => '23:21 UTC 20 March 2011|17:16 UTC 21 June 2011|09:05 UTC 23 September 2011|05:30 UTC 22 December 2011|',
   '2012' => '05:14 UTC 20 March 2012|23:09 UTC 20 June 2012|14:49 UTC 22 September 2012|11:12 UTC 21 December 2012|',
   '2013' => '11:02 UTC 20 March 2013|05:04 UTC 21 June 2013|20:44 UTC 22 September 2013|17:11 UTC 21 December 2013|',
   '2014' => '16:57 UTC 20 March 2014|10:51 UTC 21 June 2014|02:29 UTC 23 September 2014|23:03 UTC 21 December 2014|',
   '2015' => '22:45 UTC 20 March 2015|16:38 UTC 21 June 2015|08:21 UTC 23 September 2015|04:48 UTC 22 December 2015|',
   '2016' => '04:30 UTC 20 March 2016|22:34 UTC 20 June 2016|14:21 UTC 22 September 2016|10:44 UTC 21 December 2016|',
   '2017' => '10:29 UTC 20 March 2017|04:24 UTC 21 June 2017|20:02 UTC 22 September 2017|16:28 UTC 21 December 2017|',
   '2018' => '16:15 UTC 20 March 2018|10:07 UTC 21 June 2018|01:54 UTC 23 September 2018|22:23 UTC 21 December 2018|',
   '2019' => '21:58 UTC 20 March 2019|15:54 UTC 21 June 2019|07:50 UTC 23 September 2019|04:19 UTC 22 December 2019|',
   '2020' => '03:50 UTC 20 March 2020|21:44 UTC 20 June 2020|13:31 UTC 22 September 2020|10:02 UTC 21 December 2020|',
  ); // end of seasonList
 


Ah ! : Forgot some additional changes (for the Moon Array) : in order to Display "First Quarter Moon" or "Last Quarter Moon" vs just "First Quarter" or "Last Quarter" above each Moon image, you will need further changes to "Common.php" and "get-USNO-sunmoon.php".

So rather than waffle on more here, I have attached both files, just do the usual (backup/copy/diffmerge/whatever) before using, oh and ensure you have applied the earlier - above mentioned changes first.

Note: also, unless I'm wrong (possible), I reverse my "Summer" / "Winter" Solstice images for "Southern Hemisphere" display. I made this change ages ago Ken as the Switch did not seem to work and never bothered to investigate why, in the end I created new images to be more relevant to Aus/Southern Hemisphere. They are rough and ready, but do me.
almanacnew2.PNG


earth-fall.jpg
earth-winter.jpg
earth-spring.jpg
earth-summer.jpg


And as I no longer have a public website : image attached is of the entire page.
Huon River Vista Weather AlamanaAAAA.png
You do not have the required permissions to view the files attached to this post.
Last edited by HRVistaWeather on Sun Oct 22, 2017 1:36 am, edited 7 times in total.
Tony

Huon River Vista Weather - South Franklin - Tasmania
Davis Vantage Pro 2 Plus - FARS, Cumulus MX, 2 Soil Temp/Moist Solar/Rad.
Weather PC Died 2016/11/21 15:25 Cannot justify replacement (Website dead)

User avatar
HRVistaWeather
Posts: 161
Joined: Mon Apr 09, 2012 2:38 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 (64bit)
Location: Franklin, Huon Valley, Tasmania

Re: Error regarding USNO Sunmoon data

Postby HRVistaWeather » Mon Oct 16, 2017 4:29 am

HRVistaWeather wrote:I also modified the Class Moon() in Brians "LiveData.php" file as per your mods :

Code: Select all

// $timezone = (int)($lon / 15);
   $date = self::modifiedJulianDate($month, $day, $year);
// $date -= $timezone / 24;
   $timezone = date('Z')/3600; // KT
   $date -= $timezone / 24;


And that works perfect, ......".


MM, spoke to early on that one, still some further tweaks to fathom out as some times are still not 100% correct in homeweather Template post mod.

regards,
Tony

Huon River Vista Weather - South Franklin - Tasmania
Davis Vantage Pro 2 Plus - FARS, Cumulus MX, 2 Soil Temp/Moist Solar/Rad.
Weather PC Died 2016/11/21 15:25 Cannot justify replacement (Website dead)

User avatar
Toxic17
Posts: 528
Joined: Mon May 19, 2014 10:45 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Debian 9.1 Stretch
Location: Bangor, NI
Contact:

Re: Error regarding USNO Sunmoon data

Postby Toxic17 » Fri Oct 20, 2017 12:44 pm

saratogaWX wrote:After several months of testing/tweaking, the get-USNO-sunmoon.php script has been revised to V3.00.

The major changes are:
1) switch to using curl to access api.usno.navy.mil API (better timeout control) and
2) addition of built-in calculations to supply sun/moon rise/set and moon %illumination and phase (thanks to Jachym and others for sharing the code!)

You can add a new setting to Settings.php where you can optionally switch the script from using the USNO to using the internal calculations.

$SITE['useUSNO'] = true; // =true; default -- use the USNO api.usno.navy.mil JSON for data

$SITE['useUSNO'] = false; // =false: use the internal calculations and no access to the USNO api.usno.navy.mil server

Note that the internal calculations are within a couple of minutes of the more-accurate USNO data, and likewise the % illumination is within a couple percent. For best accuracy, continue to use the USNO. If the USNO server has issues, then switch to using the internal calculations to free your website page load from externally caused delays with the USNO server.

Standalone download here

Saratoga template: use the update tool (Base-*, Plugin-*, 11-Oct-2017)
(note that get-metar-conditions-inc.php V1.16 is included in the update, and for USA templates, advforecast2.php V5.04 (JSON) is included)

Best regards,
Ken



Ken

I downloaded you new get-USNO-sunmoon.php but my moon rise and set dates are showing (01/Jan/1970)

I can't see what is going wrong, the old one just worked.

https://www.conligwx.org/get-USNO-sunmoon.php
https://www.conligwx.org/get-USNO-sunmoon.working.php

Alos USNO-moondata.txt doesn't seem to be created. is this only for USNO data?

Code: Select all

$Version = 'get-USNO-sunmoon.php - Version 3.00 - 11-Oct-2017';

  // -----------local settings-------------------

  $ourTZ = "Europe/London"; //NOTE: this *MUST* be set correctly to

  // translate UTC times to your LOCAL time for the displays.
  //  set to station latitude/longitude (decimal degrees)

  $myLat = 5x.xxxx; //North=positive, South=negative decimal degrees
  $myLong = - x.xxxxx; //East=positive, West=negative decimal degrees

  // The above settings are for saratoga-weather.org location

  $myCity = 'Conlig'; // my city name
  $useMDY = false; // true=use mm/dd/yyyy for dates, false=use dd/mm/yyyy for dates
  $cacheFileDir = '/cache/'; // default cache file directory
  $cacheName = "USNO-moondata.txt"; // used to store the file so we don't have to fetch from USNO website
  $refetchSeconds = 3600; // refetch every nnnn seconds 3600=1 hour
  $useUSNO = false; // =true; use USNO data, =false; use computed values only (not as accurate)
Regards Simon
https://www.conligwx.org
https://www.conligwx.org/pws/
Davis Vantage Pro2+ - CumulusMX v3.0.0 (build 3043) + Saratoga/PWS
Image

User avatar
Toxic17
Posts: 528
Joined: Mon May 19, 2014 10:45 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Debian 9.1 Stretch
Location: Bangor, NI
Contact:

Re: Error regarding USNO Sunmoon data

Postby Toxic17 » Fri Oct 20, 2017 2:33 pm

saratogaWX wrote:Oops, forgot to honor the $SITE['WDdateMDY'] setting for the output dates.

Change

Code: Select all

   $timeFormat = "H:i m/d/Y";
to

Code: Select all

   $timeFormat = $useMDY?"H:i m/d/Y":"H:i d/m/Y";
and that should fix it up.

I've updated the beta script with that change.


looks like you need to update this again in your original file Ken. thats why I got the (01/Jan/1970) again....

fixed now though please update your get-USNO-sunmoon.php.
Regards Simon
https://www.conligwx.org
https://www.conligwx.org/pws/
Davis Vantage Pro2+ - CumulusMX v3.0.0 (build 3043) + Saratoga/PWS
Image

User avatar
saratogaWX
Posts: 830
Joined: Wed May 06, 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows XP SP3
Location: Saratoga, CA, USA
Contact:

Re: Error regarding USNO Sunmoon data

Postby saratogaWX » Sat Oct 21, 2017 1:06 am

Oooh... sorry about that.. forgot to put the check for MDY v.s.DMY format in the calculated part. Thanks for spotting that.

I've updated the distribution with V3.01 with the fix for DMY format (as shown above).. thanks again!

User avatar
HRVistaWeather
Posts: 161
Joined: Mon Apr 09, 2012 2:38 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 (64bit)
Location: Franklin, Huon Valley, Tasmania

Re: Error regarding USNO Sunmoon data

Postby HRVistaWeather » Sat Oct 21, 2017 10:06 am

I added some additional context to my "wxalmanac.php" in the hope in makes sense.
contextAlamanaca_AAAAA.png
You do not have the required permissions to view the files attached to this post.
Tony

Huon River Vista Weather - South Franklin - Tasmania
Davis Vantage Pro 2 Plus - FARS, Cumulus MX, 2 Soil Temp/Moist Solar/Rad.
Weather PC Died 2016/11/21 15:25 Cannot justify replacement (Website dead)


Return to “Saratoga Templates”

Who is online

Users browsing this forum: No registered users and 3 guests