Rainy days greater than 1mm

87 views
Skip to first unread message

Chris Davies-Barnard

unread,
Sep 28, 2020, 3:07:00 PM9/28/20
to weewx-user
Evening all,

From the http://www.weewx.com/docs/customizing.htm#aggregation_types page I believe the following should work for months with equivalents working for weeks and years.

$month.rain.sum_ge(1.0)

and thus provide me with a value comparable to the MET Office Climate Averages.


but at the moment I'll getting an error:

Sep 28 20:05:44 pecan-ubuntu wee_reports[30045] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/tags.py", line 326, in sum_ge
Sep 28 20:05:44 pecan-ubuntu wee_reports[30045] ERROR weewx.cheetahgenerator: ****      return self._do_query('sum_ge', val=val)
Sep 28 20:05:44 pecan-ubuntu wee_reports[30045] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/tags.py", line 364, in _do_query
Sep 28 20:05:44 pecan-ubuntu wee_reports[30045] ERROR weewx.cheetahgenerator: ****      db_manager, val=val, **self.option_dict)
Sep 28 20:05:44 pecan-ubuntu wee_reports[30045] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/xtypes.py", line 102, in get_aggregate
Sep 28 20:05:44 pecan-ubuntu wee_reports[30045] ERROR weewx.cheetahgenerator: ****      **option_dict)
Sep 28 20:05:44 pecan-ubuntu wee_reports[30045] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/xtypes.py", line 422, in get_aggregate
Sep 28 20:05:44 pecan-ubuntu wee_reports[30045] ERROR weewx.cheetahgenerator: ****      if len(val) == 2:
Sep 28 20:05:44 pecan-ubuntu wee_reports[30045] ERROR weewx.cheetahgenerator: ****  TypeError: object of type 'float' has no len()

and a different error if I wrap 1.0 in quotes.

How am I getting this wrong?

Chris

Tom Keffer

unread,
Sep 28, 2020, 6:07:14 PM9/28/20
to weewx...@googlegroups.com
The aggregate type sum_ge() actually takes a ValueTuple as an argument, not a single float. As a convenience, for some types, it can be shortened to a 2-way tuple. So, you want

$month.rain.sum_ge((1.0, 'mm'))

-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/13789d5f-eb48-4309-89f8-3af3e8759adbn%40googlegroups.com.

Chris Davies-Barnard

unread,
Sep 29, 2020, 1:35:54 AM9/29/20
to weewx-user
Thanks Tom.  

Should I have been able to glean this from the documentation?

If not, could the documentation be updated to show the inputs required?  Something in keeping with or similar to the main Python documentation.

Thanks again for the excellent support.

Chris

Tom Keffer

unread,
Sep 29, 2020, 7:31:42 AM9/29/20
to weewx-user
Yes, it should be possible. Unfortunately, there's not much documentation about aggregations taking a value, and what little there is, is wrong!

Tom Keffer

unread,
Sep 29, 2020, 8:05:35 AM9/29/20
to weewx-user
Commit 73d8d2

Chris Davies-Barnard

unread,
Sep 29, 2020, 8:27:48 AM9/29/20
to weewx...@googlegroups.com
Thank you.



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/n5OKwM7Q2_U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEBw7FrJfQFAxesLL5U3PQvUi3%3Dnq_j%3DaMah7%3DF0tLJU1Q%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages