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

Annual data Summary (DAJ script) - show day-of-week

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

Moderator: daj

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: Annual data Summary (DAJ script) - show day-of-week

Post by beteljuice »

CSS improved, included in updated files in post above.

NOTE: The .php page and any container you put it in should be encoded / declared as UTF-8 (NO BOM), else the wind direction arrows won't work ;)

Minimum php container requirements: (this is powering the test page)

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<link rel="stylesheet" type="text/css" media="screen" href="datasummary.css"  /> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js" type="text/javascript"></script>
</head>
<body>

<div id="tableData">
<?php include('readDayfile-colour.php');?>
</div>

</body>
</html>
regards - the beteljuice
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
PaulMy
Posts: 3849
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: Annual data Summary (DAJ script) - show day-of-week

Post by PaulMy »

Thank you very much Beteljuice, I've been working with this and making progress, but I am now further convinced I will never be a script author :cry:

Using your revised readDayfile I have eliminated some duplication that I had with the non-colour and colour versions along with my Cumulus and Saratoga template sites. Now only have the colour version on both. It works great in the Cumulus site http://www.komokaweather.com/weather/da ... olour1.php, however the day names do not appear/popup on the Saratoga site http://www.komokaweather.ca/wxhistorical-colour1.php. I have tried many different ways but without success. Possibly some PHP conflict with these templates :?:

I also have experimented by adding additional data columns for Rain Rate, Max and Min Pressure, and Heat and Cool Degree days (borrowed the idea from Mark's post). Still a lot of work to do to get them right as some of the titles are wrong and some data not shown http://www.komokaweather.com/weather/datasummary2.php and I will try to understand the dayfile data to get the correct columns for the applicable data, but it has been a good assignment ;)

Again thanks for steering me in the right direction, and I will continue along, but I will likely forget tomorrow much what I have learned today :x .

Paul
Last edited by PaulMy on Fri 03 Jan 2014 12:15 am, edited 1 time in total.
VP2+
C1 www.komokaweather.com/komokaweather-ca
MX https://komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX https://komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX https:// 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: Annual data Summary (DAJ script) - show day-of-week

Post by beteljuice »

paul wrote:however the day names do not appear/popup on the Saratoga site ...
Because you haven't added the datasummary stylesheet to the page
Edit: Nor have you called Jquery ;)

Note: I've just discovered everything goes sick on Jan 1st. - hopefully it will recover !

Happy New Year !
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
mcrossley
Posts: 12763
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by mcrossley »

I have updated my version to include hiding the dates that are not applicable to the current month, and fix the 1st Jan bug. Sorry beteljuice, but I have removed all the old commented out code, it was just getting too messy. :(

Now I guess I'll have to transfer this to my PHP code. :bash:
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: Annual data Summary (DAJ script) - show day-of-week

Post by beteljuice »

@mark - PHP Jan 1st bug is really a "no data default (current) year thing". The only reason it showed up was because my UK server was getting Pauls US data)
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
mcrossley
Posts: 12763
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by mcrossley »

Thanks beteljuice, I see the fix is already in the PHP version for the 1st Jan.

As an aside, I have implemented the DoW in my 'live' data summary page, but I have also converted it to source the data from a MySQL database rather than the dayfile.txt - something I have been meaning to look at for some time (and maybe useful for the next generation of Cumulus). I also removed the dual column option for min/max temp as it complicated the code and I didn't really ever view it. I expect the resulting code now needs a good going over and tidying up!
User avatar
N0BGS
Posts: 205
Joined: Sat 10 Nov 2012 2:26 am
Weather Station: Davis Vantage Pro 2
Operating System: Win10vm,VMWare ESXi 7.0
Location: Hermon, Maine USA
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by N0BGS »

Interesting stuff.

I'm trying to convert the column colors to Farenheit scale.

Which is apparently done here:

Code: Select all

}

function tempColour($temp) {
    global $tempGrad;
    $txtCol = ($temp <= 0 ? 'DDD' : ($temp >= 0) ? 'FFF' : '000');
    $scaledVal = 100 + ($temp * 10);
    $scaledVal = ($scaledVal < 0 ? 0 : ($scaledVal > 399 ? 399 : $scaledVal));
    return array($tempGrad[$scaledVal], $txtCol);
}
When I change the 0 values to 32 the graph looks really hot. :)

I will keep experimenting but if one of you knows the correct values for the F conversion please do share.

Thanks,

--Kurt
Blitzortung Station 1809
User avatar
PaulMy
Posts: 3849
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: Annual data Summary (DAJ script) - show day-of-week

Post by PaulMy »

Finally got the Saratoga site to display correctly http://www.komokaweather.ca/wxhistorical-colour1.php Thanks for your help beteljuice :clap:

Now on to the next modification :idea:
Paul
VP2+
C1 www.komokaweather.com/komokaweather-ca
MX https://komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX https://komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX https:// 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: Annual data Summary (DAJ script) - show day-of-week

Post by beteljuice »

@ N0BGS

That looks like yet another version - the one Mark and I are 'playing' with is much more involved than that for the temp colours !

Probably the easiest thing for you to do is to convert the temp being 'processed' to deg C
(This shouldn't affect the displayed temp)

EDIT: Was a $process_temp= missing on text decision line - thank you Mark !

Code: Select all

function tempColour($temp) {
    global $tempGrad;
    $process_temp = ($temp -32) * 0.5555; // F to C conversion
    $txtCol = ($process_temp <= 0 ? 'DDD' : ($process_temp >= 0) ? 'FFF' : '000'); // contrast text decision
    $scaledVal = 100 + ($process_temp * 10);
    $scaledVal = ($scaledVal < 0 ? 0 : ($scaledVal > 399 ? 399 : $scaledVal)); // Are these values correct ?
    return array($tempGrad[$scaledVal], $txtCol);
}


The current beteljuice plaything (not guaranteed to be working !)
Last edited by beteljuice on Sun 05 Jan 2014 12:43 pm, edited 1 time in total.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
N0BGS
Posts: 205
Joined: Sat 10 Nov 2012 2:26 am
Weather Station: Davis Vantage Pro 2
Operating System: Win10vm,VMWare ESXi 7.0
Location: Hermon, Maine USA
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by N0BGS »

Oh, nice! That seems to have done it. Thanks much.

Now, I'll have to adjust the other color values.

Experimental pages is here: http://www.kpw3.com/c.php

--Kurt
Blitzortung Station 1809
User avatar
mcrossley
Posts: 12763
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by mcrossley »

beteljuice wrote:@ N0BGS

That looks like yet another version - the one Mark and I are 'playing' with is much more involved than that for the temp colours !
That has been lifted from my current live page, I have refactored my code a bit to clean it up. It should now no longer be considered 'standard' in any way.
betejuice wrote: Probably the easiest thing for you to do is to convert the temp being 'processed' to deg C
(This shouldn't affect the displayed temp)

Code: Select all

function tempColour($temp) {
    global $tempGrad;
    $process_temp = ($temp -32) * 0.5555; // F to C conversion
    $txtCol = ($process_temp <= 0 ? 'DDD' : ($temp >= 0) ? 'FFF' : '000'); // contrast text decision
    $scaledVal = 100 + ($process_temp * 10);
    $scaledVal = ($scaledVal < 0 ? 0 : ($scaledVal > 399 ? 399 : $scaledVal)); // Are these values correct ?
    return array($tempGrad[$scaledVal], $txtCol);
}


The current beteljuice plaything (not guaranteed to be working !)
Yep, definitely the simplest solution. Though on the $txtCol = line there is a second $temp variable that needs converting to $process_temp.
User avatar
jdc
Posts: 142
Joined: Tue 19 Jun 2012 8:51 pm
Weather Station: Davis VP2 : Instromet
Operating System: Win 10
Location: Portsoy,.
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by jdc »

Once again 'Thank you' to you both. Great stuff!

I had been trying to doing it in php and stagger the month column day 1 position and frankly I was in a real mess. :roll:
User avatar
PaulMy
Posts: 3849
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: Annual data Summary (DAJ script) - show day-of-week

Post by PaulMy »

I am a few steps/versions behind, but have added additional data items http://www.komokaweather.com/weather/da ... olour2.php :D Now studying how the colour is done to see if I can successfully add that to the new data pages.

Paul
VP2+
C1 www.komokaweather.com/komokaweather-ca
MX https://komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX https://komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX https:// komokaweather.com/cumulusmx4/index.htm
Image
kapo
Posts: 246
Joined: Thu 03 Jan 2013 1:59 pm
Weather Station: Davis VP2
Operating System: Windows 10
Location: Vihtavuori, Laukaa, Finland

Re: Annual data Summary (DAJ script) - show day-of-week

Post by kapo »

Hi!
Thank You Mark about that code, which reads values from MySQL!!! Finally I have something to do with my databases... http://www.kapo511.net/wxannualDatasummary.php . Now I am trying (=read making faults) to make a table, which shows dynamically Weatherwalues backwards for example one week, one month, one year from this time. I have database named "Monthly" where is saved values in period of one minute... With that I could make my little table in front page to show how my weather seemed f.e. four months ago... A little bit advice should be welcome... I have not gotten further than this plan yet :oops: :oops: :oops: I would be grateful for even the slightest help to get started on this project.... :idea: :oops:
User avatar
mcrossley
Posts: 12763
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by mcrossley »

@PaulMy, coming on, the colours are 'precalculated' and put into arrays rather than being calculated on the fly. I created an array element for each possible data value within the range, so if the data has one decimal place, and you want colours for a range of 10, you need 100 array elements.

@kapo, that seems to be working OK :)

For your 'on this day' data, do you want the data from the same time on the past day as now? Is you web server in the same time-zone as your station?
Post Reply