Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.5 (build 3282) - 23 February 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

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 drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

SQL dayfile data Viewer

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

Moderator: daj

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

SQL dayfile data Viewer

Post by kocher »

Here is another way to see our daily data taken from the table, created by cumulusMX, "dayfile".

Demo: http://kocher.es/cumulusMX/datatables/e ... le-sql.php

This is possible thanks to the plugin created by https://www.datatables.net/

The advantages of this presentation in table form are:
- Speed. The query to our dayfile table is very fast.
- The columns are rearranged at will by simply pressing on a column heading.
- The last row of the table, presents a summary of the rows (The minimum temperature value, sometimes fails).
- The variables stand out with a color gradient, taken as a function of their value.
- The search is done in the format yyyy-mm-dd (the format of the field LogDate):

2016-10 filters the month of October 2016
-08-15 filters every day August 15th of every year

Installation:
- Download file: http://kocher.es/cajon/DataTables-cumulus-dayfile.rar (2221 KB)
- Unzip this file
- Install your content on our website, in a folder named as we want.

-Edit the file:

./examples/server_side/scripts/server_processing.php

Line 22: $ table = 'dayfile'; // sometimes called Dayfile

Lines 80-84:

Code: Select all

'User' => 'Our username',
'Pass' => 'Our password',
'Db' ​​=> 'Database name'
'Host' => 'The address of our mysql hosting'
Now, we call from our browser, to file:

../examples/server_side/dayfile-sql.php

I hope you find it useful :)
You do not have the required permissions to view the files attached to this post.
Last edited by kocher on Mon 07 Jan 2019 7:19 pm, edited 5 times in total.
Image
User avatar
PaulMy
Posts: 3760
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: SQL dayfile data Viewer

Post by PaulMy »

Very nice, and I am learning Spanish (not) http://www.komokaweather.com/mysql/data ... le-sql.php and it goes back to 2008-10

Thank you for sharing.

Enjoy,
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
Mapantz
Posts: 1772
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: SQL dayfile data Viewer

Post by Mapantz »

Nice work! I'll have a look later this evening.

You're right about how fast it is.. I typed 2016-01, 2016-02, 2016-03 etc etc.. and it is almost instantaneous. Great job. :)
Image
User avatar
grwkak
Posts: 169
Joined: Fri 28 Jun 2013 12:32 am
Weather Station: Davis Vantage Vue
Operating System: Windows 10
Location: Hambden, Ohio US
Contact:

Re: SQL dayfile data Viewer

Post by grwkak »

Also playing - like the speed and format.

http://wilsonsweather.host-ed.me/DataTa ... le-sql.php

Doing some conversion to English and Imperial units. Color codes will need adjusting. Not sure why but getting a NaN in the windrun sum.

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

Re: SQL dayfile data Viewer

Post by Mapantz »

Something missing from the package.. ;)
dataTables.scroller.js
Install that to: ../examples/resources

The table will now list the entire contents (pretty fast, I might add) which you can scroll through. It also automatically updates the text: Displaying 1 - 14 days from 328 days to show you exactly how many days are on view at a given time. :P

http://www.warehamwx.co.uk/cumulus/dayfile_sql.php
You do not have the required permissions to view the files attached to this post.
Last edited by Mapantz on Tue 03 Oct 2017 1:17 am, edited 2 times in total.
Image
User avatar
PaulMy
Posts: 3760
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: SQL dayfile data Viewer

Post by PaulMy »

Thanks kocher, I really like this. And doing the full db as per Mapantz update is great, thanks for that. This is something I always wished for but don't have the ability to do by myself.

Just a couple of interesting facts on my 3,013 days of data:
Of these 3013 days of data there were 1,119 days that had a low of below 0.0°C (days of frost)
Of the 3,013 days there were 400 days that had a high that was below 0.0°C (days that had frost all day).

Now if I could figure out how to add or show more of the dayfile.txt data, i.e. sunshine, heating and cooling degree days...

Enjoying,
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
kocher
Posts: 233
Joined: Sat 19 Apr 2014 7:57 pm
Weather Station: Davis Vantage Pro2+
Operating System: Windows 10
Location: San Sebastian - Spain
Contact:

Re: SQL dayfile data Viewer

Post by kocher »

I would like to add more variables to our table, but the reality is that I can not.
In the file "server_processing.php" yes, you can incorporate all the fields of the table dayfile;
but when you add any of them to the "dayfile-sql.php" file, everything stops working :groan:
Last edited by kocher on Thu 26 Jan 2017 10:13 pm, edited 1 time in total.
Image
Mapantz
Posts: 1772
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: SQL dayfile data Viewer

Post by Mapantz »

kocher wrote:I would like to add more variables to our table, but the reality is that I can not.
In the file "server_processing.php" yes you can incorporate all the fields of the table dayfile;
but when you add any of them to the "dayfile-sql.php" file, everything stops working :groan:
I don't really have enough brain power to do much to it. I could probably add solar radiation, as that would just about fit in to the table when using my custom widths. I suspect that you would need a horizontal scrollbar to fit in more contents such as humidity/degree days/dew point etc..

Maybe someone would be able to expand on it in the future, as it is a very useful script imo. :)
Image
User avatar
grwkak
Posts: 169
Joined: Fri 28 Jun 2013 12:32 am
Weather Station: Davis Vantage Vue
Operating System: Windows 10
Location: Hambden, Ohio US
Contact:

Re: SQL dayfile data Viewer

Post by grwkak »

Here is my php file adapted to US/imperial units. The color scales are adapted to the range of weather I see here in NE Ohio.
I do not know much about php etc so it could do with some cleaning up but it seems to work. Not sure about the pressure - may need to redo the colors.

Guy
dayfile-sql.zip
You do not have the required permissions to view the files attached to this post.
User avatar
BeaumarisWX
Posts: 356
Joined: Mon 09 Apr 2012 2:38 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 Pro Hades Canyon
Location: Beaumaris, Tasmania, AU
Contact:

Re: SQL dayfile data Viewer

Post by BeaumarisWX »

Thank you greatly Kocher and Mapantz.
I have adapted it to my Saratoga Template.
sfdayfilesql.png
Kind Regards,
You do not have the required permissions to view the files attached to this post.
Tony Beaumaris, Tasmania (AUS)

CMX Mobile : https://beaumaris-weather.com/BWX/
CMX Default: https://beaumaris-weather.com/cumulusmx_default/
Colour Dashboard : https://beaumaris-weather.com/dashborad_color.php
Click below for Saratoga Template :
Image
92merc
Posts: 55
Joined: Wed 15 Feb 2017 6:07 pm
Weather Station: Davis VP2
Operating System: Windows 11 Pro
Location: Bismarck, ND USA
Contact:

Re: SQL dayfile data Viewer

Post by 92merc »

Digging up an old thread here. I was able to get the dayfile scripts configured and uploaded. 2 issues hopefully someone can help with.

Can the Date format be changed to MM/DD/YYYY?

My totals at the bottom are in US, but the labels inside are coming up with metric instead of US. The numbers are right, just the labels are wrong.

Thanks.

http://www.bismarckweather.net/dayfile/ ... le-sql.php
User avatar
kocher
Posts: 233
Joined: Sat 19 Apr 2014 7:57 pm
Weather Station: Davis Vantage Pro2+
Operating System: Windows 10
Location: San Sebastian - Spain
Contact:

Re: SQL dayfile data Viewer

Post by kocher »


Can the Date format be changed to MM/DD/YYYY?
To change the date format. You must edit the file: "./server_side/scripts/server_processing.php"

Approximately, on line 39, you must change:

Code: Select all

		'formatter' => function( $d, $row ) {
			return date( 'Y/m/j', strtotime($d));
			
to

Code: Select all

		'formatter' => function( $d, $row ) {
			return date( 'm/j/Y', strtotime($d));
Image
92merc
Posts: 55
Joined: Wed 15 Feb 2017 6:07 pm
Weather Station: Davis VP2
Operating System: Windows 11 Pro
Location: Bismarck, ND USA
Contact:

Re: SQL dayfile data Viewer

Post by 92merc »

Thank you. And I saw my labels in the PHP file as well that I updated.
Warrandyte
Posts: 41
Joined: Sat 06 Apr 2013 11:46 pm
Weather Station: Fine Offset with Solar
Operating System: Windows XP, 7 8 and 10
Location: TIrrannaville NSW Australia

Re: SQL dayfile data Viewer

Post by Warrandyte »

Mapantz wrote:Something missing from the package.. ;)

dataTables.scroller.js

Install that to: ../examples/resources

The table will now list the entire contents (pretty fast, I might add) which you can scroll through. It also automatically updates the text: Displaying 1 - 14 days from 328 days to show you exactly how many days are on view at a given time. :P

http://www.warehamwx.co.uk/cumulus/dayfile-sql.php
Thanks. Done a great job on the site. Have you templated your creation?
Rob
Hunter362
Posts: 93
Joined: Tue 19 Oct 2010 12:20 am
Weather Station: Ambient Weather WS-2080
Operating System: Ubuntu 14.4
Location: Fairmount, New York (USA)
Contact:

Re: SQL dayfile data Viewer

Post by Hunter362 »

Where did you change the "highlight" code for the rows? I can't seem to find the right one.
Post Reply