Welcome to the Cumulus Support forum.

Latest Cumulus MX release 3.9.5 (build 3100) - 14 January 2021 (please see announcement regarding releases since 3.5.0)
Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of the NOAA report and Snow Index drop-down menus to 2030)

Use this Wiki link to Download the Software (Cumulus MX / Cumulus 1 and other related items).

Sun Plot

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

Moderator: daj

User avatar
mcrossley
Posts: 7516
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Buster Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Sun Plot

Post by mcrossley »

Well you don't need to do any adding up, there is a column in the realtime table - SunshineHours to total it for you. Or do what I have done on my homepage and just use the SunshineHours tag (I used daylength along with rise/set times) to add the text around the chart.

I don't intend to add any text to the chart, but anyone can modify the base code as they see fit.
Last edited by mcrossley on Tue 30 Aug 2016 9:27 pm, edited 1 time in total.

User avatar
kocher
Posts: 212
Joined: Sat 19 Apr 2014 7:57 pm
Weather Station: Davis Vantage Pro2+
Operating System: Windows 10
Location: San Sebastian - Spain
Contact:

Re: Sun Plot

Post by kocher »

Thank you very much for everything. :clap:

It is just an idea
Image

User avatar
PaulMy
Posts: 2390
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2+ Cumulus1 / CummulusMX
Operating System: Windows8 / Windows10
Location: Komoka, ON Canada
Contact:

Re: Sun Plot

Post by PaulMy »

I am now using Sunplot version 1.3 with Cumulus External Program running a batch file to upload the B-L SunRecords file every 5 minutes. The data used is the seconds by seconds logging in the file. The scripts resulting png image is displaying the result of that data, and the last part of the image could be up to 5 minutes behind until the next file upload. A nice presentation of sunshine here in Komoka! http://www.komokaweather.com/weather/su ... unplot.php.

Today's SunRecords log as of now has:
SRS 06:51:52 19:57:47
TOT 03:06:22 00:00:00
SUN 06:51:52 07:05:30
SUN 07:15:40 07:16:35
SUN 07:31:52 10:23:38
NRC 10:23:38 19:57:47

SUN 06:51:52 07:05:30 is the first period of sunshine for a period of 00:13:58
SUN 07:15:40 07:16:35 is the second period of sunshine of 00:00:55 after 00:10:10 of no sunshine
SUN 07:31:52 10:23:38 is the third period of sunshine (after 00:15:17 of no sunshine) until the current reading at 10:23:38
That 00:00:55 period of sunshine does show on the image :clap:

Now this is a very sunny day so far so not many ON/OFF periods yet but that can happen dozens of times over a day. Many short periods of ON/OFF will blur those periods like this image comparison of a couple days ago.

Thanks Mark,
Paul
You do not have the required permissions to view the files attached to this post.

User avatar
mcrossley
Posts: 7516
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Buster Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Sun Plot

Post by mcrossley »

Phew! Sunplot chipped with the hour going back, see the step at 2 o'clock. Now symmetrical around 12.

It also shows just how much darkness there is now in the UK.
sunplot.png
Sorry for the crumbie image, I'm on my phone.
You do not have the required permissions to view the files attached to this post.

nowind
Posts: 12
Joined: Thu 02 Feb 2017 8:22 pm
Weather Station: Davis Vantage Vue Pro2
Operating System: Win 10

Re: Sun Plot

Post by nowind »

This is an old post, but I choose to post a question here.

I have problems with timezone-settings in sunplot.php version 3.1 downloaded from Marks' site. Timezone in mysql is CEST. My PHP version is 7.1 and the timezone is set to Europe/Berlin. Unfortunately, I can't change this.

This is the response if I set my timezone to Europe/Berlin: ERROR - Setting time zone - Unknown or incorrect time zone: 'Europe/Berlin'

If I try '+01:00',I get this in my error-log:
[24-Aug-2018 13:54:26 Europe/Berlin] PHP Notice: date_default_timezone_set(): Timezone ID '+01:00' is invalid in ....... sunplot.php

I have of course searched the forum and googled, but I can't find any solution. :?

Any workaround?

User avatar
mcrossley
Posts: 7516
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Buster Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Sun Plot

Post by mcrossley »

Not seen that problem before, maybe you could try importing the TZ data again, the download is here... http://pecl.php.net/get/timezonedb

Matt.j5b
Posts: 495
Joined: Mon 28 Nov 2011 2:13 am
Weather Station: Davis VP2 with DFARS
Operating System: RPi Raspbian (Buster)
Location: Ferny Grove, Brisbane, Australia
Contact:

Re: Sun Plot

Post by Matt.j5b »

Having added the solar sensor to my Davis VP2 I have adding this data to my website.

But I have got a bit stuck with the sunplot script. The script works fine if I have showSunshine set to false. But if when I change this to plot the sunshine I get no image with the message of the image cannot be displayed because it contains errors.

However I don't see any errors reported in php at all and I have turned on error reporting to make sure they show up. I have tested this out on my pi and my web server with the same result.

https://fernygroveweather.com/utils/sunplotTest.php

I did initially have some issues with the timezone, of which I was getting errors for, but after fixing that I am now not getting any errors.

What might be happening here?
Regards, Matt of Brisbane, Australia
Ferny Grove Weather
Image

Mapantz
Posts: 902
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 10 x64
Location: Dorset - UK
Contact:

Re: Sun Plot

Post by Mapantz »

I presume you have a realtime data base that CMX is uploading to?
Image

Matt.j5b
Posts: 495
Joined: Mon 28 Nov 2011 2:13 am
Weather Station: Davis VP2 with DFARS
Operating System: RPi Raspbian (Buster)
Location: Ferny Grove, Brisbane, Australia
Contact:

Re: Sun Plot

Post by Matt.j5b »

Yes CMX is uploading to a realtime database, such as for the graphs. And I can see the solar/ sunshine data just fine in the database.
Regards, Matt of Brisbane, Australia
Ferny Grove Weather
Image

Matt.j5b
Posts: 495
Joined: Mon 28 Nov 2011 2:13 am
Weather Station: Davis VP2 with DFARS
Operating System: RPi Raspbian (Buster)
Location: Ferny Grove, Brisbane, Australia
Contact:

Re: Sun Plot

Post by Matt.j5b »

I must be doing something wrong but with the issue I am having with this script of the image not being created (using v1.3), and when I only change the following in the script:

$tz to my local time zone, change the $LAT and $LON for my location, change the name to my realtime db table, the location of the font file and setting $showSunshine to true.

When I manually run the SET time_zone and the SELECT db queries that are in the script, I get valid output.

I am not sure what happening here as no specific errors are showing. :? This issue only happens once I have showSunshine enabled.
Regards, Matt of Brisbane, Australia
Ferny Grove Weather
Image

Mapantz
Posts: 902
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 10 x64
Location: Dorset - UK
Contact:

Re: Sun Plot

Post by Mapantz »

Code: Select all

Error with Permissions-Policy header: Parse of permission policy failed because of errors reported by strctured header parser.
Image

Matt.j5b
Posts: 495
Joined: Mon 28 Nov 2011 2:13 am
Weather Station: Davis VP2 with DFARS
Operating System: RPi Raspbian (Buster)
Location: Ferny Grove, Brisbane, Australia
Contact:

Re: Sun Plot

Post by Matt.j5b »

I have some permission policy headers enabled on my website though I don't get any errors related to that.

I don't have any of those headers on my test website running on the Pi, and I get this issue on both the Pi and the public website. But even when I temporarily disable those headers on my public website I get the same issue anyway.
Regards, Matt of Brisbane, Australia
Ferny Grove Weather
Image

Matt.j5b
Posts: 495
Joined: Mon 28 Nov 2011 2:13 am
Weather Station: Davis VP2 with DFARS
Operating System: RPi Raspbian (Buster)
Location: Ferny Grove, Brisbane, Australia
Contact:

Re: Sun Plot

Post by Matt.j5b »

I am still getting the issue with this script on both my local Pi and on the website sever. The script works if I don't want to show the sunshine data on the image. I have been using the solar radiation/ sunshine data from the realtime database table just fine for the Highcharts graphing on my website. So, I have the data for the script.

It is looking like I won't be able to get this working as it seems. I have added the plot bands for sunshine on my real time Highcharts graph anyway.

I do get an error on the website server of setting the time zone in MySql, https://fernygroveweather.com/utils/sunplotTest.php. But I don't get this locally on my Pi however. Do I need that bit of code in the script?

The only bits I have changed from the script are:

Code: Select all

$tz = 'Australia/Brisbane';

// We need the decimal latitude and longitude of the station to calc sun position
$LAT = -27.3;  // +ve North
$LON = 152.8;  // +ve East

// Realtime database table name
$realtimeTableName = 'Realtime';

// Path to TTF font - only required if using the Hour markers
// $_SERVER['DOCUMENT_ROOT'] normally equates to the base folder of your web server.
// You can use a full path from the root of your system drive here - delete "$_SERVER['DOCUMENT_ROOT'] . "
// if you do this.
$fontFile = $_SERVER['DOCUMENT_ROOT'] . '/tt-fonts/arial.ttf';

// plot options - note these can be overridden by posted parameters
$sizeH        = 250;        // Horizontal image size
$sizeV        = 150;        // Vertical image size
$showGround   = true;       // Show the ground as shaded
$showSunshine = true;      // Plot sunshine from your MySQL database
$transparent  = false;      // Make the image background transparent
$showTwilight = true;      // Plot civil/nautical/astro twilight
$showHours    = true;       // Plot the hours 0-24 along the horizon axis


     // Hidden MySQL read-only connection parameters
    include '/***/*******/***/db_ro_details.php';
Regards, Matt of Brisbane, Australia
Ferny Grove Weather
Image

User avatar
mcrossley
Posts: 7516
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Buster Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Sun Plot

Post by mcrossley »

If you cannot import the time zone tables, you could try setting the time zone to "+10:00" ?

Matt.j5b
Posts: 495
Joined: Mon 28 Nov 2011 2:13 am
Weather Station: Davis VP2 with DFARS
Operating System: RPi Raspbian (Buster)
Location: Ferny Grove, Brisbane, Australia
Contact:

Re: Sun Plot

Post by Matt.j5b »

Using "+10:00" stops that error showing, as I don't have root access on the website to import the time zone.

But I still only get this issue of the image not displaying at all when I set showSunshine to true. At the moment I am using this script just fine without the sunshine being plotted.
Regards, Matt of Brisbane, Australia
Ferny Grove Weather
Image

Post Reply