ImageGenerator math domain error

104 views
Skip to first unread message

Tarmo

unread,
Jan 14, 2021, 6:37:02 AM1/14/21
to weewx-user
Hi,

Please help with this:

Jan 14 13:21:58 pi3 systemd[1]: Starting LSB: weewx weather system...
Jan 14 13:21:59 pi3 weewx[1306] INFO __main__: Initializing weewx version 4.3.0b2
Jan 14 13:21:59 pi3 weewx[1306] INFO __main__: Using Python 3.5.3 (default, Nov 18 2020, 21:09:16) #012[GCC 6.3.0 20170516]
Jan 14 13:21:59 pi3 weewx[1306] INFO __main__: Platform Linux-4.19.66-v7+-armv7l-with-debian-9.13
Jan 14 13:21:59 pi3 weewx[1306] INFO __main__: Locale is 'en_GB.UTF-8'
Jan 14 13:21:59 pi3 weewx[1306] INFO __main__: PID file is /var/run/weewx.pid
Jan 14 13:21:59 pi3 weewx[1310] INFO __main__: Using configuration file /home/weewx/weewx.conf
Jan 14 13:21:59 pi3 weewx[1310] INFO __main__: Debug is 0
Jan 14 13:21:59 pi3 weewx[1310] INFO weewx.engine: Loading station type Vantage (weewx.drivers.vantage)
Jan 14 13:21:59 pi3 weewx[1295]: Starting weewx weather system: weewx.
Jan 14 13:21:59 pi3 systemd[1]: Started LSB: weewx weather system.
Jan 14 13:21:59 pi3 weewx[1310] INFO weewx.engine: StdConvert target unit is 0x1
Jan 14 13:21:59 pi3 weewx[1310] INFO weewx.engine: Archive will use data binding wx_binding
Jan 14 13:21:59 pi3 weewx[1310] INFO weewx.engine: Record generation will be attempted in 'hardware'
Jan 14 13:21:59 pi3 weewx[1310] INFO weewx.engine: Using archive interval of 300 seconds (specified by hardware)
Jan 14 13:21:59 pi3 weewx[1310] INFO weewx.restx: StationRegistry: Station will be registered.
Jan 14 13:21:59 pi3 weewx[1310] INFO user.mqtt: service version is 0.22
Jan 14 13:21:59 pi3 weewx[1310] INFO user.mqtt: binding to loop
Jan 14 13:21:59 pi3 weewx[1310] INFO user.mqtt: topic is weather
Jan 14 13:21:59 pi3 weewx[1310] INFO user.mqtt: desired unit system is METRIC
Jan 14 13:21:59 pi3 weewx[1310] INFO user.mqtt: data will be uploaded to mqtt://ilm:xxx@localhost:1883/
Jan 14 13:21:59 pi3 weewx[1310] INFO weewx.restx: Wunderground-PWS: Data for station IHARJUMA19 will be posted
Jan 14 13:21:59 pi3 weewx[1310] INFO user.windy: version is 0.7
Jan 14 13:21:59 pi3 weewx[1310] INFO user.windy: Data will be uploaded to https://stations.windy.com/pws/update
Jan 14 13:21:59 pi3 weewx[1310] INFO __main__: Starting up weewx version 4.3.0b2
Jan 14 13:21:59 pi3 weewx[1310] INFO weewx.engine: Clock error is 0.06 seconds (positive is fast)
Jan 14 13:21:59 pi3 weewx[1310] INFO weewx.engine: Using binding 'wx_binding' to database 'weewx.sdb'
Jan 14 13:21:59 pi3 weewx[1310] INFO weewx.manager: Starting backfill of daily summaries
Jan 14 13:21:59 pi3 weewx[1310] INFO weewx.engine: Starting main packet loop.
Jan 14 13:25:20 pi3 weewx[1310] INFO weewx.manager: Added record 2021-01-14 13:25:00 EET (1610623500) to database 'weewx.sdb'
Jan 14 13:25:20 pi3 weewx[1310] INFO weewx.manager: Added record 2021-01-14 13:25:00 EET (1610623500) to daily summary in 'weewx.sdb'
Jan 14 13:25:22 pi3 weewx[1310] INFO weewx.restx: Windy: Published record 2021-01-14 13:25:00 EET (1610623500)
Jan 14 13:25:22 pi3 weewx[1310] INFO weewx.restx: StationRegistry: Published record 2021-01-14 13:25:00 EET (1610623500)
Jan 14 13:25:22 pi3 weewx[1310] INFO weewx.restx: Wunderground-PWS: Published record 2021-01-14 13:25:00 EET (1610623500)
Jan 14 13:27:00 pi3 weewx[1310] INFO weewx.cheetahgenerator: Generated 158 files for report SeasonsReport in 98.47 seconds
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: Caught unrecoverable exception in generator 'weewx.imagegenerator.ImageGenerator'
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** math domain error
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** Traceback (most recent call last):
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** File "/home/weewx/bin/weewx/reportengine.py", line 196, in run
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** obj.start()
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** File "/home/weewx/bin/weewx/reportengine.py", line 281, in start
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** self.run()
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** File "/home/weewx/bin/weewx/imagegenerator.py", line 41, in run
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** self.genImages(self.gen_ts)
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** File "/home/weewx/bin/weewx/imagegenerator.py", line 263, in genImages
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** image = plot.render()
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** File "/home/weewx/bin/weeplot/genplot.py", line 210, in render
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** self._calcYScaling()
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** File "/home/weewx/bin/weeplot/genplot.py", line 517, in _calcYScaling
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** self.yscale = weeplot.utilities.scale(ymin, ymax, self.yscale, nsteps=self.y_nticks)
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** File "/home/weewx/bin/weeplot/utilities.py", line 132, in scale
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** mag = math.floor(math.log10(steps))
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** ValueError: math domain error
Jan 14 13:27:06 pi3 weewx[1310] ERROR weewx.reportengine: **** Generator terminated
Jan 14 13:27:06 pi3 weewx[1310] INFO weewx.reportengine: Copied 15 files to /var/ramdisk/ilmajaam
Jan 14 13:27:07 pi3 weewx[1310] INFO weeutil.rsyncupload: rsync'd 206 files (865,386 bytes) in 0.95 seconds

Tom Keffer

unread,
Jan 14, 2021, 10:11:12 AM1/14/21
to weewx-user
Hello, Tarmo

One of the images that you are trying to generate has an option y_scale with a min_interval of zero, or less than zero.

Look in the file /home/weewx/skins/Seasons/skin.conf for images that use y_scale. They will look something like this:

    yscale = 10, 20, -1

or like this

    yscale = 10, 20, 0

The "10" and the "20" do not matter. It's the last number that we care about. It cannot be less than or equal to zero. 

If you're having trouble, post the file skin.conf.

-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/4a9fa165-a2d6-42ee-bd21-b592e83bac22n%40googlegroups.com.

Tarmo

unread,
Jan 14, 2021, 10:52:59 AM1/14/21
to weewx-user
Hello, Tom!

No less than or equal to zero values at min_interval.

pi@pi3:/home/weewx/skins/Seasons $ grep yscale skin.conf 
    # plotting can be controlled using option 'yscale'. It is a 3-way tuple,
    yscale = None, None, None
            yscale = None, None, 0.5
            yscale = None, None, 0.02
            yscale = 0.0, 360.0, 45.0
#            yscale = 0, 16, 1
            yscale = 0.0, 100.0, 25.0
            yscale = 0, None, 0.01
            yscale = None, None, 0.5
            yscale = None, None, 0.02
            yscale = 0.0, 360.0, 45.0
#            yscale = 0, 16, 1
            yscale = 0.0, 100.0, 25.0
            yscale = 0, None, 0.01
            yscale = None, None, 0.5
            yscale = None, None, 0.02
            yscale = 0.0, 360.0, 45.0
#            yscale = 0, 16, 1
            yscale = 0.0, 100.0, 25.0
            yscale = 0, None, 0.01
            yscale = None, None, 0.5
            yscale = None, None, 0.02
            yscale = 0.0, 360.0, 45.0
#            yscale = 0, 16, 1
            yscale = 0.0, 100.0, 25.0
            yscale = 0, None, 0.01



skin.conf

Tom Keffer

unread,
Jan 14, 2021, 12:05:28 PM1/14/21
to weewx-user
Something deeper must be going on. Please replace your copy of /home/weewx/bin/weeplot/genplot.py with the attached. It has been instrumented to give us more information about the error.

Run until weewxd (or wee_reports). Hopefully, the report will crash like before. Post the resultant log.

-tk

genplot.py

Tarmo

unread,
Jan 14, 2021, 12:53:26 PM1/14/21
to weewx-user
I recgonize yscale=[0.0, None, 0.01] as my heatpump service image. The service is not running currently and the soiltemp3 (where the values are stored) in the database is empty.

Jan 14 19:40:30 pi3 weewx[5405] INFO weewx.cheetahgenerator: Generated 8 files for report SeasonsReport in 4.85 seconds
Jan 14 19:40:35 pi3 weewx[5405] ERROR weeplot.genplot: scale error math domain error
Jan 14 19:40:35 pi3 weewx[5405] ERROR weeplot.genplot: ymin=-17.77777777777778; ymax=-17.77777777777778; yscale=[0.0, None, 0.01], y_nticks=10
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine: Caught unrecoverable exception in generator 'weewx.imagegenerator.ImageGenerator'
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****  math domain error
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****  Traceback (most recent call last):
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/reportengine.py", line 196, in run
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****      obj.start()
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/reportengine.py", line 281, in start
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****      self.run()
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/imagegenerator.py", line 41, in run
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****      self.genImages(self.gen_ts)
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weewx/imagegenerator.py", line 263, in genImages
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****      image = plot.render()
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weeplot/genplot.py", line 212, in render
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****      self._calcYScaling()
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weeplot/genplot.py", line 520, in _calcYScaling
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****      self.yscale = weeplot.utilities.scale(ymin, ymax, self.yscale, nsteps=self.y_nticks)
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****    File "/home/weewx/bin/weeplot/utilities.py", line 132, in scale
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****      mag = math.floor(math.log10(steps))
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****  ValueError: math domain error
Jan 14 19:40:35 pi3 weewx[5405] ERROR weewx.reportengine:         ****  Generator terminated
Jan 14 19:40:35 pi3 weewx[5405] INFO weewx.reportengine: Copied 15 files to /var/ramdisk/ilmajaam

Tom Keffer

unread,
Jan 14, 2021, 6:44:35 PM1/14/21
to weewx-user
OK, the problem is that you're asking to plot something with a minimum and maximum value of -17.7777778, but the scaling has been set to (0, None, .01), meaning the minimum y-axis value is pegged at 0.0. The plot becomes impossible.

Still, it shouldn't crash the report, so it's a bug. 

But, I would set scaling to (None, None, 0.01).

Tarmo

unread,
Jan 15, 2021, 6:03:12 AM1/15/21
to weewx-user
Thanks, Tom. 

Scaling to (None, None, 0.01) works.

Tom Keffer

unread,
Jan 15, 2021, 12:52:50 PM1/15/21
to weewx-user
Fixed in commit bf4da5b

If you want to take advantage of the fix now, use this version of genplot/utilities.py: https://raw.githubusercontent.com/weewx/weewx/master/bin/weeplot/utilities.py

Reply all
Reply to author
Forward
0 new messages