Page 14 of 55

Re: Yet Another Dayfile Reader (PHP)

Posted: Sun 16 Feb 2014 11:58 pm
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:

Re: Yet Another Dayfile Reader (PHP)

Posted: Mon 17 Feb 2014 7:47 am
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.

Re: Yet Another Dayfile Reader (PHP)

Posted: Mon 17 Feb 2014 8:05 am
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!

Re: Yet Another Dayfile Reader (PHP)

Posted: Mon 17 Feb 2014 2:29 pm
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')
),

Re: Yet Another Dayfile Reader (PHP)

Posted: Tue 18 Feb 2014 2:19 am
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:

Re: Yet Another Dayfile Reader (PHP)

Posted: Tue 18 Feb 2014 10:45 am
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.

Re: Yet Another Dayfile Reader (PHP)

Posted: Tue 18 Feb 2014 11:18 am
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.)

Re: Yet Another Dayfile Reader (PHP)

Posted: Tue 18 Feb 2014 1:21 pm
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
*/

Re: Yet Another Dayfile Reader (PHP)

Posted: Tue 18 Feb 2014 2:05 pm
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!

Re: Yet Another Dayfile Reader (PHP)

Posted: Tue 18 Feb 2014 5:22 pm
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:

Re: Yet Another Dayfile Reader (PHP)

Posted: Wed 19 Feb 2014 1:01 am
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 ...

Re: Yet Another Dayfile Reader (PHP)

Posted: Wed 19 Feb 2014 2:11 am
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

Re: Yet Another Dayfile Reader (PHP)

Posted: Wed 19 Feb 2014 7:22 am
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).

Re: Yet Another Dayfile Reader (PHP)

Posted: Wed 19 Feb 2014 9:42 am
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>

Re: Yet Another Dayfile Reader (PHP)

Posted: Wed 19 Feb 2014 9:48 am
by beteljuice
Told you the beteljuice hates CSS. I'll investigate later ...