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

Yet Another Dayfile Reader (PHP)

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

Moderator: daj

User avatar
PaulMy
Posts: 3830
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by PaulMy »

This script has been working well but just found it getting an error: http://komokaweather.com/komokaweather- ... ummary.php
Warning: array_key_exists() expects parameter 2 to be array, null given in /home/content/96/5379896/html/weather/betel_readDayfile.php on line 809

I don't recognize what the problem might be at line 809 - this is the code from lines 803 to 815:
if($thisValue || $thisValue == 0){
if($dataSet != 'winddir') $alltime[$m][] = $thisValue;
formatOP();
$short = (count($turd) < cal_days_in_month(CAL_GREGORIAN, $m, $type_year[$d]) ? "* " : "");
if(count($turd) < cal_days_in_month(CAL_GREGORIAN, $m, $type_year[$d])) $shortMon[$d][$m] = true ;
$tablelayout .= " class=\"datacell2\"".$part2.">".($dataSet != 'HoursSun' ? $short : '').$thisValue."</td>";
}else {
$tablelayout .= ' class="nondate">&nbsp;</td>';
}
}else{
$tablelayout .= ' class="nondate">&nbsp;</td>';
}
} // END month walk

I have not made any changes to this script. Any suggestions what I could try?

Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm
Image
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Yet Another Dayfile Reader (PHP)

Post by beteljuice »

I thought we'd got rid of all those - I can't see anyone else with the problem ATM.

Does this apply : https://cumulus.hosiene.co.uk/viewtopic.p ... &start=173
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
PaulMy
Posts: 3830
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by PaulMy »

Thanks beteljuice,
I have scanned through that page and all the pages and nothing has caught my eye as yet, but will look again tomorrow after a good night's sleep. It seems that the message might have occurred from about the time of a recent change to my .htaccess but not certain.

Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm
Image
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Yet Another Dayfile Reader (PHP)

Post by beteljuice »

Since these are warnings only how about changing

Code: Select all

error_reporting(E_ALL ^ E_NOTICE);   

// to

error_reporting(0);
IF it's to do with changes to your .htaccess :shock:
It could be that the 'global' error reporting level has changed, or in some cases the server has more than one version of PHP and you may have slipped back a version.

... but most likely it's just the error level ... perhaps ...
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
PaulMy
Posts: 3830
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by PaulMy »

Thanks beteljuice. I had to rush away until this evening, and will then be at the computer to try that change. All the data displays seem to be working and ok.

Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm
Image
User avatar
PaulMy
Posts: 3830
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by PaulMy »

Have changed to error_reporting(0); and all is well again.

Thank you for the hint,
Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm
Image
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by BCJKiwi »

Mark,
recently upgraded to VP2 with a Solar sensor.

For some reason when the sunshine hours are 0.0 for the day, the data cell is blank instead of 0.0 When there are sunshine hours recorded, the data shows as expected.

Have had a look at the file(s) and tried a few things but not making any difference.
Any suggestions?

Thanks
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Yet Another Dayfile Reader (PHP)

Post by beteljuice »

Code: Select all

// Cumulus provides 0 or 0.0 for missing or invalid data - this can make a nonsense of minimum and average values.
// The best thing to do is to edit your dayfile.txt and nullify (,,) any false data.
// However; depending upon your location, some datasets can reasonably be expected to be > 0 (remember these are daily values)
// These COULD include:
// ... 'windspd', 'windgust', 'windrun', 'HoursSun', 'Solar', 'HighUV', evt

$SANITIZE = true; // true OR false - attempt to ignore zero in the following datasets:
$zero_as_null = array('windspd', 'windgust', 'windrun', 'HoursSun', 'Solar', 'HighUV'); // datasets to 'fix' - EDIT TO SUIT
Remove 'HoursSun' from the $zero_as_null = array(
Image
......................Imagine, what you will KNOW tomorrow !
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by BCJKiwi »

Tried that but I then get 0 instead of 0.0 and also all the table area that is normally blank (i.e. where there is no record data at all) is also filled with 0.
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Yet Another Dayfile Reader (PHP)

Post by beteljuice »

The problem is that it will only properly display data since the addition of the sensor :o

I'm afraid for the 'historical' stuff you are going to have to edit your dayfile.txt :groan:

See also https://cumulus.hosiene.co.uk/viewtopic.p ... &start=283 about HighUV
Image
......................Imagine, what you will KNOW tomorrow !
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by BCJKiwi »

Acknowledge the :groan:
I finally RTFM and have edited the historical EVT, Sunshine and Solar records in the dayfile.
Also removed sunHours from the sanitise section (evt was already removed).

However the sunshine was still showing 0 instead of 0.0 on days with no sun hours.
resolved that with the following change from this;

Code: Select all

        if ($dataSet == 'HoursSun'){ // based on code by Mark Crossley
            $decimals = 1; // special case - not handled elsewhere
            // 'width' is 24hr
            $part2 .= '><div class="meterCont"><span class="meterBar" style="width:' . min(round($thisValue / 24 * 100), 100) . '%"></span>' .
                       '<span class="meterTxt">' . round($thisValue, $decimals) . '</span></div><b></b';
            $native = $thisValue;
            $thisValue = '';
        }
to this;

Code: Select all

        if ($dataSet == 'HoursSun'){ // based on code by Mark Crossley
            // 'width' is 24hr
            $part2 .= '><div class="meterCont"><span class="meterBar" style="width:' . min(round($thisValue / 24 * 100), 100) . '%"></span>' .
                       '<span class="meterTxt">' . $thisValue = number_format((float)$thisValue, 1, '.' , '') . '</span></div><b></b';
            $native = $thisValue;
            $thisValue = '';
        }
Do you see any unintended repercussions with this approach?

Thanks
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Yet Another Dayfile Reader (PHP)

Post by beteljuice »

It's been awhile, and the 'bar graph' is Marks, but as long as that displays alright I think you're safe ... but I've been wrong before :o
Last edited by beteljuice on Thu 18 Dec 2014 2:49 am, edited 1 time in total.
Image
......................Imagine, what you will KNOW tomorrow !
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by BCJKiwi »

OK!

I'll keep an eye on it.
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by BCJKiwi »

OK, adjustments referred to in recent posts seem to be OK but a new issue arose.

One day's solar was not appearing (a white area where the number and coloured background should have been). The number is the solar max from the Davis sensor as recorded by Cumulus in Watts/m2. The max value that a Davis system can output is 1800 and on this day it was 1536 (an elevated value - bright sun and lots of reflected energy from many small white clouds - not a steady value). This value is recorded in dayfile.txt.

I found the solution here;

Code: Select all

// solar irradiance colours
$sunGrad0to10 = gradient('FFFF00','FF0000',1500); // value suggested by Graham64
in betel_readDayfile.php by changing the 1500 to 1800.
dygon
Posts: 24
Joined: Tue 02 Dec 2014 9:04 pm
Weather Station: Oregon WMR200
Operating System: windows 7
Location: Italia

Re: Yet Another Dayfile Reader (PHP)

Post by dygon »

Hello everyone, I downloaded the .zip file to the first post and I put all the files in a folder on my website / TABLE.
When I open the file basic.php tells me I can not find the file daytime.txt.
But I have to do this process by cumulus menu configuration / internet / file?
The file is in the folder daytime.txt Cumulus / data /

I am using the template of Sunset 'Weather By You'

thank you
Post Reply