Steelseries Rain Rate issue using Lueven Template

I wanted to pass this along as I have already thrown the question to Wim (Leuven Template creator) and a little help is needed.

A little back story first… the Leuven Template uses a “tweaked” or “Forked” version of Mark’s Steelseries v1.05x gauges.
The rain rate is an issue with this version of the Steelseries (not reading more than .01 max). I know it was has something to do with the gauges.js and the clientraw.txt files and that it was updated in the 2.4x version. However, I am not able to just replace the new files with the originals in the Leuven Template due to how it is tweaked and the line(s) needed to fix the problem are different from newer versions or are not there (from what I can see). Wim has already said that I cannot “mix and match” files to get things to work either.
I have dug through the other threads and have found threads regarding this, however, they are for newer versions of the Gauges.
I am posting here to see what response I can get. Maybe Mark can shed some light on this. Maybe we can tweak an update in to work on the Leuven Template properly. (?sce=view is available)

I cannot test this at this time due to my location (Iowa, USA) and the temps have fallen enough that I will not be seeing rain for several months. So I will need someone with the Leuven Template that is using inches (probably in the US) who would be able to test this when I can get this figured out.

Regards

Jonny J

which version of WD?

My apologies for not adding that in, Using 305 build on WD.
I’ve been doing all I can to keep that up to date.
The computer running WD and my Station are in my basement and I am 2 weeks out of ACL Surgery. Climbing up and down is not happening and no one here understands the system like I do.

From the change log, the fix you require was in 2.4.1 and 2.4.2 - these versions are pre-github, so not as easy to look at, but this what the relevant section of doRRate should look like…


             if (data.rainunit === 'mm') { // 10, 20, 30...
                _rrate.maxValue = Math.max(Math.ceil(_rrate.overallMax / 10) * 10, 10);
            } else {
                // inches 0.5, 1.0, 2.0, 3.0 ...
                if (_rrate.overallMax <= 0.5) {
                    _rrate.maxValue = 0.5;
                } else {
                    _rrate.maxValue = Math.ceil(_rrate.overallMax);
                }
                _rrate.scaleDecimals = _rrate.maxValue < 1 ? 2 : (_rrate.maxValue < 7 ? 1 : 0);
            }

The rain gauge (doRain) may also need updating to…


            if (data.rainunit === 'mm') { // 10, 20, 30...
                _rain.maxValue = Math.max(Math.ceil(_rain.value / 10) * 10, 10);
            } else {
                // inches 0.5, 1.0, 2.0, 3.0 ... 10.0, 12.0, 14.0
                if (_rain.value <= 0.5) {
                    _rain.maxValue = 0.5;
                } else if (_rain.value < 6) {
                    _rain.maxValue = Math.max(Math.ceil(_rain.value), 0.5);
                } else {
                    _rain.maxValue = Math.ceil(_rain.value / 2) * 2;
                }
                _rain.scaleDecimals = _rain.maxValue < 1 ? 2 : 1;
            }

Mark,
Thanks, Allegedly we have rain coming this weekend. Ill update when/if it happens and advise if that worked.

I should have qualified my answer above, I think the 1.x code may look a bit different, so some interpretation may be required. Good luck.

Mark,
The code you posted didn’t work as you thought. Here’s the code as it shows on my gauges.js

doRain (abbreviated)
if (data.rainunit === ‘mm’) { // 10, 20, 30…
g_rain.maxValue = Math.max(Math.ceil(g_rain.value / 10) * 10, 10);
} else {
// inches 0.5, 1.0, 1.5, 2.0 …
//g_rain.maxValue = Math.max(Math.ceil(+data.rfall.replace(‘,’, ‘.’) * 2) * 0.5, 0.5);
// inches 1.0, 2.0, 3.0 … 10.0, 12.0, 14.0
if (g_rain.value < 6) {
g_rain.maxValue = Math.max(Math.ceil(g_rain.value), 1.0);
} else {
g_rain.maxValue = Math.ceil(g_rain.value / 2) * 2;
}

doRRate (abbreviated)

if (data.rainunit === 'mm') { // 10, 20, 30...
    g_rrate.maxValue = Math.max(Math.ceil(g_rrate.maxMeasured / 10) * 10, 10);
} else {
    // inches 0.5, 1.0, 1.5, 2.0 ...
    //g_rrate.maxValue = Math.max(Math.ceil(+data.rrateTM.replace(',', '.') * 2) * 0.5, 0.5);
    // inches 1.0, 2.0, 3.0 ...
    g_rrate.maxValue = Math.max(Math.ceil(g_rrate.maxMeasured), 1.0);
}

It appears I have rain by the end of the week before it turns frigid here. Hopefully with help I can get this straightened out by then.
If you want me to, I’ll post the entire section for both since they are nearby each other.

I really can’t afford the time to support ancient versions of the script, but I’ll see what I can do, it may be a day or two as I am flat out at paid work at the mo…

@mcrossley
I think it is maybe the same problem as in this other post.
http://discourse.weather-watch.com/p/479086

The javascript code in this topic here only sets the RANGE for the gauge display.
Not the real value inside the gauge.
That value is coming from the realtime file http://lightningweather.com/quadcities/ws_realtime.php?lang=en&wp=WD

The Leuven scripts get that rain-rate value,when using WD, directly from the clientraw.txt file field nr 10.
Clientraw files are always in ISO units and it is converted to the user (visitor) units already on the webserver.
No conversion is done in the gauges javascript.
As the value is displayed as received without anything done with it in the javascript.
I have to find why the value is zero sometimes, either in the clientraw or in the handling of the clientraw.

@ALL
If you want to use @mcrossley scripts in the Leuven-Template, implement them from scratch. You can use an iFrame to do it relative fast.
Mixing and matching is impossible as they differ far to much.

@Jonny J
You are displaying code from gauges.js saying it is from the Leuven-Template. There is (should be) no gauges.js but this one
http://lightningweather.com/quadcities/gauges/scripts/wsGauges.js
Also in the latest version wsGauges_v3.js there is no handling of data.rrate other than displaying it in the gauge.
As you can check yourself the data.rrate value is nowhere changed in that javascript. It is directly coming from the realtime file from the webserver.

No reason to bother @mcrossley.

If you have rain in the coming days, please copy every so many minutes a clientraw.txt just to have some idea when the rrate switches to zero in the clientraw file. That is where we have to look.

Wim

P.S. The @mcrossley scripts use for the rrate the WD-tag tag %currentrainratehr%
If someone knows what tag/value is used in clientraw field#10 ?