Sadly my fingers typed quicker than my brain did think....

I had hoped that a little inline python code using a tag that simply looks 
up a value given a timestamp would suffice. The $current tag already has 
the ability to do a lookup for a given timestamp with the optional 
$timestamp parameter, unfortunately this only uses the archive which has at 
best a time resolution of archive_interval seconds (if the max windSpeed 
for today occurred at 10:15:47 we can only get the wind direction from the 
archive at 10:15:00 and 10:20:00 if we had a 5 minute archive interval). 
Without going into a whole pile of detail and if-buts-maybes obtaining 
10:15:47 is possible as the daily summaries normally record daily min/max 
and time for each observation type.

Accepting this limitation the following placed in a template might do what 
you seek:

#set $ws_max_time = $week.windSpeed.maxtime.raw
This week's maximum windSpeed was $week.windSpeed.max from 
$current($timestamp=$ws_max_time, $max_delta=150).windDir at 
$week.windSpeed.maxtime

or for an ordinal direction:

This week's maximum windSpeed was $week.windSpeed.max from 
$current($timestamp=$ws_max_time, $max_delta=150).windDir.ordinal_compass 
at $week.windSpeed.maxtime

This will lookup the wind direction at the time of the max windSpeed during 
the week. In all likelihood that timestamp will not exist in your archive 
so the $max_delta parameter ($max_delta should be set to at least half your 
archive interval in seconds) is used to find the nearest wind direction 
value in time. As windSpeed is an average over the archive interval this 
will probably give an acceptable result. If you tried to use it for 'what 
was the outHumidity at the time of maximum outTemp during the week' you 
might be a little less satisfied as outTemp and outHumidty are essentially 
point in time values (how sharp a point depends on your stations 
capabilities) but as outTemp and outHumidty change quite slowly over time 
again it is probably an acceptable result. 

Gary

On Saturday, 8 September 2018 16:26:21 UTC+10, [email protected] wrote:
>
> It would be great if this new tag occured in future versions of weewx.

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to