"saratoga" script suggestion/enhancement

Hello all

Not sure where to post this since I don’t know who owns this script, but I have a suggestion/enhancement.

Script Name: wxtrends.php

I’m talking about the almanac script that shows the last 5,10,15 etc mins (see my web page link below).

What I am suggesting is to add a column for dew point. Seems like it should be easy (but i’m not a programmer so…)

http://deputydawgwx.com/wxtrends.php

Thanks !!!

Ok, easy enough for Weather-Display (ONLY).

Use the attached WD-trends-inc.php on your site. To have the ‘now’ Dew Point update with AJAX, change ajaxWDwx.js from

		set_ajax_obs("ajaxdew",dew.toFixed(1) + uomTemp);

to

		set_ajax_obs("ajaxdew",dew.toFixed(1) + uomTemp);
		set_ajax_obs('ajaxdewNoU',dew.toFixed(1));

and the dew point will update via AJAX too.


WD-trends-inc-1.07.zip (5.28 KB)

WOW thanks Ken !!!

Ken

Hate to sound stupid (but I did say i’m not a programmer).

The file you sent me wd-trends-inc.php - am i supposed to replace that with whats on my server? or just plop it on to my server?

I looked on my server and I don’t have that wd file

I have a wxtrends.php but that is practically an empty shell

Looks like I need a certain version of testtags too. I’m sure t here are some minor settings such as time zone etc to change

How is my site even working if I don’t have this file and my wxtrends is empty

Sorry to be a pain… but appreciate the help

Just unzip the WD-trends-inc-1.07.zip – it has one file ‘WD-trends-inc.php’ in it. Just upload it to your website in the same directory as wxtrends.php, Settings.php (etc) of the template. (note that it has to be named ‘WD-trends-inc.php’ and not ‘wd-trends-inc.php’ – *nix servers care about upper/lower case in filenames (unlike Microsoft).

The default settings inside the file are automatically overridden by your settings in Settings.php so no changes are needed to that file.

Your version of testtags.txt template does support the Dew Point trends.

WOW… that was easy… Thanks

Works like a champ !!!

deputydawgwx.com

Thanks

Thanks, Ken! I think the addition of Dew Point is worthwhile.

A caveat, though. Users should be aware that only the ‘Current’ values are updated via AJAX, not the entire page. On my site I’ve included a message to this effect along with a page refresh link. Here is the code, in context:

<span class="ajax" id="ajaxtime"><?php echo adjustWDtime($time); ?></span> </h2>
<p>&nbsp;(<b>NOTE:</b> Only the 'Current' values are auto-updated while the rest of the page is static.  For a full page refresh click <a href="wxtrends.php">here</a>.)</p>

@Ken, one tiny little aesthetic issue I noticed. The initially loaded current baro has 3 dp like the rest of the table, but the Ajax updated value (converted from hPa in clientraw I assume) only has 2 dp.

And, the new current Dew Point display will only update with the corresponding change in ajaxWDwx.js.
I’d hoped that the green flashes would alert folks that those variables are/have-been updated. Very true that the bulk of the display on the page is done from testtags.php at page-load time, so it is only updated when the page reloads (and that after an update to testtags.php has been done).

Yes… the raw $baroNminuteago numbers are just echo/print of the raw values with no extra formatting. The AJAX updates do use reformatting (and conversion) from clientraw.txt. I don’t have a current mechanism in the Settings areas to set the default decimal places for the variables (but could likely suppose them from the units (mb/hPa=1, inHg=2 ). So far, only the baro readings seem out of whack in the raw data with the extra decimal place of precision. Although, going the other way (setting ajaxWDwx.js to use 3 decimals of precision) would make the table ‘harmonious’ and the display show the subtle changes in pressure better. Easy enough change in ajaxWDwx.js

var uomTemp = '&deg;F';
var uomWind = ' mph';
var uomBaro = ' inHg';
var uomRain = ' in';
var uomHeight = ' ft';
var dpBaro = 2;
var dpRain = 2;

to

var uomTemp = '&deg;F';
var uomWind = ' mph';
var uomBaro = ' inHg';
var uomRain = ' in';
var uomHeight = ' ft';
var dpBaro = 3;
var dpRain = 2;

Harmony is good :smiley:

Thanks for taking a look at that.

I guess I should have used ‘viewer’ instead of ‘user’ as the target of my modification. Because the rows of data are timed, as time passes the term ‘x minutes ago’ loses more and more relevance. I have added the time that the page was initially loaded in order to show how stale the ‘x minutes ago’ have become:

<p>&nbsp;(<b>NOTE:</b> Only the 'Current' values are auto-updated while the rest of the page is static.
&nbsp;For a full page refresh click <a href="wxtrends.php">here</a>.&nbsp;&nbsp;This page was last fully loaded at <?php echo date("g:i A",time())?>.)</p>

That’s a good idea… I’ll ‘bag’ it for a WD-trends-inc.php release soon :slight_smile:

Thanks!

I think I’ll go with

<h2><?php echo langtrans('Trends as of'); ?> <span class="ajax" id="ajaxdate"><?php echo adjustWDdate($date); ?></span> 
<span class="ajax" id="ajaxindicator"><?php langtrans('at'); ?></span> 
<span class="ajax" id="ajaxtime"><?php echo adjustWDtime($time); ?></span> </h2>
<p>(<small>
<?php langtrans('Note: Only the \'Current\' values may be updated in near-realtime, while the other values are current when the page is loaded.'); ?> 
<?php langtrans('The other data was from ');
 echo '<strong>'.adjustWDdate($date). " " . adjustWDtime($time)."</strong>.  ";
 langtrans('Reload this page for updated data');
  ?>.)</small></p>

near the top. That allows for translation using

langlookup|Note: Only the 'Current' values may be updated in near-realtime, while the other values are current when the page is loaded.|Note: Only the 'Current' values may be updated in near-realtime, while the other values are current when the page is loaded.|
langlookup|The other data was from |The other data was from |
langlookup|Reload this page for updated data|Reload this page for updated data|
langlookup|DEW POINT|DEW POINT|

in the language-LL.txt translation file to convert to the selected language. Also, I’d used the Settings.php specs for date/time presentation.

Working up a WD-plugin.zip update now…

Did a bit more adjustments for international support, so here’s the final one I’ll distribute shortly. The ajaxWDwx.js script defaults to English units, so change the settings inside for Metric if needed. It handles the dew point with no units update also.

The Baro column will display 3 decimals (for English) or 1 decimal for Metric so it matches what WD produces for the variables in testtags.php for the respective displays.


WD-trends-inc-1.07.zip (16.7 KB)

Done… on the update tool page for Base-*, WD-plugin, 30-Sep-2017

Best regards,
Ken

This was a good idea, so Thanks!

I’ve also added it to the Cumulus and Meteobridge Plugins.

Many thanks again, Ken! A slightly modified version of your better thought-out changes is up and running on my site.

Just a heads-up for those who are using Scott Thompson’s version 6.x alternate dashboard, you can download a compatible minified ‘ajaxWDwx3.js’ as a ‘.txt’ file here and the source file, which is 7/3 larger, as a ‘.txt’ file here.