Issue or misunderstanding with $latest tag ? (and one or two question related to database management)

29 views
Skip to first unread message

wysiwyg

unread,
Feb 10, 2020, 11:58:51 AM2/10/20
to weewx-user
Hi There!

I am working on my wind sensor currently, so far I have tuned my data to be emitted the following way (My weewx record interval is 5min):

When there is some wind:
Every five 5min, sensor will emit average windspeed/dir over last 5 minutes and  max windgust/gustdir observed on a 10sec interval during the last 5 minutes.
I tuned this way because I want to make sure weewx will record any extreme windgust I measure.
If I send more than 1 sample of windgust in 5min period, weewx will average them to build its database record. (as far as I understood)

When there's no wind: my sensor will emit a zero speed value every 15min to save battery, so it will miss ~2 database record over 3. I guess it's not a big deal as there's no wind.
While writing this, I wonder if those missing "0" speed samples can affect some calculations, like average wind ?



Anyway: due to those timings, It happens that I have no wind data on current database record: meaning $current.windSpeed will sporadically give N/A value (more often when there's no wind).
I was expecting $latest.windSpeed to give me the last value recorded (in my situation 5-15min ago).
But apparently, it's not working this way ?  
Is there a workaround possible ?

Best regards,
Frederic






Thomas Keffer

unread,
Feb 10, 2020, 12:21:09 PM2/10/20
to weewx-user
$latest is the last archive record in the database. So, $latest.windSpeed is the last wind speed in the database, whether null or not.

Unfortunately, there is no tag meaning "last non-null" value. You'd have to write a search list extension.

But, I find the semantics of what you're trying to accomplish a little hazy. If you're satisfied with 15-minute old data, why not just sample every 15 minutes?

To answer your other question: the presence of null values will not affect averages.

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/f5ac6ea6-caff-48e6-86de-1aa039f00541%40googlegroups.com.

wysiwyg

unread,
Feb 10, 2020, 12:57:59 PM2/10/20
to weewx-user
Hello Thomas,
Thanks for clarifying $latest tag, now I understand!

Regarding the 15min... Well, I'm happy with 5min interval :D. It's a good trade off to keep database reasonable but with reactivity to capture short events (like a thunderstorm rain in my place with very high rainrate for a few minutes then slow down) Or to have shorter wait when debugging :-).

But some data does not have anything interesting to show every 5min: like when there's no wind or no rain, reporting 0,0,0...for hours or days...
That's why I tried this trick on my sensor, to save battery.

Anyway, if my battery can deal with it, I can switch all to 5min interval (whatever there's wind or not). I have to do some experiments.

Thomas Keffer

unread,
Feb 10, 2020, 1:04:39 PM2/10/20
to weewx-user
One option would be to put this in [StdCalibrate]

[StdCalibrate]
  [[Corrections]]
    windSpeed = 0 if windSpeed is None else windSpeed

That will actually save the value 0 (zero) in your database. 

Another option, not so drastic, is to interpret None as zero in your templates. Instead of 

<p>The current windspeed is $current.windSpeed</p>

use

<p>The current windspeed is $current.windspeed.format(None_string="0")</p>

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages