Hi
Anyone know how to use <#nextwindindex> in html code?
In help it says it should be together with wdirdata and wspddata but how?
I suppose it should calculate the data from those?
<td>Next wind</td>
<td><#nextwindindex> <#windunit></td>
Regards Per
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
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
Example for <#nextwindindex>?
Moderator: daj
- 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: Example for <#nextwindindex>?
Realistically it is of limited use as most of the derived values of the wind data are already available as either <#webtags> or values in realtime.txt
However; one value which can be determined that isn't available anywhere else is the direction (degrees) of the last 10min high gust value:
This code does work
Lot of work to get a three digit number accessing upto 7,200 data bits 
However; one value which can be determined that isn't available anywhere else is the direction (degrees) of the last 10min high gust value:
This code does work
Code: Select all
<script language="javascript">
var langWindDir = new Array( /* used to decode wind direction degrees to text */
"N", "NNE", "NE", "ENE",
"E", "ESE", "SE", "SSE",
"S", "SSW", "SW", "WSW",
"W", "WNW", "NW", "NNW");
var gust10 = <#wgust>; // highest windspeed in last 10 min.
var hwspd = new Array(<#wspddata>);
var hwdir = new Array(<#wdirdata>);
var next_index = <#nextwindindex>; // the NEXT array 'key' eg. 0 - 3599
var total = hwspd.length; // the amount of data in the array eg. upto 3600
if(next_index == 0) { // array 'rollover'
current_pointer = total -1; // last data entry
} else {
current_pointer = next_index -1;
}
for(var i = 0; i < total; i++) { // don't check more than exists !
if(current_pointer < 0) current_pointer = total -1 ; // 'rollover' has occured during the loop
if(hwspd[i] == gust10) { // the LATEST occurrence
// write the information in the page, edit to suit
document.write('Recent Gust ' + hwspd[i] + ' <#windunit> from ' + hwdir[i] + '°, ' + windDirLang(hwdir[i]) + '<br />');
break;
}
current_pointer--; // value not found, move down one
}
function windDirLang ($winddir) // user language NNW
// Take wind direction value, return the
// text label based upon 16 point compass -- function by beeker425
// see http://www.weather-watch.com/smf/index.php/topic,20097.0.html
{
return langWindDir[Math.floor(((parseInt($winddir) + 11) / 22.5) % 16 )];
} // END function windDirLang
</script>
Last edited by beteljuice on Sun 12 Jul 2009 12:29 pm, edited 1 time in total.
......................Imagine, what you will KNOW tomorrow !
-
Per69
- Posts: 33
- Joined: Sat 07 Mar 2009 8:31 pm
- Weather Station: WH1081
- Operating System: Windows XP
- Location: Lidkoping, Sweden
- Contact:
Re: Example for <#nextwindindex>?
Hi beteljuice
Thank you for answering.
I´m still a bit confused.
Isn't nextwindindex supposed to calculate next windspeed?
When I test with changing for example <#wgust> to <#nextwindindex>? I get a big number like 2500 or so.
When I put in your code then it's no difference.
I get a warning here between # and w:
var gust10 = <#wgust>; // highest windspeed in last 10 min.
Or have I got this all wrong?
Regards Per
Thank you for answering.
I´m still a bit confused.
Isn't nextwindindex supposed to calculate next windspeed?
When I test with changing for example <#wgust> to <#nextwindindex>? I get a big number like 2500 or so.
When I put in your code then it's no difference.
I get a warning here between # and w:
var gust10 = <#wgust>; // highest windspeed in last 10 min.
Or have I got this all wrong?
Regards Per
- 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: Example for <#nextwindindex>?
"... Isn't nextwindindex supposed to calculate next windspeed?"
No !
<#wspddata> and <#wdirdata> are arrays of the last 3,600 wind readings.
Because the data is redundantly cycled we need <#nextwindindex> to calculate which is the current value.

No !
<#wspddata> and <#wdirdata> are arrays of the last 3,600 wind readings.
Because the data is redundantly cycled we need <#nextwindindex> to calculate which is the current value.
More like the wrong end of the stickOr have I got this all wrong?
......................Imagine, what you will KNOW tomorrow !
-
Per69
- Posts: 33
- Joined: Sat 07 Mar 2009 8:31 pm
- Weather Station: WH1081
- Operating System: Windows XP
- Location: Lidkoping, Sweden
- Contact:
Re: Example for <#nextwindindex>?
Ok, beteljuice.
Thank you...
/Per
Thank you...
/Per