ImageGenerator issues, 5.2 related?

93 views
Skip to first unread message

Thomas Carlin

unread,
Oct 26, 2025, 10:53:50 PM (9 days ago) Oct 26
to weewx-user
Good evening,

Apologies if this has been posted before.

I am running Debian Bookworm, and since my 5.2 upgrade have been unable to generate monthly and yearly charts.  My station is modified, but only according to the docs, and I have changed the schema import line where necessary, and overall, everything is working, but it looks like my daily and weekly graphs are generating, but my monthly and yearly are not.  I am running the old Sofaskin, and am getting the following traceback:

 ERROR weewx.reportengine: Caught unrecoverable exception in generator 'weewx.imagegenerator.ImageGenerator'
****  cannot convert float infinity to integer
****  Traceback (most recent call last):
****    File "/usr/share/weewx/weewx/reportengine.py", line 248, in run
****      obj.start()
****      ~~~~~~~~~^^
****    File "/usr/share/weewx/weewx/reportengine.py", line 465, in start
****      self.run()
****      ~~~~~~~~^^
****    File "/usr/share/weewx/weewx/imagegenerator.py", line 37, in run
****      self.gen_images(self.gen_ts)
****      ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
****    File "/usr/share/weewx/weewx/imagegenerator.py", line 107, in gen_images
****      image = plot.render()
****    File "/usr/share/weewx/weeplot/genplot.py", line 212, in render
****      self._calcYScaling()
****      ~~~~~~~~~~~~~~~~~~^^
****    File "/usr/share/weewx/weeplot/genplot.py", line 566, in _calcYScaling

****      self.yscale = weeplot.utilities.scale(ymin, ymax, self.yscale, nsteps=self.y_nticks)
****                    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
****    File "/usr/share/weewx/weeplot/utilities.py", line 134, in scale
****      mag = math.floor(math.log10(steps))
****  OverflowError: cannot convert float infinity to integer
****  Generator terminated

My top level tags for the different images are:
[[day_images]]
        x_label_format = %H:%M
        bottom_label_format = %x %X
        time_length = 97200    # == 27 hours

 [[week_images]]
        x_label_format = %d
        bottom_label_format = %x %X
        time_length = 604800    # == 7 days
        aggregate_type = avg
        aggregate_interval = 3600

    [[month_images]]
        x_label_format = %d
        bottom_label_format = %x %X
        time_length = 2592000    # == 30 days
        aggregate_type = avg
        aggregate_interval = 10800    # == 3 hours
        show_daynight = false

   [[year_images]]
        x_label_format = %m/%d
        bottom_label_format = %x %X
        time_length = 31536000    # == 365 days
        aggregate_type = avg
        aggregate_interval = 86400
        show_daynight = false

Let me know if there is anything else that would help to troubleshoot this issue.


Thomas Carlin

unread,
Oct 27, 2025, 11:23:28 AM (9 days ago) Oct 27
to weewx...@googlegroups.com
I did some more digging into this this morning, and found one metric that is causing the issue on the weekly, monthly and yearly timeframes.  This is one of the metrics that I have added, so that may be the root issue, but I ran some quick DB queries, and nothing jumped out at me.  I have included those below.  Hopefully this helps to determine what the cause is!

 sqlite> select * from archive_day_radiation where datetime > 1760745600;
dateTime|min|mintime|max|maxtime|sum|count|wsum|sumtime
1760767200|0.0|1760767500|685.24|1760813700|51685.1494308339|284|15505544.8292502|85200
1760853600|0.0|1760853900|682.04|1760901000|53013.1353305019|288|15903940.5991506|86400
1760940000|0.0|1760940300|679.726666666667|1760987400|52674.9659380714|288|15802489.7814214|86400
1761026400|0.0|1761026700|677.64|1761073200|52369.1979931721|288|15710759.3979516|86400
1761112800|0.0|1761113100|690.609271523179|1761160200|47996.5480343917|288|14398964.4103175|86400
1761199200|0.0|1761199500|828.453333333333|1761245400|23811.2295853442|251|7143368.87560327|75300
1761285600|0.0|1761296700|667.331125827815|1761329400|47724.9976410455|217|14317499.2923137|65100
1761372000|0.0|1761372300|731.218543046358|1761420900|45045.9752034106|287|13513792.5610232|86100
1761458400|0.0|1761458700|689.390728476821|1761502200|43612.5587295516|283|13083767.6188655|84900
1761544800|0.0|1761544804|98.0|1761577730|969.379449160703|111|290813.834748211|33300
sqlite> select datetime, cpm from archive where datetime > 1760745600;
....
1761570600|23.0
1761570900|25.95
1761571200|25.92
1761571500|21.88
1761571800|22.35
1761572100|23.9
1761572400|22.7466666666667
1761572700|21.034
1761573000|24.3166666666667
1761573300|24.1323333333333
1761573600|21.0133333333333
1761573900|25.1823333333333
1761574200|21.3866666666667
1761574500|25.8426666666667
1761574800|23.7066666666667
1761575100|21.9116666666667
1761575400|21.14
1761575700|27.1826666666667
1761576000|23.8633333333333
1761576300|22.6433333333333
1761576600|29.92
1761576900|20.7233333333333
1761577200|25.3233333333333
1761577500|24.931
1761577800|22.5333333333333
1761578100|22.3283333333333
sqlite>

--
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/VnBsK41phLc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-user/7c7d0654-9592-4703-b311-4ec8339f50f0n%40googlegroups.com.


--
Thomas Carlin
970-401-3805

Tom Keffer

unread,
Oct 27, 2025, 11:34:19 AM (9 days ago) Oct 27
to weewx...@googlegroups.com
Not obvious to me what is going wrong.

I think you're going to have to isolate exactly which plot is causing the problem. Go into Sofaskin's configuration file skin.conf and comment out image specifications until you find the culprit. Use "weectl report run" to speed up the process.

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

p q

unread,
Oct 27, 2025, 11:43:00 AM (9 days ago) Oct 27
to weewx...@googlegroups.com
I'm guessing you have a divide by zero in there someplace that's causing the infinity. Are any of the possible denominators in ymin, ymax, self.yscale, self.y_nticks zero? I'm guessing it's scale or nticks.



--
Peter Quinn
(415)794-2264

Thomas Carlin

unread,
Oct 27, 2025, 1:08:14 PM (9 days ago) Oct 27
to weewx...@googlegroups.com
I did end up tracking down the offending metric and charts, All of them are the same metric, with no extra tags, but it is one that I have added to the system, cpm (radiation counts per minute).  The day graph works, but the weekly, monthly and yearly all fail, with the traceback listed above.  There are excerpts from the database listed above.

[[month_images]]
        x_label_format = %d
        bottom_label_format = %x %X
        time_length = 2592000    # == 30 days
        aggregate_type = avg
        aggregate_interval = 10800    # == 3 hours
        show_daynight = false
         .........
        [[[weekRadiation]]]
             [[[[cpm]]]]

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/VnBsK41phLc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-user/CAA1SM22a0K9%2BiXfaMvfn%2BRpZwh5nouivYaNpb4PoLCXSQ-dz5w%40mail.gmail.com.


--
Thomas Carlin
970-401-3805

Tom Keffer

unread,
Oct 28, 2025, 10:42:51 AM (8 days ago) Oct 28
to weewx...@googlegroups.com
- Any particular reason why you think the bad data is located somewhere after timestamp 1760745600?
- Try a different aggregate type besides "avg". That may give you a clue.
- The specification for [[month_images]] uses an aggregation interval of 3 hours, so it will not use the daily summaries when plotting. If there is a bad value somewhere, it will be in the archive directory.

The Python value "inf" is not easy to generate. You usually have to specify it explicitly. I'm not 100% sure, but I suspect that you have a bad value somewhere in your archive directory.

-tk


Thomas Carlin

unread,
Oct 28, 2025, 2:41:11 PM (8 days ago) Oct 28
to weewx...@googlegroups.com
Hey Tom,

My reasoning for 1760745600 is that the daily graph generates without issue, but the weekly fails, so at the time i posted this, that would include all the data in that chart.  

I set 
[[[weekRadiation]]]
aggregate_type = max

and 
[[[monthRadiation]]]
aggregate_type = max

and still got the same error, so i started adjusting the times of the weekly chart.  I was able to isolate down that the chart succeeded at 257400, and failed at 342000, again with the same error.  This was recorded at 1761675900, leaving my error between 1761333900 and 1761418500.

I went ahead and ran a database query, and sure enough, right there in the middle was an Inf value.  I thought I had looked through all that the other night, but I must have missed it.  All my graphs are re-enabled, and everything is generating like it is supposed to!  Now I just need to figure out how that value got in there to begin with...

As always, great software, keep up the good work!



--
Thomas Carlin
970-401-3805

Tom Keffer

unread,
Oct 28, 2025, 2:59:45 PM (8 days ago) Oct 28
to weewx...@googlegroups.com
Glad to hear it worked out.

It's not easy to insert a value of 'Inf' in sqlite either, although slightly easier than in Python. It can be done if you enter a very large number, such as "1.0e+9999", or enter it explicitly as "Inf".


Reply all
Reply to author
Forward
0 new messages