Strange Template behaviour **solved**

All about the standard Meteobridge devices based on mobile routers from TP-Link, D-Link, ASUS

Moderator: Mattk

Post Reply
stevem
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: Mon Sep 21, 2015 10:38 am

Strange Template behaviour **solved**

Post by stevem » Sat Sep 16, 2017 6:34 am

Hi, I have a template file set up to create a JSON data file with contents partly as follows...

"windtrend": [
"[wind0wind-act]","[wind0wind-val1]", "[wind0wind-val2]", "[wind0wind-val3]", "[wind0wind-val4]",
"[wind0wind-val5]", "[wind0wind-val6]", "[wind0wind-val7]", "[wind0wind-val8]", "[wind0wind-val9]",
"[wind0wind-val10]", "[wind0wind-val11]", "[wind0wind-val12]", "[wind0wind-val13]", "[wind0wind-val14]",
"[wind0wind-val15]", "[wind0wind-val16]", "[wind0wind-val17]", "[wind0wind-val18]", "[wind0wind-val19]",
"[wind0wind-val20]", "[wind0wind-val21]", "[wind0wind-val22]", "[wind0wind-val23]", "[wind0wind-val24]",
"[wind0wind-val25]", "[wind0wind-val26]", "[wind0wind-val27]", "[wind0wind-val28]", "[wind0wind-val29]",

"[wind0wind-val30]","[wind0wind-val31]", "[wind0wind-val32]", "[wind0wind-val33]", "[wind0wind-val34]",
"[wind0wind-val35]", "[wind0wind-val36]", "[wind0wind-val37]", "[wind0wind-val38]", "[wind0wind-val39]",
"[wind0wind-val40]","[wind0wind-val41]", "[wind0wind-val42]", "[wind0wind-val43]", "[wind0wind-val44]",
"[wind0wind-val45]", "[wind0wind-val46]", "[wind0wind-val47]", "[wind0wind-val48]", "[wind0wind-val49]",
"[wind0wind-val50]","[wind0wind-val51]", "[wind0wind-val52]", "[wind0wind-val53]", "[wind0wind-val54]",
"[wind0wind-val55]", "[wind0wind-val56]", "[wind0wind-val57]", "[wind0wind-val58]", "[wind0wind-val59]"
],

The template regenerates each minute and is picked up repeatedly by a web page that plots this data. Everything works fine except that the plot has highlighted that the series of data isn't remaining consistent on repeated generations. You would expect that at each iteration a new value would appear at the front, the oldest value would be dropped off, and all the other valued would stay the same. This is not happening consistently and is very disconcerting because the shape of the plot changes as it moves across the screen. I've inspected the raw data comparing adjacent minutes and you can see sequences of up to 12 items where there is an exact match and then this is followed by 1 or 2 values that haven't been passed on without change. Then consistency returns for 3 or 4 values and then it goes amuck again.

Is this a bug or just a consequence of the necessary implementation? I can see that if you hold a series of values/timestamps and then recalculate the buckets on request the values will change due to timing differences. But I'm only guessing. Can you help ???

Steve

User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 5026
Joined: Mon Oct 01, 2007 10:51 pm

Re: Strange Template behaviour

Post by admin » Sun Sep 17, 2017 10:48 pm

First. you need to define default values in situation data is not there.

Next, it depends a lot what values will be reported from when you request the data.
As data is not aligned to full minutes (but has a time stamp down to seconds) the
returns may vary a bit. In some situation a minute you ask for might have two
data items where only the first is reported, on next request those two items might
fall into different minute buckets. Therefore, minor changes in the graph are to be expected.

stevem
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: Mon Sep 21, 2015 10:38 am

Re: Strange Template behaviour **solved**

Post by stevem » Mon Sep 18, 2017 10:48 pm

Thanks

Are you saying for a numerical value the default missing value is not zero and is indeterminent if no explicit default is provided?

Also, just so I understand. If you have no value in a particular minute do you return missing or do a calculation based on the closest adjacent values? And in the case where there has been more than 1 reading in a minute we presumably get an average?

Looking at the actual data I’m struggling to see how what I’m seeing comes about. Peak values in the sequence are being lost.

Rgds

Ps. The reason I’m asking all this is that the weather station is at a small airport. The pilots are really interested in the consistency of the wind direction given in small planes they struggle with gusts and more than 10-15kts of crosswind component. The numbers aren’t believable when they jump around unexpectedly.

User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 5026
Joined: Mon Oct 01, 2007 10:51 pm

Re: Strange Template behaviour **solved**

Post by admin » Sat Sep 23, 2017 10:09 am

Lots of questions, all covered in the wiki...

1) When a variable is not there, which means it has never shown up with data or last date for that sensor is older than "data hold" period defined on "station" tab, then the variable is not replaced. That means "[th0temp-act]" is not evaluated and returned literally. To give a default value, you have to do it explicitly. Meteobridge cannot guess what a good default might be in your situation.

2) Selector "-act" is not useful to get wind maximum. Use "-max" added by a time interval you are looking for "[wind0wind-max5:--]" will return max gust of last 5 minutes.

Please start reading here: http://www.meteobridge.com/wiki/index.php/Templates

Post Reply