Last 24 hours - not quite doing what I expected

55 views
Skip to first unread message

Mike Thompson

unread,
Oct 21, 2020, 6:37:36 AM10/21/20
to weewx-user
Hi All,

I'd like to have information over the last 24 hours and I thought I could easily achieve this by defining a  $span tag but it's not worked out as I thought.

I've defined the tag as $span($hour_delta=24) and as $span($day_delta=1) both give the same results.

To test I changed the Seasons statstics.inc to include my 24hrs as follows;

#set $archive_data = [$day,$yesterday,$span($hour_delta=24), $week,$seven_day, $month, $year, $alltime]

This seems to work ok as shown below




But there is the occasional anomaly for example looking at the min Barometer it shows;
984.9 for today @ 10:38:36
988.1 for yesterday  @ 09:54.36 and 
985.0 for last 24 hours @ 10:20

I was expecting the min for last 24 hrs to be equal to or less than today's value (984.9 is less than 985) but it's not, why is that?

It doesn't just happen with min barometer it is the same with max temp which was yesterday's example.

Appreciate your thoughts
Thanks in Advance
Mike

extract from Seasons statistics.inc showing min Barometer
<tr>
          <td class="label">$obs.label.barometer</td>
          <td class="units">$unit.label.barometer</td>
          #for $archive in $archive_data
          <td class="data new_row">$archive.barometer.max.format(add_label=False)<br/>
            <span class="timestamp">$archive.barometer.maxtime</span><br/>
            $archive.barometer.min.format(add_label=False)<br/>
            <span class="timestamp">$archive.barometer.mintime</span>
          </td>
          #end for

Tom Keffer

unread,
Oct 21, 2020, 7:56:28 AM10/21/20
to weewx-user
A bit of background. WeeWX manages two different sets of databases.

First is the main archive table. It is updated with every archive record.

Then there is a set of "daily summaries." These contain the minimum, maximum, time of minimum and maximum, and some other details for each observation type for each day. It is updated with every LOOP packet, so despite having only one record per day, it can be quite precise about when minimums and maximums happen. Lookups using daily summaries can also be much faster, but they require that the aggregation period run precisely midnight-to-midnight.

On to the problem. When WeeWX evaluates a tag such as $day.outTemp.min, you are asking for the minimum since midnight, so the daily summaries are used. This gives an answer down to the resolution of the LOOP packets.

But, for a tag like $span($hour_delta=24), the aggregation period does not run midnight-to-midnight, so the archive table must be used. So, the results have a resolution no better than the archive period.

With your dataset, the minimum of 984.9 happened at 10:38:36 and the daily summaries captured it. But if you were to look in your archive table, it would show 985.0 at 10:20:00, because that's the average over the 5 minute archive period.

If you hate this result, you can tell WeeWX not to use the LOOP packets to update the daily highs and lows by setting option loop_hilo under [StdArchive] to False. This will cause the daily summaries to be updated with the min and max archive records, rather than LOOP packets.

Hope this helps.

-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/69f8d05a-f536-4be2-9b89-468684983cf5o%40googlegroups.com.

mike.t...@noworries.plus.com

unread,
Oct 21, 2020, 8:34:58 AM10/21/20
to weewx-user
Many Thanks Tom that clears it up.
Mike

Reply all
Reply to author
Forward
0 new messages