Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

PHP code has stopped calculating Local Noon overnight

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

RayProudfoot
Posts: 3389
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: PHP code has stopped calculating Local Noon overnight

Post by RayProudfoot »

Hi Mapantz,

The lights burn late at Host Presto! They've come back to me in the last 30 mins with the solution. This is now a working version of my .htaccess which copes with beteljuice's Data Summary pages plus the small piece of code on my index.htm that calculates Local Noon.

AddDefaultCharset ISO-8859-1
AddCharset ISO-8859-1 .php
php_value default_charset iso-8859-1

AddHandler application/x-httpd-ea-php70___lsphp .php .php7 .phtml .htm


I don't profess to understand it but as things work that will do me.
Cheers,
Ray, Cheshire.

Image
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: PHP code has stopped calculating Local Noon overnight

Post by sfws »

freddie wrote: Mon 25 Feb 2019 12:43 pm Just tried looking at the PHP source code and got this:

Code: Select all

Tough ! - I changed the password !!!
:-(
FREDDIE - Next time try "?view=getorfmiland" to look at that source code!
You get the message you quote if you try to use Mark Crossley's query-string way of displaying PHP source file on code originating from beteljuice. See my old post at viewtopic.php?f=14&t=16425 where I tried to suggest a better common approach.
RayProudfoot wrote: Mon 25 Feb 2019 5:09 pm Take the sunrise and sunset times and find the mid-point.
RAY, I don't know how Cumulus MX calculates sunset and sunrise. In Cumulus 1 (which you are using), in the UK the sunset and sunrise times reported by Cumulus relate to different calendar days, because both last sunrise and next sunset are calculated at midnight GMT. During the day on Wednesday, Cumulus 1 reports sunrise for Tuesday and sunset for Wednesday. Consequently the mid-point calculated by the code you quote is effectively midnight not noon. The difference is tiny, but whether sunset or sunrise time is varying the most depends on time of year, so the bias towards the previous day also varies.
PHP provides its own functions for reporting sunset, sunrise and transit times which can be reported for any date, latitude and longitude combination. The relevant code is in that pie chart picture that shows the night, twilight, and day periods on your web page. An edit of that code could make it show the sunrise, transit and sunset times to prove I am right.
Elsewhere in the Saratoga template forum, a discussion on the accuracy of the various sources of astronomical times can be found.

============================

Now I will go back into hibernation, the lovely warm weather of today (this February has copied 1996 and 2012 with a very mild period in UK) is not going to be back tomorrow.
RayProudfoot
Posts: 3389
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: PHP code has stopped calculating Local Noon overnight

Post by RayProudfoot »

Sfws, I imagine Steve grabbed today’s and tomorrow’s sunrise / sunset times for two different purposes. The latter so he could show how much more/less daylight there would be compared to today.

Having got that out of the way then calculating local noon as the mid-point between today’s sunrise and sunset times seems to be the simplest way of doing it. Yes, the time shown may not be the exact moment the leading edge of the sun appears but the difference will be tiny. Let’s not also forget the biggest factor for local noon is Equation of Time which has a massive effect. Up to 30 minutes!

I don’t have the knowledge or desire to do it a different way.
Cheers,
Ray, Cheshire.

Image
Post Reply