Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 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

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

Radar/Rose Graph data formula?

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

Moderator: daj

Post Reply
User avatar
gwheelo
Posts: 453
Joined: Wed 11 Jun 2008 7:36 pm
Weather Station: WMR-88
Operating System: Windows 8.1
Location: L'Estartit, Spain
Contact:

Radar/Rose Graph data formula?

Post by gwheelo »

Can anyone supply a script to convert "wspddata" & wdirdata" to 8 0r 16 sector bearing with average speed for each sector. What I think I need is an array such as [8,17,31,21,23,42,5,10] which will represent NNE @ 8k/h, ENE @ 17k/h.........

or ................ maybe there is/are a better webtag/s solution for Radar/Rose Graph generation - could also include extra data point to create a "Stacked" Radar/Rose graph with as an example 0-15k/h in green, 16 - 25k/h in blue, 26 - 35k/h in red, etc..

The data will be used to generate a Radar/Rose Radial chart using HTML Canvas.

Any advice , script, formula, or ideas are welcome.

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

Re: Radar/Rose Graph data formula?

Post by mcrossley »

George

Not exactly what you want, but here are some code snippets I used for a wind gauge based on Bindows...

Code: Select all

	//bin the wind readings
	for (var i=0; i<cumulus.wspddata.length; i++) {
		arrWind[getord(cumulus.wdirdata[i])] += cumulus.wspddata[i];
	}
	
	//find the max binned dir
	var max = 0;
	for (var i=0; i<15; i++){
		max = Math.max(max,arrWind[i]);
	}
	
	//scale the values to a max of 340 (gauge radius)
	var scale = 340/max;
	for (var i=0; i<16; i++){
		arrWind[i] = arrWind[i] *scale;
	}
	
	//plot the readings
	g_wind.scale_A.setRadius(arrWind[0]/2);
	g_wind.scale_A.setSectionWidth(arrWind[0]);
	g_wind.scale_A.layoutComponent();
	for (var i=0; i<16; i++){
		eval("g_wind.scale_"+i+".setRadius("+arrWind[i]/2+")");
		eval("g_wind.scale_"+i+".setSectionWidth("+arrWind[i]+")");
		eval("g_wind.scale_"+i+".layoutComponent()");
	}



function getord(d){
	//convert to range 0-360
	if (d>=360) d-=360;
	var deg = Math.ceil((d+11.25)/22.5);
	return(deg-1);
}

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: Radar/Rose Graph data formula?

Post by beteljuice »

You don't say what source you would prefer, <#webtags> or one of the php equivalents.

Also, not conversant with <canvass>, How does it prefer it's 'input' ?

Basically you need to 'parse' the two data arrays into sixteen (direction) arrays containing the speeds.
Then work with those arrays will depend upon which way you have chosen.

eg. As a bonus, php has a simple call to also get the max. values that you may also want to show.

Or to put it another way, if you are already parsing the the data by php, include a function to create the data required by your <canvass> input.

Does that make sense ?

Javascript-wise the 'default' guages js coding takes you half the way there ;)
Last edited by beteljuice on Sat 27 Aug 2011 5:23 pm, edited 1 time in total.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
gwheelo
Posts: 453
Joined: Wed 11 Jun 2008 7:36 pm
Weather Station: WMR-88
Operating System: Windows 8.1
Location: L'Estartit, Spain
Contact:

Re: Radar/Rose Graph data formula?

Post by gwheelo »

Thanks Mark and Beteljuice -

I will go back to my hole and chew on that a bit.

But I will be back .

GW
Image
User avatar
gwheelo
Posts: 453
Joined: Wed 11 Jun 2008 7:36 pm
Weather Station: WMR-88
Operating System: Windows 8.1
Location: L'Estartit, Spain
Contact:

Re: Radar/Rose Graph data formula?

Post by gwheelo »

Steve -

After chewing on the Radar/Rose gauge idea for a few days - I have discovered that the #wspddata and #wdirdata tags entail uploading up to 7200 data items and then manipulating them for required output - which is a bit of a waste and can increase the error rate of the data. Since you you must already have manipulated the data to produce the console Wind Rose perhaps you might make a webtag for the binned data with an output such as "21,12,14,18,32,5,0,0,0,0,6,3,8,20,14,10" representing the 16 cardinal points and their top windspeed. Any chance for a webtag near to what I describe?

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

Re: Radar/Rose Graph data formula?

Post by steve »

gwheelo wrote:Since you you must already have manipulated the data to produce the console Wind Rose perhaps you might make a webtag for the binned data with an output such as "21,12,14,18,32,5,0,0,0,0,6,3,8,20,14,10" representing the 16 cardinal points and their top windspeed. Any chance for a webtag near to what I describe?
The Cumulus wind rose displays total wind speed (i.e. the sum of all of the samples) in each direction, not maximum wind speed. It would be possible to make the contents of that array available via a web tag fairly easily.
Steve
User avatar
gwheelo
Posts: 453
Joined: Wed 11 Jun 2008 7:36 pm
Weather Station: WMR-88
Operating System: Windows 8.1
Location: L'Estartit, Spain
Contact:

Re: Radar/Rose Graph data formula?

Post by gwheelo »

Steve -

Brilliant!! Ever vigilant to Cumulus user needs and wants! The "sum" is likely the most useful and most appropriate.

I am looking forward to the new tag - but, please, on your time schedule.

As always - thanks for Cumulus.

George Wheelock
Image
User avatar
gwheelo
Posts: 453
Joined: Wed 11 Jun 2008 7:36 pm
Weather Station: WMR-88
Operating System: Windows 8.1
Location: L'Estartit, Spain
Contact:

Re: Radar/Rose Graph data formula?

Post by gwheelo »

Steve -

Considering the possibility of a Wind Rose webtag - how might one indicate the period covered. I have seen that when using wspddata & wdirdata the time period is dependent on the station with an estimate of 200 data points equal to about 30 minutes. When a Wind Rose webtag is available it would be informative to give the period covered.

A first cut at a Wind Rose is here using static data built on the RGraph Javascript Library. It will be nice when the SteelSeries includes a Radar chart dial. http://www.wheelocknet.net/cumulus/gauges_r1.html?gb

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

Re: Radar/Rose Graph data formula?

Post by steve »

gwheelo wrote:Considering the possibility of a Wind Rose webtag - how might one indicate the period covered. I have seen that when using wspddata & wdirdata the time period is dependent on the station with an estimate of 200 data points equal to about 30 minutes. When a Wind Rose webtag is available it would be informative to give the period covered.
What it really needs is rationalising so that it covers the same period regardless of the station type. Maybe one day!

I'm not sure how I'd work out how long a period it covered for stations that don't get polled for the data, like the older Oregon stations. I'll see what I can do.
Steve
User avatar
gwheelo
Posts: 453
Joined: Wed 11 Jun 2008 7:36 pm
Weather Station: WMR-88
Operating System: Windows 8.1
Location: L'Estartit, Spain
Contact:

Re: Radar/Rose Graph data formula?

Post by gwheelo »

Steve -

For my purposes all I need is an approximate value ( Past 12 hours, Past 8 hours approx....) - just enough so the viewer has an idea what is presented. Perhaps rather than a calculated figure just an average for each station type and the Wind Rose user can decide how to present the approx time period. No one will ever need to know that the Rose represents 11 hours and 41 minutes.

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

Re: Radar/Rose Graph data formula?

Post by steve »

For the WMR-928 (etc) it's about 14 hours.
Steve
User avatar
gwheelo
Posts: 453
Joined: Wed 11 Jun 2008 7:36 pm
Weather Station: WMR-88
Operating System: Windows 8.1
Location: L'Estartit, Spain
Contact:

Re: Radar/Rose Graph data formula?

Post by gwheelo »

Steve -

Great - that works for me!

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

Re: Radar/Rose Graph data formula?

Post by mcrossley »

I just came across this thread via a Google search. I have posted some code on this thread...
https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=6853
Post Reply