WXforum.net
Web Weather => Weather Website PHP/AJAX scripting => Topic started by: ConligWX on February 12, 2019, 03:41:20 AM
-
Ken.
The UKWN - and possibly other scripts for regional/global maps do not report Pressure Trends for meteobridge in its current form. would you be able to fix this or can the template just be amended?
Meteobridge templates show the following convertor.
enbarotrend reports trend as strings FF, FS, ST, RS, RF
FF = Falling Fast
FS = Failing Slowly
ST = Stable/Steady
RS = Rising Slowly
RF = Rising Fast
this could be used for Pressure trends could it not?
something like: [thb0seapress-delta3h=enbarotrend]
I'm not 100% sure on what time frame is used (3h =3hours in this example) for pressure trend but surely this would suffice?
MB_stickertags-template.txt
[hh]:[mm]:[ss],[DD]/[MM]/[YYYY],[th0temp-act],,[wind0chill-act],[th0hum-act.0],[th0dew-act],[thb0seapress-act],[thb0seapress-delta3h=enbarotrend],[wind0wind-act],[wind0dir-act=endir],[rain0total-daysum],,[mbsystem-sunrise:],[mbsystem-sunset:],[wind0wind-avg10:],[wind0wind-max10:],C|m/s|hPa|mm
or:
barotrend converts a delta measurement (selector delta) into a barometer trend analysis pattern (1 hPa is about 0.03 inHg):
-2: delta <= -2 hPa
-1: -2 hPa < delta <= -1 hPa
0: -1 hPa < delta < +1 hPa
+1: +1 hPa <= delta < +2 hPa
+2: +2 hPa <= delta
MB_stickertags-template.txt - [thb0seapress-delta3h=barotrend.2:--] (2 decimal places)
[hh]:[mm]:[ss],[DD]/[MM]/[YYYY],[th0temp-act],,[wind0chill-act],[th0hum-act.0],[th0dew-act],[thb0seapress-act],[thb0seapress-delta3h=barotrend.2:--],[wind0wind-act],[wind0dir-act=endir],[rain0total-daysum],,[mbsystem-sunrise:],[mbsystem-sunset:],[wind0wind-avg10:],[wind0wind-max10:],C|m/s|hPa|mm
-
Hi Simon,
The collection of data from each regional network is done by a collection program (*-mesomap-loadcache.php) that runs on each regional network hub site via cron. There are multiple formats used for conditions reporting (clientraw.txt, realtime.txt, SSgauges JSON, and a common 'stickertags' format). In the stickertags format, the field used for BaroTrend is expected to have either '--' for no trend, or the words 'Rising Rapidly','Rising Slowly','Steady','Falling Slowly','Falling Rapidly', or the value of the trend.
It's processed via $BTRND = trim($v[8]);
if(preg_match('|^[\d\.\-]+$|',$BTRND)) {
$BTRND = set_barotrend($BTRND);
} else {
$BTRND = preg_replace('/\d+/is','',$BTRND);
$BTRND = trim($BTRND);
}
if(isset($btrendTrans[$BTRND])) {
$BTRND = $btrendTrans[$BTRND];
} else {
$Debug .= "<!-- BTRND='$BTRND' not valid .. set to '--' -->\n";
$BTRND = '--';
}
and the set_barotrend() function uses function set_barotrend($baromtrend) {
// routine from Anole's wxsticker PHP (adapted)
// Barometric Trend(3 hour)
// Change Rates
// Rapidly: =.06" H; 1.5 mm Hg; 2 hPa; 2 mb
// Slowly: =.02" H; 0.5 mm Hg; 0.7 hPa; 0.7 mb
// 5 Arrow Positions:
// Rising Rapidly
// Rising Slowly
// Steady
// Falling Slowly
// Falling Rapidly
// Page 52 of the PDF Manual
// http://www.davisnet.com/product_documents/weather/manuals/07395.234-VP2_Manual.pdf
// figure out a text value for barometric pressure trend
settype($baromtrend, "float");
switch (TRUE) {
case (($baromtrend >= -.6) and ($baromtrend <= .6)):
$baromtrendwords = "Steady";
break;
case (($baromtrend > .6) and ($baromtrend < 2)):
$baromtrendwords = "Rising Slowly";
break;
case ($baromtrend >= 2):
$baromtrendwords = "Rising Rapidly";
break;
case (($baromtrend < -.6) and ($baromtrend > -2)):
$baromtrendwords = "Falling Slowly";
break;
case ($baromtrend <= -2):
$baromtrendwords = "Falling Rapidly";
break;
} // end switch
return($baromtrendwords);
}
to convert the hPa trend to words.
So, using the second stickertags format with [thb0seapress-delta3h=barotrend.2:--] would likely work .. give it a try on your site with with UKWN.
-
Thanks for the explanation Ken, much appreciated
Sent from my ONEPLUS A6003 using Tapatalk
-
Ken it appears to be working:
[ You are not allowed to view attachments ]
-
Yea! Have Martin download the new MB_stickertags-template.txt with the new field and distribute on UKWN/SCWN. He'll need to contact existing members using the old one to update their template.