Page 1 of 1
Radar/Rose Graph data formula?
Posted: Wed 24 Aug 2011 9:20 pm
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
Re: Radar/Rose Graph data formula?
Posted: Fri 26 Aug 2011 2:57 pm
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);
}
Re: Radar/Rose Graph data formula?
Posted: Fri 26 Aug 2011 5:49 pm
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

Re: Radar/Rose Graph data formula?
Posted: Sat 27 Aug 2011 3:01 pm
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
Re: Radar/Rose Graph data formula?
Posted: Wed 31 Aug 2011 11:44 am
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
Re: Radar/Rose Graph data formula?
Posted: Wed 31 Aug 2011 12:13 pm
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.
Re: Radar/Rose Graph data formula?
Posted: Wed 31 Aug 2011 1:21 pm
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
Re: Radar/Rose Graph data formula?
Posted: Sat 03 Sep 2011 9:07 pm
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
Re: Radar/Rose Graph data formula?
Posted: Sat 03 Sep 2011 9:54 pm
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.
Re: Radar/Rose Graph data formula?
Posted: Sun 04 Sep 2011 11:28 am
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
Re: Radar/Rose Graph data formula?
Posted: Sun 04 Sep 2011 11:51 am
by steve
For the WMR-928 (etc) it's about 14 hours.
Re: Radar/Rose Graph data formula?
Posted: Sun 04 Sep 2011 1:04 pm
by gwheelo
Steve -
Great - that works for me!
GW
Re: Radar/Rose Graph data formula?
Posted: Tue 17 Jan 2012 2:20 pm
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