Stackedwindrose and Weewx 4.0.0

228 views
Skip to first unread message

Mikael Fredriksson

unread,
May 4, 2020, 5:46:16 PM5/4/20
to weewx-user
Hi!

Just updated weewx 3.9.1 to 4.0.0
Everything seems to be good except the stackedwindrose imagegenerator.

I get this message in the log:

May  4 23:21:49 raspberrypi weewx[12467] ERROR weewx.reportengine: Caught unrecoverable exception in generator 'user.imageStackedWindRose.ImageStackedWindRoseGenerator'
May  4 23:21:49 raspberrypi weewx[12467] ERROR weewx.reportengine:         ****  decoding Unicode is not supported
May  4 23:21:49 raspberrypi weewx[12467] ERROR weewx.reportengine:         ****  Traceback (most recent call last):
May  4 23:21:49 raspberrypi weewx[12467] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weewx/reportengine.py", line 197, in run
May  4 23:21:49 raspberrypi weewx[12467] ERROR weewx.reportengine:         ****      obj.start()
May  4 23:21:49 raspberrypi weewx[12467] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weewx/reportengine.py", line 280, in start
May  4 23:21:49 raspberrypi weewx[12467] ERROR weewx.reportengine:         ****      self.run()
May  4 23:21:49 raspberrypi weewx[12467] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/user/imageStackedWindRose.py", line 200, in run
May  4 23:21:49 raspberrypi weewx[12467] ERROR weewx.reportengine:         ****      self.gen_windrose_plots()
May  4 23:21:49 raspberrypi weewx[12467] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/user/imageStackedWindRose.py", line 261, in gen_windrose_plots
May  4 23:21:49 raspberrypi weewx[12467] ERROR weewx.reportengine:         ****      self.label = unicode(label, 'utf8')
May  4 23:21:49 raspberrypi weewx[12467] ERROR weewx.reportengine:         ****  TypeError: decoding Unicode is not supported
May  4 23:21:49 raspberrypi weewx[12467] ERROR weewx.reportengine:         ****  Generator terminated

Line 261 in file "/usr/share/weewx/user/imageStackedWindRose.py" : self.label = unicode(label, 'utf8')
Tried to change "utf8" to "utf-8" and "UTF-8"  but no.

Something wrong with decoding unicode, but I don't understand what to change...
Any help appreciated.

And thanks for the weewx update!

/Mikael

Tom Keffer

unread,
May 4, 2020, 6:24:44 PM5/4/20
to weewx-user
Looks like the stackedwindrose generator has not been ported to Python 3. The function "unicode()" no longer exists in Python 3.

--
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/d7df5bb2-ea21-4726-9e6e-44afb949c4e1%40googlegroups.com.

gjr80

unread,
May 4, 2020, 6:29:51 PM5/4/20
to weewx-user
It’s mine, part of WeeWX-WD, it’s been ported but needs to be packaged. Will be completed shortly.

Gary

Mikael Fredriksson

unread,
May 4, 2020, 6:31:26 PM5/4/20
to weewx-user
Ok then I´ll wait and hope that it will get ported, otherwise I'll have to remove it.
Thanks tk!

Den tisdag 5 maj 2020 kl. 00:24:44 UTC+2 skrev Tom Keffer:
Looks like the stackedwindrose generator has not been ported to Python 3. The function "unicode()" no longer exists in Python 3.

To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.

Mikael Fredriksson

unread,
May 4, 2020, 6:37:05 PM5/4/20
to weewx-user
Ah great Gary! Thanks!

re...@eau.net

unread,
May 4, 2020, 7:51:52 PM5/4/20
to weewx-user
Gary, Will you be posting an all-clear message when it has been done and works?  We should wait until we hear from you, obviously, but don't know the protocol you use to say all is well.
Thanks.  Dale

gjr80

unread,
May 4, 2020, 11:16:06 PM5/4/20
to weewx-user
Yes I will post here when released.

Gary

Tom Weber

unread,
Jun 5, 2020, 11:42:04 AM6/5/20
to weewx-user
Dear Gary, love your windrose - but have same issue with my new weewx 4 - is there any solution for that error ?

gjr80

unread,
Jun 6, 2020, 2:45:58 AM6/6/20
to weewx-user
My apologies for the delays, a few issues merging the stacked windrose code from WeeWX-WD and weewx-stackedwindrose. Should be taken care of now and weewx-stackedwidrose will run under WeeWX 3.2+ or 4.x with python 2.7 or 3.x. The release can be found here.

I should point out there are a couple of manual edits/actions you will need to take if upgrading from v2.1.1 or earlier. These are covered in the Upgrading Instructions in the readme.

As usual if any issues please let me know.

Gary

Jerry Keefe

unread,
Jun 6, 2020, 6:13:16 PM6/6/20
to weewx-user
Getting errors with V 3.0 and Weewx 4.1.1, macOS 10.15.5 python3 3.8.3

weewx[86199] INFO __main__: Starting up weewx version 4.1.1
weewx[86199] INFO weewx.engine: Clock error is -3.87 seconds (positive is fast)
weewx[86199] INFO weewx.engine: Using binding 'wx_binding' to database 'weewx.sdb'
weewx[86199] INFO weewx.manager: Starting backfill of daily summaries
weewx[86199] INFO weewx.engine: Starting main packet loop.
weewx[86199] INFO weewx.manager: Added record 2020-06-06 14:55:00 PDT (1591480500) to database 'weewx.sdb'
weewx[86199] INFO weewx.manager: Added record 2020-06-06 14:55:00 PDT (1591480500) to daily summary in 'weewx.sdb'
weewx[86199] INFO weewx.restx: Wunderground-PWS: Published record 2020-06-06 14:55:00 PDT (1591480500)
weewx[86199] INFO weewx.restx: StationRegistry: Published record 2020-06-06 14:55:00 PDT (1591480500)
weewx[86199] INFO weewx.cheetahgenerator: Generated 14 files for report StandardReport in 1.00 seconds
weewx[86199] INFO weewx.imagegenerator: Generated 12 images for report StandardReport in 0.47 seconds
weewx[86199] INFO weewx.reportengine: Copied 14 files to /Users/rycweather/www
weewx[86199] INFO weewx.cheetahgenerator: Generated 8 files for report SeasonsReport in 1.23 seconds
weewx[86199] INFO weewx.imagegenerator: Generated 14 images for report SeasonsReport in 0.40 seconds
weewx[86199] INFO weewx.reportengine: Copied 5 files to /Users/rycweather/www/seasons
weewx[86199] INFO weewx.cheetahgenerator: Generated 6 files for report SmartphoneReport in 0.09 seconds
weewx[86199] INFO weewx.imagegenerator: Generated 6 images for report SmartphoneReport in 0.10 seconds
weewx[86199] INFO weewx.reportengine: Copied 6 files to /Users/rycweather/www/smartphone
weewx[86199] ERROR weewx.reportengine: Caught unrecoverable exception in generator 'user.stackedwindrose.StackedWindRoseImageGenerator'
weewx[86199] ERROR weewx.reportengine:         ****  '>' not supported between instances of 'NoneType' and 'float'
weewx[86199] ERROR weewx.reportengine:         ****  Traceback (most recent call last):

weewx[86199] ERROR weewx.reportengine:         ****    File "/Users/rycweather/weewx/bin/weewx/reportengine.py", line 197, in run

weewx[86199] ERROR weewx.reportengine:         ****      obj.start()

weewx[86199] ERROR weewx.reportengine:         ****    File "/Users/rycweather/weewx/bin/weewx/reportengine.py", line 280, in start

weewx[86199] ERROR weewx.reportengine:         ****      self.run()

weewx[86199] ERROR weewx.reportengine:         ****    File "/Users/rycweather/weewx/bin/user/stackedwindrose.py", line 226, in run

weewx[86199] ERROR weewx.reportengine:         ****      self.gen_images(self.gen_ts)

weewx[86199] ERROR weewx.reportengine:         ****    File "/Users/rycweather/weewx/bin/user/stackedwindrose.py", line 336, in gen_images

weewx[86199] ERROR weewx.reportengine:         ****      _max_speed = max(speed_data.value)

weewx[86199] ERROR weewx.reportengine:         ****  TypeError: '>' not supported between instances of 'NoneType' and 'float'

weewx[86199] ERROR weewx.reportengine:         ****  Generator terminated

gjr80

unread,
Jun 6, 2020, 7:02:19 PM6/6/20
to weewx-user
Ah, the changed behaviour of max() under python3. Try this:

1. rename your existing /Users/rycweather/weewx/bin/user/stackedwindrose.py to stackedwindrose_300.py
2. download this version of stackedwindrose.py to the /Users/rycweather/weewx/bin/user directory
3. restart WeeWX

Gary

Jerry Keefe

unread,
Jun 6, 2020, 7:34:52 PM6/6/20
to weewx-user
All good, thanks.

daywindrose.png

Jerry Keefe

unread,
Jun 6, 2020, 8:07:49 PM6/6/20
to weewx-user
Another question.  I was trying to add a Week Wind Rose in addition to the Day Wind Rose.  It works by the additions below in weewx.conf, however, the images look strangely similar.  Am approaching this wrong?  Should I create another stanza for the stackedwindrose?

    [[StackedWindRose]]
        skin = StackedWindRose
        enable = true
        [[[Units]]]
            [[[[Labels]]]]
                mile_per_hour = mph
                meter_per_second = m/s
                knot = knots
                km_per_hour = km/h
            [[[[Groups]]]]
                group_speed = knot
        [[[Labels]]]
            compass_points = N, S, E, W
            [[[[Generic]]]]
                windSpeed = Wind Speed
                windGust = Gust Speed
                        
        [[[StackedWindRoseImageGenerator]]]
            image_background_image = None
            image_width = 382
            image_height = 361
            image_background_circle_color = 0xF5F5F5
            image_background_box_color = 0xF5C696
            image_background_range_ring_color = 0xC3D9DD
            windrose_plot_border = 5
            windrose_legend_bar_width = 10
            windrose_font_path = /usr/share/fonts/truetype/freefont/FreeSansBold.ttf
            windrose_plot_font_size = 10
            windrose_plot_font_color = 0x000000
            windrose_legend_font_size = 10
            windrose_legend_font_color = 0x000000
            windrose_label_font_size = 12
            windrose_label_font_color = 0x000000
            windrose_plot_petal_colors = aqua, 0xFF9900, 0xFF3300, 0x009900, 0x00CC00, 0x33FF33, 0x00FFCC
            windrose_plot_petal_width = 16
            [[[[day_images]]]]
                time_length = 86400
                [[[[[daywindrose]]]]]
                    format = png
                    [[[[[[windSpeed]]]]]]
                        label = 24 Hour Wind Rose
                        time_stamp = %H:%M %-d %b %y
                        time_stamp_location = bottom, right
                time_length = 592200
                [[[[[weekwindrose]]]]]
                    format = png
                    [[[[[[windSpeed]]]]]]
                        label = Weekly Wind Rose
                        time_stamp = %H:%M %-d %b %y
                        time_stamp_location = bottom, right

daywindrose.png

weekwindrose.png

gjr80

unread,
Jun 6, 2020, 8:52:23 PM6/6/20
to weewx-user
I think you will need something like this:

            windrose_plot_petal_width = 16
           
[[[[day_images]]]]
                time_length
= 86400
               
[[[[[daywindrose]]]]]
                    format
= png
                   
[[[[[[windSpeed]]]]]]
                        label
= 24 Hour Wind Rose
                        time_stamp
= %H:%M %-d %b %y
                        time_stamp_location
= bottom,
right
           
[[[[week_images]]]]
                time_length
= 604800

               
[[[[[weekwindrose]]]]]
                    format
= png
                   
[[[[[[windSpeed]]]]]]

                        label
= Week Wind Rose

                        time_stamp
= %H:%M %-d %b %y
                        time_stamp_location
= bottom, right

you could use something like:

            windrose_plot_petal_width = 16
           
[[[[day_images]]]]
                time_length
= 86400
               
[[[[[daywindrose]]]]]
                    format
= png
                   
[[[[[[windSpeed]]]]]]
                        label
= 24 Hour Wind Rose
                        time_stamp
= %H:%M %-d %b %y
                        time_stamp_location
= bottom,
right
               
[[[[[weekwindrose]]]]]
                    time_length = 604800
                    format
= png
                   
[[[[[[windSpeed]]]]]]
                        label
= Week Wind Rose

                        time_stamp
= %H:%M %-d %b %y
                        time_stamp_location
= bottom, right

which I believe will achieve the same outcome but it's starting to get confusing. Whilst the [[[[xxx_images]]]] heading is completely arbitrary (ie it can be anything it just needs to be unique) when you have week long images under [[[[day_images]]]] it can get confusing.

Gary

Graham Eddy

unread,
Jun 6, 2020, 9:58:19 PM6/6/20
to weewx-user
it is better to group under duration (day, week, etc) to inherit same duration and aggregation e.g.
    [[week_images]] < < < <
        x_label_format = %d
        bottom_label_format = %x %X
        time_length = 604800 # 7 days < < < <
        aggregate_type = avg
        aggregate_interval = 3600       < < < <
[[[some_week_graph]]]
    .. .. ..
[[[another_week_graph]]]
    .. .. ..
g-eddy

--
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.

Jerry Keefe

unread,
Jun 6, 2020, 10:06:08 PM6/6/20
to weewx-user
Cool.  That was going to be my next question.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.

Jerry Keefe

unread,
Jun 7, 2020, 8:40:17 PM6/7/20
to weewx-user
StackedWindRose is now generating daily and weekly images but on a puzzlin' schedule.  I expected them to both run every 5 minutes, until I implemented Graham's suggestions.  But the weekly wind rose png only gets generated every 12th run.  This OK, but not what I expected.  It seems like weekly gets generated once every 12th run, but not on a repeatable on the hour schedule like the other weekly graphics.  How does it know to do that?
└─[$] <> ll *windrose.png                 
-rw-r--r--  1 root  staff   8.2K Jun  7 17:15 daywindrose.png
-rw-r--r--  1 root  staff   9.0K Jun  7 16:55 weekwindrose.png

weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 2 images for StackedWindRose in 0.06 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 2 images for StackedWindRose in 0.06 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 2 images for StackedWindRose in 0.07 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds
weewx[92244] INFO user.stackedwindrose: Generated 1 images for StackedWindRose in 0.03 seconds


        [[[StackedWindRoseImageGenerator]]]
            image_background_image = None
            image_width = 382
            image_height = 361
            image_background_circle_color = 0xF5F5F5
            image_background_box_color = 0xF5C696
            image_background_range_ring_color = 0xC3D9DD
            windrose_plot_border = 5
            windrose_legend_bar_width = 10
            windrose_font_path = /usr/share/fonts/truetype/freefont/FreeSansBold.ttf
            windrose_plot_font_size = 10
            windrose_plot_font_color = 0x000000
            windrose_legend_font_size = 10
            windrose_legend_font_color = 0x000000
            windrose_label_font_size = 12
            windrose_label_font_color = 0x000000
            windrose_plot_petal_colors = aqua, 0xFF9900, 0xFF3300, 0x009900, 0x00CC00, 0x33FF33, 0x00FFCC
            windrose_plot_petal_width = 16
            [[[[day_images]]]]
                time_length = 86400
                [[[[[daywindrose]]]]]
                    format = png
                    [[[[[[windSpeed]]]]]]
                        label = 24 Hour Wind Rose
                        time_stamp = %H:%M %-d %b %y
                        time_stamp_location = bottom, right
             [[[[[weekwindrose]]]]]
                time_length = 604800
                    format = png
                    [[[[[[windSpeed]]]]]]
                        label = Weekly Wind Rose
                        time_stamp = %H:%M %-d %b %y
                        time_stamp_location = bottom, right

Graham Eddy

unread,
Jun 7, 2020, 8:49:02 PM6/7/20
to weewx...@googlegroups.com
not all items are generated at every cycle - it is graduated.
for example, why generate a yearly graph every 5 mins.
scheduling options are available to override defaults.
g-eddy

Jerry Keefe

unread,
Jun 7, 2020, 9:06:05 PM6/7/20
to weewx-user
I expected that I would have to add a section under [[[[week_images]]]].  Both graphics run under [[[[day_images]]]]

gjr80

unread,
Jun 7, 2020, 10:21:06 PM6/7/20
to weewx-user
Let me clear a few things up.

The approach taken by the WeeWX image generator is to generate a given image/plot every 'aggregate_interval' seconds where aggregate_interval is the aggregate interval applied to that particular plot. If there is no aggregate_interval (eg for 'day' plots) the image/plot is generated on every report cycle, by default week, month and year plots use a one, three and 24 hour aggregate_interval respectively. This results in the default behaviour where week, month and year plots are  generated every one, three and 24 hours respectively (the one, three and 24 hour period is taken from the time the plot was last generated rather than on the hour or such like, so the actual hour/minute of generation tends to vary as WeeWX is started/stopped/restarted etc over time). The only modification that can be made to this behaviour is through changing the aggregate_interval setting for a plot, the link to aggregate_interval cannot be turned off as such. The issue you strike if you do remove the aggregate_interval for say a year plot is that you are now querying/plotting significantly more data points (eg 27 hours = 324 points at a five minute interval, one year = approx 105000 points at a five minute interval) and there will likely be a drop in performance for arguably little extra benefit.

The report_timing and stale_age options can be used to control when reports are run/images are generated; however, they can only delay a report/image generation they cannot make it happen more frequently (eg you cannot use the report_timing option to force a year plot with a 24 hour aggregate_interval to be generated every report cycle).

The stacked wind rose generator is slightly different in that it does not use an aggregate_interval. However, just as with the image generator the stacked wind rose generator suffers from the same performance penalties for long period plots, so to mitigate this issue I set the following in terms of when wind rose plots are generated:

- plots that do not exist are always generated
- plots covering a period less than seven days are generated every report cycle
- plots covering from seven days to less than 30 days are generated every one hour
- plots covering 30 days or more are generated every 24 hours

This closely follows the default WeeWX image generator behaviour. As with the image generator this behaviour is fixed but with the stacked wind rose generator you no longer have the ability to modify this behaviour through changing the aggregate_interval setting. You can use the report_timing option to control the stacked wind rose generator but it does not support the stale_age option (largely because when I wrote the stacked wind rose generator the WeeWX image generator did not support the stale_age option, it is simple enough to add and I likely do so in due course).

I hope this explains the behaviour being seen.

Gary
Reply all
Reply to author
Forward
0 new messages