Any way to retrieve information from archive for data closest to a given date/time?

44 views
Skip to first unread message

jpb...@gmail.com

unread,
Dec 4, 2021, 4:07:56 PM12/4/21
to weewx-development
Hi, everyone -

I'm needing to do something that may sound odd. Let's say I want to know the humidity that existed at the time closest to the minimum and also maximum temperature of the day. For example, if the minimum temperature of the day was 10, at 0915, then I want to get the humidity at that time (or the closest time to 0915 that a humidity reading was taken.)

Assume I want the same for the weekly min/max temperature, the monthly, and the yearly. So, I need to really get the min/max value for a field, and the time the field was added, and retrieve other information that was saved near that time.

Is there a straightforward way to obtain this?

Thanks!

Tom Keffer

unread,
Dec 4, 2021, 4:41:18 PM12/4/21
to jpb...@gmail.com, weewx-development
That should be possible. Try (NOT TESTED) something like

    <p>Today's minimum temperature was $day.outTemp.min at $day.outTemp.mintime.</p>
    <p>The humidity at that time was $current(timestamp=$day.outTemp.mintime.raw, max_delta=600).outHumidity</p>
   
This works because $current can take a timestamp, which in this case, we set to the time of the temperature minimum. It can also take a "max_delta", which sets how far from the timestamp we are willing to accept a record (10 minutes in this case).

See the documentation for the tag $current for details.
 

--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/ab424a5a-71fe-4b26-8c40-cca1e1e4f6c7n%40googlegroups.com.

jpb...@gmail.com

unread,
Dec 4, 2021, 5:30:43 PM12/4/21
to weewx-development
Thank you! I'll be trying this as soon as possible and report back.

jpb...@gmail.com

unread,
Dec 6, 2021, 5:06:39 PM12/6/21
to weewx-development
Thank you - the example you gave showed me what I needed to do, and I was able to extend it to apply to my actual use case. Along the way, I finally taught myself how to fully use Cheetah3, so that was doubly useful.
Reply all
Reply to author
Forward
0 new messages