Alt DashBoard--maxgusttime Underscore?

I use the alt dashboard and noticed today that the time for the max wind gust for today contains an underscore (“_”).

Right now my page shows:

Max Gust: 10.0@ 8:27_AM

I went looking for a solution and can’t find one.

The max gust time comes from the clientraw file and is pulled by the custom ajaxWDwx.js script used by the alt dashboard as follows:

maxgusttime  = clientraw[135];                           // Max wind gust time

I do not see any further processing of maxgusttime.

I then went to the clientraw parsers at tnetweather.com to see what it showed for maxgusttime and it shows:

135 Max Gust Today Time L 8:27 AM

So the underscore is not in the clientraw file.

Looking at http://www.websterweatherlive.com/ (the alt dashboard home site), sure enough it has the underscore also, so it is not something I have inadvertently added into my alt dashboard.

Does someone have a suggestion for a fix?

Thanks!

Bill
http://billhogsett.com/wd/wxOpages/wxOindex.php

I couldn’t find your clientraw, but webster weather’s clientraw does have an underscore “5:35_AM”, I think the tnet parser is ignoring it.

http://www.websterweatherlive.com/clientraw.txt

Thanks Niko, I have now looked at my clientraw.txt file and see that it does have the underscore. (Sometimes eyeballs work better than computers!).

So, the question becomes–Why have an underscore in the times? I assume the clientraw is parsed using spaces as the delimiter and that is the reason.

I really prefer not to hack javascript, but it would be nice to have the custom ajaxWDwx.js used by the alt dashboard get rid of the undescore.

Anyone? Anyone?

Oh, my clientraw.txt file and really all of the WD data is at

http://billhogsett.com/wd/wdData/

As I have said in earlier posts, i really like using subdirectories and my wd directory only has 5 files in it: 3 index files (redirection to the actual index), favicon.ico and a 404.jpg file.

Bill

If you look at the file there’s an inconsistency in the time formats, 134 Max Gust Last Hour Time has no space/underscore between the time and AM/PM but 135 Max Gust Today Time does.

Easy fix in php but I can’t help with .js :frowning:

Try:

maxgusttime  = clientraw[135].replace("_", ""); 

Thanks Niko, I have just walked in to the house and thought to myself, “Well, I can figure out how to replace something in a string in javascript.”

You saved me the pain of working with javascript.

I just tested and it works fine on my site:

http://billhogsett.com/wd/wxOpages/wxOindex.php

Thanks.

Bill

Good deal. So much helpful information on the internet these days :smiley:

You guys peaked my curiosity.
Is it possible to convert the clientraw text files to a CSV using a client side javaScript for use in an array? I did not think it could be done unless using something like php on the server as it seems Bill is using.

Why do you need to convert it to a .csv to put it into an array? Looks like the dashboard script puts it into an array using the space delimiter (“clientraw[135]” is an array element).

I just avoid programming in javascript unless I have to. If Niko says it is already being converted to a javascript array, just use it.

Bill

Ah ha!
Yes, I understand Ajax does that sort of thing, but unless I misread the chapter on Ajax it does require server side software, and hence my ‘odd ball’ question. There are two challenges I am finding with JavaScript when using it client side that I can’t seem to find away around with clientraw files. One can’t import the clientraw file, and second javascript client side does not seem to support space delimiters in an array.

Sometime in the future, if we ever get RELIABLE highspeed Internet in our rural part of Ontario, I will make the switch to a web host that will support server side software, but for now my little script files sort of fit my needs. But darn, I sure wish I could use those clientraw files now. :frowning:

Thanks guys.

Hmmmm, I see the problem, I think throwing a few loonies at it is the only way to resolve that one. e-rice.net + a domain name from godaddy is pretty cheap, $20/year or so.

Thanks niko. That underscore always bugged me. :slight_smile:

Hi All,

I finally found the place to insert this line to replace the “_” located in the ajaxWDwx.js file in this area, couldn’t locate until I found some time to dig around:

//clientraw[140] = 20.2;
;;;set_ajax_obs(‘ajaxProgress’,rand+‘wspd’,‘in WindSpeed’);
wind = parseFloat(clientraw[ 2]).convertWind(); // Wind gust
gust = parseFloat(clientraw[140]).convertWind(); // Max wind gust in last

minute
windmaxavg = parseFloat(clientraw[113]).convertWind(); // Max avg speed
maxgust = parseFloat(clientraw[ 71]).convertWind(); // Max wind gust
maxgusttime = clientraw[135].replace(“_”, " "); // Max wind gust time
beaufortnum = ajax_getBeaufortNumber(clientraw[2]);

// Wind gust
if (maxgust > 0.0 )
set_ajax_obs(“ajaxmaxgust” , maxgust.toFixed(dp.Wind) +’ '+ uom.langWind);
else set_ajax_obs(“ajaxmaxgust” , ‘Calm’);

// Max wind gust
set_ajax_obs(“ajaxwindmaxgust” , maxgust.toFixed(dp.Wind) +’ '+ uom.langWind);
set_ajax_obs(“ajaxwindmaxgusttime”, maxgusttime);

// Max wind gust No UofM
set_ajax_obs(“ajaxwindmaxgust2” , maxgust.toFixed(dp.Wind));

I put a space in mine to separate the time and am/pm.

Thank you niko for the fix.

–Stan Y.
Maui, Hawaii

Hmmm, I think it’s a modification of a line that already exists, not something to be inserted :?

Hi niko,

Yes, it is a modification of that line that already exists by editing “replace(”_", " “)” without the outside quotes within that line.

Thanks again for your insight.

–Stan Y.
Maui, Hawaii