Output the number of days on which the gust speed was above a certain value

46 views
Skip to first unread message

Rolf Zanchettin

unread,
May 10, 2020, 9:40:40 AM5/10/20
to weewx-user
Hello,

I would like to display the number of days on which the speed of the gusts was above 62 km/h:

$year.windGust.max_ge((62.0, "km_per_hour"))

However, the code throws the following error --> 

Generate failed with exception '<type 'exceptions.IndexError'>'
Reason: tuple index out of range

What am I doing wrong?

Thanks in advance
Best regards, Rolf

Tom Keffer

unread,
May 10, 2020, 12:39:44 PM5/10/20
to weewx-user
The argument to max_ge() is actually a ValueTuple, which has 3 elements. So, you want $year.windGust.max_ge((62.0, "km_per_hour", group_speed)).

Way back in the distant past (may have been version 1.0!), ValueTuples had only 2 elements. So, to maintain backwards compatibility with NOAA templates, 2-element ValueTuples are accepted, but only for temperature and rain units, not wind speed.

-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/9a857330-9e38-49c4-8c7c-fc857be47cb7%40googlegroups.com.

Rolf Zanchettin

unread,
May 11, 2020, 2:45:41 AM5/11/20
to weewx-user
Hey Tom,

many thanks for the clarification.

Best regards, Rolf


Am Sonntag, 10. Mai 2020 18:39:44 UTC+2 schrieb Tom Keffer:
The argument to max_ge() is actually a ValueTuple, which has 3 elements. So, you want $year.windGust.max_ge((62.0, "km_per_hour", group_speed)).

Way back in the distant past (may have been version 1.0!), ValueTuples had only 2 elements. So, to maintain backwards compatibility with NOAA templates, 2-element ValueTuples are accepted, but only for temperature and rain units, not wind speed.

-tk

On Sun, May 10, 2020 at 6:40 AM Rolf Zanchettin <rolz...@gmail.com> wrote:
Hello,

I would like to display the number of days on which the speed of the gusts was above 62 km/h:

$year.windGust.max_ge((62.0, "km_per_hour"))

However, the code throws the following error --> 

Generate failed with exception '<type 'exceptions.IndexError'>'
Reason: tuple index out of range

What am I doing wrong?

Thanks in advance
Best regards, Rolf

--
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...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages