How to get direction at $week.windSpeed.max

50 views
Skip to first unread message

tfi...@gmail.com

unread,
Sep 7, 2018, 1:48:36 PM9/7/18
to weewx-user
Hello

I can get $week.wind.max from $week.wind.gustdir.ordinal_compass
but how can I get direction at $week.windSpeed.min or $week.windSpeed.max ?
If I try $week.windDir.max.ordinal_compass i get usualy value around 360 which is maximum value per week but I want to get wind direction at time of maximum / minimum windSpeed.

Thank you.

Thomas Keffer

unread,
Sep 7, 2018, 6:48:18 PM9/7/18
to weewx-user
You can't without writing a search list extension.

All you can get is gustdir, which is the direction of the max (gust) wind.

Sorry.

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

gjr80

unread,
Sep 7, 2018, 9:09:02 PM9/7/18
to weewx-user
This gives me an idea for a new tag....

Gary

tfi...@gmail.com

unread,
Sep 8, 2018, 2:25:29 AM9/8/18
to weewx-user
Thank you for answer. If i will have some time i will look at how to write custom searchlist.

tfi...@gmail.com

unread,
Sep 8, 2018, 2:26:21 AM9/8/18
to weewx-user
It would be great if this new tag occured in future versions of weewx.

gjr80

unread,
Sep 10, 2018, 12:21:43 AM9/10/18
to weewx-user
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

Tomáš Filo

unread,
Sep 10, 2018, 2:07:11 AM9/10/18
to Andrew Milner
Thank you very much, your solution is more than enough. 


Tomáš


po 10. 9. 2018 o 6:21 gjr80 <gjrod...@gmail.com> napísal(a):
--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/7oLvuFMXFXg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages