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
KarlS
Posts: 136
Joined: Tue 30 Nov 2010 3:01 pm
Weather Station: Ecowitt GW1003 / WH32 / WH41
Operating System: 64bit Bookworm on Pi4
Location: Bridge Lake, BC, Canada
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by KarlS »

Hi Beteljuice:

I found this "error" because right now I'm doing a complete re-write of your script. The main reason was: I do have a MySQL database with all the dayfile data, and all the missing data are stored as NULL. So, calculating averages etc. is straight forward. And: the page loads noticeably faster this way …

Also, living in Canada with 5+ month of winter, snow is a very important weather factor. My dayfile table therefore contains daily data for snowfall and snow depth. Instead of adding my specific routines to your script every time you have a new version, I decided to do my own. It’s not finished yet, but you can try an early beta <here>. (For some reason, it only works in Firefox right now. IE and Chrome freeze after the initial display. Baffles me)

And, as soon as I find some time, I will do a German translation for your script …

Edit: Note that FO stations, at least the older stations using the OOK transmission protocol, max out (or better: min out) at -40C, so there probably are no extreme cold temps to display. At one time, my trusted old alcohol thermometer showed -44C, while the FO showed -39.8C :cry:
Last edited by KarlS on Wed 19 Feb 2014 12:58 am, edited 1 time in total.
westonweather
Posts: 166
Joined: Sun 29 Dec 2013 8:37 am
Weather Station: WMR88
Operating System: Windows 7
Location: Weston-super-Mare
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by westonweather »

beteljuice wrote:Guess What ? New Release

Download on first post ..

16 Feb 2014 - v1.5
  • Several new tweaks to stop twitch error reports.
    *NEW* Temperature colour gradient and logic changed.
    FIX - heat / cooling day unit conversion (Thanks Karl)
Nice! You fixed the problem I had with "May" being emtpy and every other month havin 0.0 in them.

http://www.westonweather.co.uk/daybyday.php

I don't see any errors at all now when the script first loads, haven't done since the one time it happened when I moved everything on to the new server.
westonweather
Posts: 166
Joined: Sun 29 Dec 2013 8:37 am
Weather Station: WMR88
Operating System: Windows 7
Location: Weston-super-Mare
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by westonweather »

Update: Since update, Wind Speeds are all returning ZERO. Anything to do with wind speed that is.

edit - ignore my babling. Re-uploaded and all good. May have overtyped something in error when changing "true" to "false" on a few of the arrays - probably. Oops!
User avatar
KarlS
Posts: 136
Joined: Tue 30 Nov 2010 3:01 pm
Weather Station: Ecowitt GW1003 / WH32 / WH41
Operating System: 64bit Bookworm on Pi4
Location: Bridge Lake, BC, Canada
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by KarlS »

As promised, a German translation. I couldn't find an equivalent for Wind Run, so I left the English expression. Also please note, the line for 'tdiff' is missing in the 'mylang' examples, which leads to an empty button ...

Code: Select all

'de' => array(
		'daily' => 'Täglich', // drop-down table selector
		'seasonal' => 'Saisonal', // drop-down table selector
		'note' => array('Achtung','Daten unvollständig.', '0 wird als fehlender Wert behandelt !'),
		'loading' => 'Daten werden gelesen ...',
		'fail' => 'Daten FEHLER !!!',
		'total' => '&#931;',
		'avg' => '&#8960;',
		'hi' => 'Hoch',
		'lo' => 'Tief',
		'dom' => 'Dom', // short for dominant (wind direction)
		'season_1' => '<img src="snowflake.png" height="22px" alt="Winter" />Winter', // previous Dec, Jan, Feb
		'season_2' => '<img src="daffodil.png" height="22px" alt="Frühling" />Frühling', // Mar, Apr, May
		'season_3' => '<img src="sun.png" height="22px" alt="Sommer" />Sommer', // Jun, Jul, Aug
		'season_4' => '<img src="leaf.gif" height="22px" alt="Herbst" />Herbst', // Sep, Oct, Nov
		'mn' => array('Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'),
		'dy' => array('So','Mo','Di','Mi','Do','Fr','Sa'),
		'compass_headings' => array('N&nbsp;&#x2193;','NO&nbsp;&#x2199;','O&nbsp;&#x2190;','SO&nbsp;&#x2196;','S&nbsp;&#x2191;','SW&nbsp;&#x2197;','W&nbsp;&#x2192;','NW&nbsp;&#x2198;','N&nbsp;&#x2193;'),
		'maxtemp' => array('Max Temp', 'Maximale Temperatur'),
		'mintemp' => array('Min Temp', 'Minimale Temperatur'),
		'tdiff' => array('T&deg; Diff', 'T&deg; Unterschied'),
		'avgtemp' => array('&#8960; Temp', 'Durchschn. Temperatur'),
		'tappmax' => array('Max gef T', 'Maximale gefühlte Temperatur'),
		'tappmin' => array('Min gef T', 'Minimale gefühlte Temperatur'),
		'dpmax' => array('Max TauP', 'Maximaler Taupunkt'),
		'dpmin' => array('Min TauP', 'Minimaler Taupunkt'),
		'rhmax' => array('Max RL', 'Maximale Relative Luftfeuchtigkeit %'),
		'rhmin' => array('Min RL', 'Minimale Relative Luftfeuchtigkeit %'),
		'rainfall' => array('Regen', 'Regen'),
		'windspd' => array('Windgeschw', 'Höchste Windgeschwindigkeit'),
		'windgust' => array('Windböen', 'Höchste Windböen'),
		'windrun' => array('Wind Run', 'Wind Run'),
		'winddir' => array('Windricht', 'Dominante Windrichtung'),
		'baromax' => array('Max LD', 'Maximaler Luftdruck'),
		'baromin' => array('Min LD', 'Minimaler Luftdruck'),
		'HoursSun' => array('S.schein', 'Stunden Sonnenschein'),
		'Solar' => array('Solar', 'Sonnen Energie W/m&sup2;'),
		'HighUV' => array('UV Index', 'UV Index'),
		'evt' => array('EVT', 'Evapotranspiration'),
		'heatday' => array('Heiz-Tag', 'Heiz-Tag'),
		'coolday' => array('Kühl-Tag', 'Kühl-Tag')
),
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 »

Non-essential update V1.5.1 - Feb 18

Language file includes [de] (thanks KarlS) - languages also available as a seperate download.
Main file now has an antipodean switch to 'flip' season descriptions.
"How To ..." file updated.

Hey ... we went 48hrs ... :lol:
Image
......................Imagine, what you will KNOW tomorrow !
nossis
Posts: 89
Joined: Wed 28 Nov 2012 6:12 am
Weather Station: Davis Vantage Pro 2
Operating System: Win 10
Location: Perth AU
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by nossis »

I have to recant my commendation of the colour scheme being spot on for me. However this is not to detract from all the work being sensational!
It seem that it was remembering the old colour scheme that I had setup, when I implemented the new file. For some reason when I play around with the colours in temp gradient, say shift the green to be around the 10 deg as opposed to 0 deg, for arguments sake. I not able to see the new scheme applied on my site after uploading the changed file
The area that I am playing in is "$tempGrad = array_merge(" , the gradient colour values.
Is this the right place or am I missing something?
Have tired the silly things like empty cache browser and page refresh etc.
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 »

On your site ATM I'm getting these gradients (yours)

Code: Select all

$tempGrad = array_merge(
                gradient('3D0060','6100A7',100), // -50 > -40
                gradient('6100A7','0D26A1',100), // -40 > -30
                gradient('0D26A1','311BE1',100), // -30 > -20
                gradient('311BE1','0040F5',100), // -20 > -10
                gradient('0040F5','009CF8',100),  // -10 > 0
                gradient('009CF8','11ADB1',100),  // 0 > 10
                gradient('11ADB1','22DD2C',100),  // 10 > 20
                gradient('22DD2C','FFDD00',100),  // 20 > 30
                gradient('FFDD00','FF0000',100),  // 30 > 40
                gradient('FF0000','640000',100)  // 40 > 50
            );
BTW - you're missing some css, (format_note etc.)
Image
......................Imagine, what you will KNOW tomorrow !
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 »

These are the temperature >gradients as supplied<

Should you wish to play without destroying your main file too much ...
gradient.zip
Edit: Due to the apparent popularity of this file (Does that mean you don't like 'my' colours ?)
A little more guidance:

Code: Select all

// temperature gradient colours - edit to suit
/* The main prog is looking -50 => +50 in tenths of degree C
   Thus the TOTAL number of gradients should be 1000 (1001 - don't ask)
   0 (zero) will at gradient #500
*/
You do not have the required permissions to view the files attached to this post.
Last edited by beteljuice on Wed 19 Feb 2014 12:46 am, edited 2 times in total.
Image
......................Imagine, what you will KNOW tomorrow !
nossis
Posts: 89
Joined: Wed 28 Nov 2012 6:12 am
Weather Station: Davis Vantage Pro 2
Operating System: Win 10
Location: Perth AU
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by nossis »

Firstly thanks for the cool tool!
With some testing... it lead me to my find and the answer
Line 1276 of the readyDay file php.
On my site I had renamed it to just that "readDayfile.php and not "betel_readDayfile.php" (made it easier to play with one and have both running). What was happening was that I would make some changes to the gradients (in my file) and then upload the file, F5 for refresh (in the browser) and that would work on first page of data for 2014 max temps. But as soon as I went to another area say min temp, it would revert to the old gradients. This got me thinking then, (since with the flash new gradient tool, that is way clever by the way) there must be another link outside to something else... Found it line 1276, a reference to "betel_readDayfile.php", changed it to back my file and hey presto gradients across the pages as expected..... Then I remembered that I had done that one before in the earlier builds and hadn't noted it to make that change as a customisation. So duely noted. :oops:
A thousand thank yous!
bnwrx
Posts: 464
Joined: Wed 25 Feb 2009 12:01 am
Weather Station: Ambient WS2095 (Fine/Offset)
Operating System: Windows 10 64bit
Location: Woodland Park, Colorado USA
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by bnwrx »

I use an "HTML" Dayfile reader. Is there a way to include and display the "Seasonal" data on an HTML page?

UPDATE: Please disregard this Q, I am working with the PHP version....just treading water at this point!!! :oops:
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 »

@ brnwx - I'm glad about that :lol:

@ ALL

Gradients post above edited with a little extra info.

Bloody Foreigners !

Or to be more precise anybody who doesn't share your 'native' tongue.

The 'buttons' always were a cosmetic nicety which required a bit of fiddling both with wording and line-wrap count.

They just fall apart when trying to be multilingual Edit: Tweaked in css :clap:
Edit: If it doesn't look right good - force a refresh (for the css to reload)


Unfortunately, the only way I can work around this is a dropdown option which is still a very tight fit in some languages, and isn't quite so well formated to the eye. Edit: - link removed, no longer relevant

Edit: Sorry, should have been clearer. The site owner would be able to choose 'buttons' or 'dropdown' as the style for the page.

As ever - your thoughts please ...
Last edited by beteljuice on Mon 02 Jun 2014 11:59 am, edited 3 times 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 »

EDIT:- comments below relate to a Saratoga setup where languages are selected through the header, not individual scripts.
My vote:-
Neither,
i.e. leave it the way it is, if you need to support languages then adjust the number of buttons per row and/or the space between buttons in the .css to suit the widest combination.

With 9 buttons per row in the 750 width
and in the css;
#table_menu li, margin-right: 8px; /* 13px; */
does it for me, (fr being the widest)

But of course YMMV
Last edited by BCJKiwi on Wed 19 Feb 2014 11:17 pm, edited 1 time in total.
westonweather
Posts: 166
Joined: Sun 29 Dec 2013 8:37 am
Weather Station: WMR88
Operating System: Windows 7
Location: Weston-super-Mare
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by westonweather »

Either works for me.

I've stripped out the Arrays that I do not need (set to False as per instructions) and set my width to 9 buttons, which is fine on the screen I'm currently on, but not so on iPad etc, so a drop down would work better for a multitude of devices I guess. (Assumes your drop down works on iPad / nips off to check...)

My dayfile reader with 9 buttons per row: http://www.westonweather.co.uk/daybyday.php

Edit - yes, your drop down works fine on IOS (iPAD).
User avatar
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by mcrossley »

OK, why not put all the buttons (<li> ) in a single <ul>, change the li style to display: inline-block, and add a bottom margin of 10px. The buttons will then flow to whatever width you decide.

Code: Select all

#table_menu li {
margin-right: 13px;
margin-bottom: 10px;
padding: 3px 5px 3px 5px;
border: 2px solid #999999;
background-color: #FFF;
border-radius: 5px;
-moz-border-radius: 5px;
box-shadow: 3px 3px 3px #B0C4DE;
display: inline-block;
}

Code: Select all

<div id="table_menu">
	<ul>
		<li class="picked"><a href="javascript:doesforme('?year=2014&data=maxtemp&disp=t0r0w2b0')">Max Temp</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=mintemp&disp=t0r0w2b0')">Min Temp</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=tdiff&disp=t0r0w2b0')">T° Diff</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=avgtemp&disp=t0r0w2b0')">Avg Temp</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=tappmax&disp=t0r0w2b0')">Max T° App</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=tappmin&disp=t0r0w2b0')">Min T° App</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=dpmax&disp=t0r0w2b0')">Max DP</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=dpmin&disp=t0r0w2b0')">Min DP</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=rhmax&disp=t0r0w2b0')">Max RH</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=rhmin&disp=t0r0w2b0')">Min RH</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=rainfall&disp=t0r0w2b0')">Rainfall</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=windspd&disp=t0r0w2b0')">Wind Speed</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=windgust&disp=t0r0w2b0')">Wind Gust</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=windrun&disp=t0r0w2b0')">Wind Run</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=winddir&disp=t0r0w2b0')">Wind Dir</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=baromax&disp=t0r0w2b0')">Baro Max</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=baromin&disp=t0r0w2b0')">Baro Min</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=HoursSun&disp=t0r0w2b0')">Sunshine</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=Solar&disp=t0r0w2b0')">Solar</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=HighUV&disp=t0r0w2b0')">UV Index</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=evt&disp=t0r0w2b0')">EVT</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=heatday&disp=t0r0w2b0')">Heating Day</a></li>
		<li><a href="javascript:doesforme('?year=2014&data=coolday&disp=t0r0w2b0')">Cooling Day</a></li>
	</ul>
......
</div>
Last edited by mcrossley on Wed 19 Feb 2014 9:49 am, edited 1 time in total.
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 »

Told you the beteljuice hates CSS. I'll investigate later ...
Image
......................Imagine, what you will KNOW tomorrow !
Post Reply