Unfortunately there is no single tag that will give you what you seek. A
couple of workarounds spring to mind.
You could use some in-template python code to iterate over yesterday and
todays 'hours', calculate the aggregate you want for each 'hour', filter
out those 'hours' you don't want and save those you do to a list. The code
is going to be lengthy and inefficient but it should be doable. I'm not
even going to try to show some example code.
I'd probably favour using a little in-template python code to obtain the
current number of minutes past the hour then use this value in seconds as
an offset in your $span tag using the time_delta parameter, eg (untested):
#set $offset = int($current.dateTime.format('%M')) * 60
$span(time_delta=$offset,
hour_delta=24).pm2_5out.series(time_series='start', aggregate_type='max',
aggregate_interval='3600')
There are probably other approaches that can be used, but I expect they are
all going to involve some code.
Gary
On Wednesday, 7 May 2025 at 01:34:02 UTC+12 Andrew McGinnis wrote:
> I'm trying to get an on-the-hour series value generated. I can get
> trailing 24h via $span(hour_delta=24), or the :00 hour via $day.
>
> $day.pm2_5out.series(time_series='start', aggregate_type='max',
> aggregate_interval='3600')
> results in this:
> 00:00, 12.0 µg/m³
> 01:00, 9.0 µg/m³
> 02:00, 20.0 µg/m³
> 03:00, 17.0 µg/m³
> 04:00, 18.0 µg/m³
> 05:00, 13.0 µg/m³
> 06:00, 14.0 µg/m³
> 07:00, 12.0 µg/m³
> 08:00, 11.0 µg/m³
> 09:00, 6.0 µg/m³
>
> whereas $span results in this:
> $span(hour_delta=24).pm2_5out.series(time_series='start',
> aggregate_type='max', aggregate_interval='3600')
> 09:12, 7.0 µg/m³
> 10:12, 8.0 µg/m³
> 11:12, 9.0 µg/m³
> 12:12, 8.0 µg/m³
> 13:12, 8.0 µg/m³
> 14:12, 8.0 µg/m³
> 15:12, 8.0 µg/m³
> 16:12, 9.0 µg/m³
> 17:12, 10.0 µg/m³
> 18:12, 9.0 µg/m³
> 19:12, 10.0 µg/m³
> 20:12, 13.0 µg/m³
> 21:12, 14.0 µg/m³
> 22:12, 14.0 µg/m³
> 23:12, 15.0 µg/m³
> 00:12, 12.0 µg/m³
> 01:12, 9.0 µg/m³
> 02:12, 20.0 µg/m³
> 03:12, 15.0 µg/m³
> 04:12, 18.0 µg/m³
> 05:12, 13.0 µg/m³
> 06:12, 14.0 µg/m³
> 07:12, 12.0 µg/m³
> 08:12, 11.0 µg/m³
>
> What I'm after is the .min/.avg/etc for each hour, on the hour, for the
> trailing 24. Such that today at 09:27am, it would then be pulling the
> current-day 09:00 (ideally, as it does in $day), 08:00 hour, 07:00 hour,
> ..., prior-day 12:00 hour, 11:00 hour, 10:00 hour. $day gets the minutes
> right, but is limited to >= midnight. $span gets the period right, but is
> using current time and offsetting 60min from it.
>
> Is there some combination where I can get the hours of a span on a :00-59
> basis?
>
--
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 [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/weewx-user/0e517946-a730-44b0-98f9-f1daa728f529n%40googlegroups.com.