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 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

Lowest Monthly Rainfall record desired on website

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

Moderator: daj

RayProudfoot
Posts: 3372
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Lowest Monthly Rainfall record desired on website

Post by RayProudfoot »

For many years my website has remained pretty much unchanged but with this recent dry spell in the UK I was curious about the driest month record for each month.

Cumulus has a tag for wettest month but not driest. I can't imagine Steve is going to add any new tags now as Cumulus 1 has been mothballed for quite some time.

But this is where my Access database comes in useful. I have created a crosstab query that shows rainfall for each month by year. I was hoping to amend my monthly records page and add the driest month manually.

But I can't because that page is controlled by PHP and I know bugger all about PHP. :(

Here is my query. Is it possible for some kind soul to help integrate this into my Monthly Records?
http://www.cheadlehulmeweather.co.uk/monthlyrecord.htm
RainfallByYearAndMonth.png
You do not have the required permissions to view the files attached to this post.
Cheers,
Ray, Cheshire.

Image
RayProudfoot
Posts: 3372
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: Lowest Monthly Rainfall record desired on website

Post by RayProudfoot »

I did a bit of digging and have established that the highest monthly rainfall is held in a variable named MonthlyRainH.

Further down monthlyrecordT.htm is an array that is the basis for this record:-

var monthlyrain = new Array("<#ByMonthMonthlyRainH mon=1>","<#ByMonthMonthlyRainH mon=2>","<#ByMonthMonthlyRainH mon=3>","<#ByMonthMonthlyRainH mon=4>","<#ByMonthMonthlyRainH mon=5>","<#ByMonthMonthlyRainH mon=6>","<#ByMonthMonthlyRainH mon=7>","<#ByMonthMonthlyRainH mon=8>","<#ByMonthMonthlyRainH mon=9>","<#ByMonthMonthlyRainH mon=10>","<#ByMonthMonthlyRainH mon=11>","<#ByMonthMonthlyRainH mon=12>");

Does this info rely on a tag within Cumulus to get its data? If it does then I'm probably stuffed. But if it doesn't then it seems it could be derived.
Cheers,
Ray, Cheshire.

Image
RayProudfoot
Posts: 3372
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: Lowest Monthly Rainfall record desired on website

Post by RayProudfoot »

Damn. :( As I suspected <#ByMonthMonthlyRainH> is a webtag in Cumulus 1. Unfortunately there is no equivalent for Lowest Monthly Rainfall so it looks I can't implement it.
Cheers,
Ray, Cheshire.

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

Re: Lowest Monthly Rainfall record desired on website

Post by mcrossley »

You need a MySQL database on your server Ray :)

Easy to add this and other things like runs of wet/dry days, sunshine etc...
http://weather.wilmslowastro.com/records_monthly.php
RayProudfoot
Posts: 3372
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: Lowest Monthly Rainfall record desired on website

Post by RayProudfoot »

Mark,

How much work is involved in that? Switching to Cumulus MX?
Cheers,
Ray, Cheshire.

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

Re: Lowest Monthly Rainfall record desired on website

Post by mcrossley »

MX makes it easier, but you can stay with Cumulus 1 and use the ImportCumulus script to import the dayfile once a day after midnight (and monthly data file as well if you like - though that is not used as much).
User avatar
PaulMy
Posts: 3775
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: Lowest Monthly Rainfall record desired on website

Post by PaulMy »

Hi Ray,
I am still using Cumulus 1 and do what Mark is saying, use the ImportCumulus script to import the dayfile in my website MySQL database, once a day after midnight using the Cumulus toolbox for that scheduling, and manually import the monthly log files as well (also do it for realtime.txt).

However I am very limited to using all that data. I have only a few scripts, mostly obtained here on the forum, that provide any output. I should take some more time to get back in to this and see what I can do.

Good luck,
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
RayProudfoot
Posts: 3372
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: Lowest Monthly Rainfall record desired on website

Post by RayProudfoot »

mcrossley wrote:MX makes it easier, but you can stay with Cumulus 1 and use the ImportCumulus script to import the dayfile once a day after midnight (and monthly data file as well if you like - though that is not used as much).
Thanks Mark. I'll take a look at what's involved.
Cheers,
Ray, Cheshire.

Image
RayProudfoot
Posts: 3372
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: Lowest Monthly Rainfall record desired on website

Post by RayProudfoot »

PaulMy wrote:Hi Ray,
I am still using Cumulus 1 and do what Mark is saying, use the ImportCumulus script to import the dayfile in my website MySQL database, once a day after midnight using the Cumulus toolbox for that scheduling, and manually import the monthly log files as well (also do it for realtime.txt).

However I am very limited to using all that data. I have only a few scripts, mostly obtained here on the forum, that provide any output. I should take some more time to get back in to this and see what I can do.

Good luck,
Paul
Thanks Paul. Looks like I'm going back to school all over again. It's not an immediate requirement but long-term I'd like to include these extra records.
Cheers,
Ray, Cheshire.

Image
User avatar
steve
Cumulus Author
Posts: 26702
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Lowest Monthly Rainfall record desired on website

Post by steve »

I agree that a MySQL database is the 'superior' way to do this, but you can do it with what you have if you can write the results of your database query to a text file on your PC. Cumulus could then upload this as an 'extra file' and some additional Javascript (that's what the code is, rather than PHP) could read that file from the server and put the values onto the web page.
Steve
RayProudfoot
Posts: 3372
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: Lowest Monthly Rainfall record desired on website

Post by RayProudfoot »

Hi Steve,

This is the result of outputting the data to a plain text file. The titles are optional. The delimiters can be changed to whatever Java prefers.

"Year","1","2","3","4","5","6","7","8","9","10","11","12"
2009,,,,,2.74,2.70,5.64,2.21,1.60,1.50,6.08,2.92
2010,1.44,2.35,1.99,0.92,0.47,2.20,2.86,4.99,3.73,3.33,2.52,0.81
2011,2.25,5.20,0.68,0.61,2.60,2.08,3.12,2.50,1.81,3.85,1.96,7.21
2012,3.97,1.67,0.86,4.84,2.11,5.10,4.49,2.81,4.07,2.35,2.65,5.34
2013,2.05,1.51,1.07,0.70,2.53,2.43,4.21,2.49,2.69,4.64,2.46,3.18
2014,4.01,3.20,1.97,1.57,3.92,1.87,2.15,4.69,0.43,3.22,2.58,4.90
2015,3.65,2.17,3.49,1.11,4.05,2.02,2.72,3.64,1.69,1.63,5.77,4.50
2016,3.79,3.63,3.70,3.56,1.54,6.11,2.73,2.65,3.77,1.23,3.47,1.73
2017,2.92,2.72,3.62,0.64,0.00,,,,,,,

Could the Java script add it to the existing MonthlyRecordT.htm or would it have to go to a separate one? That wouldn't be desirable for obvious reasons.

Oh, just one other thing. The Access database is on another PC, not the one running Cumulus. Each time I open it it clears down the table holding the dayfile.txt info and reimports it. I suppose it's straight-forward enough to export the text file back to the Cumulus netbook.
Cheers,
Ray, Cheshire.

Image
User avatar
steve
Cumulus Author
Posts: 26702
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Lowest Monthly Rainfall record desired on website

Post by steve »

That looks reasonably straightforward, some new Javascript code could read in those values and put them in arrays, one array per month, and then find the minimum in each array, and its index. This could then form new arrays like the ones for highest monthly rainfall, and the existing code could be modified to put those values into new locations on the page like it does for the existing values.

As the values in your array would only change at the end of each month, you could upload the file manually then. You need to make sure your code doesn't include the current month, because that would show as the driest month (e.g. the zero for this month in your example) but the month hasn't finished yet, so really it doesn't count.

I'll have a go at some code later. And then Mark can show us some better code :lol:
Steve
RayProudfoot
Posts: 3372
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: Lowest Monthly Rainfall record desired on website

Post by RayProudfoot »

Steve. What would I do without you? Thanks very much! :clap: Easy enough to exclude the current month.
Cheers,
Ray, Cheshire.

Image
User avatar
PaulMy
Posts: 3775
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: Lowest Monthly Rainfall record desired on website

Post by PaulMy »

Steve. What would I do without you?
And there are others observing/borrowing as well :)

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
mcrossley
Posts: 12689
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Lowest Monthly Rainfall record desired on website

Post by mcrossley »

I don't have time to code up a full solution, but this should be a start?...

Code: Select all

// Do some AJAX to get this content from the server
// Simulated here...
var file = '"Year","1","2","3","4","5","6","7","8","9","10","11","12"\r\n2009,,,,,2.74,2.70,5.64,2.21,1.60,1.50,6.08,2.92\r\n2010,1.44,2.35,1.99,0.92,0.47,2.20,2.86,4.99,3.73,3.33,2.52,0.81\r\n2011,2.25,5.20,0.68,0.61,2.60,2.08,3.12,2.50,1.81,3.85,1.96,7.21\r\n2012,3.97,1.67,0.86,4.84,2.11,5.10,4.49,2.81,4.07,2.35,2.65,5.34\r\n2013,2.05,1.51,1.07,0.70,2.53,2.43,4.21,2.49,2.69,4.64,2.46,3.18\r\n2014,4.01,3.20,1.97,1.57,3.92,1.87,2.15,4.69,0.43,3.22,2.58,4.90\r\n2015,3.65,2.17,3.49,1.11,4.05,2.02,2.72,3.64,1.69,1.63,5.77,4.50\r\n2016,3.79,3.63,3.70,3.56,1.54,6.11,2.73,2.65,3.77,1.23,3.47,1.73\r\n2017,2.92,2.72,3.62,0.64,,,,,,,,';

var lines = file.split("\r\n");
var fields = [];
var lowMonthlyRain = [999,999,999,999,999,999,999,999,999,999,999,999];
var lowMonthlyRainT = [];


for (var y=1; y<lines.length; y++) {
	// now extract the records
	fields = lines[y].split(',');
	for (var m=1; m<fields.length; m++) {
		if (fields[m] !== '' && +fields[m] < records[m-1]) {
			lowMonthlyRain[m-1] = fields[m];
			lowMonthlyRainT[m-1] = fields[0];
		}
	}
}

// Now populate the 'new' HTML fields
document.getElementById('lowMonthlyRain').innerHTML = lowMonthlyRain[month];
document.getElementById('lowMonthlyRainT').innerHTML = lowMonthlyRainT[month];

// and add the above HTML updates to the changeData() function
Post Reply