'Seasons' skin - monthwindvec throwing errors

99 views
Skip to first unread message

Auchtermuchty Weather

unread,
Dec 23, 2024, 6:53:18 PM12/23/24
to weewx-user
I was getting errors. Process of elimination showed it was the monthwindvec image causing them, though not the day, week or year versions of that images.

I suspect data is at the bottom of this, but what data? Nothing odd in archive.windGust or windGustDir.

This is the latest WeeWx running on a Debian 12 virtual machine, and the database has the extended schema.

Turning on debugging didn't bring any extra information.

Caught unrecoverable exception in generator 'weewx.imagegenerator.ImageGenerator'
        ****  unsupported operand type(s) for -: 'float' and 'str'
        ****  Traceback (most recent call last):
        ****    File "/usr/share/weewx/weewx/xtypes.py", line 109, in get_series
        ****      return xtype.get_series(obs_type, timespan, db_manager, aggregate_type,
        ****             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        ****    File "/usr/share/weewx/weewx/xtypes.py", line 1040, in get_series
        ****      return ArchiveTable.get_series(obs_type, timespan, db_manager, aggregate_type,
        ****             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        ****    File "/usr/share/weewx/weewx/xtypes.py", line 210, in get_series
        ****      agg_vt = get_aggregate(obs_type, stamp, do_aggregate, db_manager,
        ****               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        ****    File "/usr/share/weewx/weewx/xtypes.py", line 136, in get_aggregate
        ****      return xtype.get_aggregate(obs_type, timespan, aggregate_type, db_manager,
        ****             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        ****    File "/usr/share/weewx/weewx/xtypes.py", line 1168, in get_aggregate
        ****      xsum += mag * math.cos(math.radians(90.0 - direction))
        ****                                          ~~~~~^~~~~~~~~~~
        ****  TypeError: unsupported operand type(s) for -: 'float' and 'str'
        ****
        ****  During handling of the above exception, another exception occurred:
        ****
        ****  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

Auchtermuchty Weather

unread,
Dec 23, 2024, 6:55:45 PM12/23/24
to weewx-user
Sorry truncated the error report. I used cut to remove the stuff at the start of each line and put the output into a file, then used 'set number' in my text editor to make sure I pasted all the lines.,

      1 Caught unrecoverable exception in generator 'weewx.imagegenerator.ImageGenerator'
      2         ****  unsupported operand type(s) for -: 'float' and 'str'
      3         ****  Traceback (most recent call last):
      4         ****    File "/usr/share/weewx/weewx/xtypes.py", line 109, in get_series
      5         ****      return xtype.get_series(obs_type, timespan, db_manager, aggregate_type,
      6         ****             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      7         ****    File "/usr/share/weewx/weewx/xtypes.py", line 1040, in get_series
      8         ****      return ArchiveTable.get_series(obs_type, timespan, db_manager, aggregate_type,
      9         ****             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     10         ****    File "/usr/share/weewx/weewx/xtypes.py", line 210, in get_series
     11         ****      agg_vt = get_aggregate(obs_type, stamp, do_aggregate, db_manager,
     12         ****               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     13         ****    File "/usr/share/weewx/weewx/xtypes.py", line 136, in get_aggregate
     14         ****      return xtype.get_aggregate(obs_type, timespan, aggregate_type, db_manager,
     15         ****             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     16         ****    File "/usr/share/weewx/weewx/xtypes.py", line 1168, in get_aggregate
     17         ****      xsum += mag * math.cos(math.radians(90.0 - direction))
     18         ****                                          ~~~~~^~~~~~~~~~~
     19         ****  TypeError: unsupported operand type(s) for -: 'float' and 'str'
     20         ****
     21         ****  During handling of the above exception, another exception occurred:
     22         ****
     23         ****  Traceback (most recent call last):
     24         ****    File "/usr/share/weewx/weewx/reportengine.py", line 248, in run
     25         ****      obj.start()
     26         ****    File "/usr/share/weewx/weewx/reportengine.py", line 465, in start
     27         ****      self.run()
     28         ****    File "/usr/share/weewx/weewx/imagegenerator.py", line 37, in run
     29         ****      self.gen_images(self.gen_ts)
     30         ****    File "/usr/share/weewx/weewx/imagegenerator.py", line 100, in gen_images
     31         ****      plot = self.gen_plot(plotgen_ts,
     32         ****             ^^^^^^^^^^^^^^^^^^^^^^^^^
     33         ****    File "/usr/share/weewx/weewx/imagegenerator.py", line 236, in gen_plot
     34         ****      start_vec_t, stop_vec_t, data_vec_t = weewx.xtypes.get_series(
     35         ****                                            ^^^^^^^^^^^^^^^^^^^^^^^^
     36         ****    File "/usr/share/weewx/weewx/xtypes.py", line 114, in get_series
     37         ****      return xtype.get_series(obs_type, timespan, db_manager, aggregate_type,
     38         ****             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     39         ****    File "/usr/share/weewx/weewx/xtypes.py", line 1040, in get_series
     40         ****      return ArchiveTable.get_series(obs_type, timespan, db_manager, aggregate_type,
     41         ****             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     42         ****    File "/usr/share/weewx/weewx/xtypes.py", line 210, in get_series
     43         ****      agg_vt = get_aggregate(obs_type, stamp, do_aggregate, db_manager,
     44         ****               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     45         ****    File "/usr/share/weewx/weewx/xtypes.py", line 136, in get_aggregate
     46         ****      return xtype.get_aggregate(obs_type, timespan, aggregate_type, db_manager,
     47         ****             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     48         ****    File "/usr/share/weewx/weewx/xtypes.py", line 1168, in get_aggregate
     49         ****      xsum += mag * math.cos(math.radians(90.0 - direction))
     50         ****                                          ~~~~~^~~~~~~~~~~
     51         ****  TypeError: unsupported operand type(s) for -: 'float' and 'str'
     52         ****  Generator terminated
     53 rand type(s) for -: 'float' and 'str'
     54 rand type(s) for -: 'float' and 'str'


Tom Keffer

unread,
Dec 23, 2024, 10:49:54 PM12/23/24
to weewx...@googlegroups.com
I would guess that one of the fields in your database that you think holds a number, actually holds a string. It could be a string for value zero ('0'), instead of the actual value zero (0).

The error occurred on a line that is doing queries in the main archive table (not the daily summaries) using columns 'windDir' or 'windGustDir'. 

One more thing: what kind of database? Sqlite?



--
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 visit https://groups.google.com/d/msgid/weewx-user/e8d2f679-c9e7-46a2-9588-652cf0852a90n%40googlegroups.com.

Auchtermuchty Weather

unread,
Dec 24, 2024, 7:53:58 AM12/24/24
to weewx-user
SQLite. I was wondering that, but as "0" <> 0, selecting windGust, count(*) should bring back separate rows for each.

Auchtermuchty Weather

unread,
Dec 24, 2024, 8:31:09 AM12/24/24
to weewx-user
OK ran some SQL and captured the output:

WindDir.csv:|null|9
WindDir.csv:|text|428413
WindGust.csv:|text|2021
WindGustDir.csv:|null|6
WindGustDir.csv:|text|371698


However when I looked at the timestamps for the few rows with NULL,  they were all in December this year, and from well after the problem started.

I've had a look at the data - no over or under values in my view:

sqlite> select min(windGustDir), max(windGustDir) from archive  where windGustDir <> "" ;      
0.0|359.0
sqlite> select min(windDir), max(windDir) from archive  where windDir <> "" ;
0.0|360.0


So nothing strange there either.

Tom Keffer

unread,
Dec 24, 2024, 2:04:16 PM12/24/24
to weewx...@googlegroups.com
I've included a version of xtypes.py that will tell us the value of "direction" when an exception occurs. Could you substitute it for your copy?



xtypes.py

Auchtermuchty Weather

unread,
Dec 24, 2024, 4:13:47 PM12/24/24
to weewx-user
I've done that, and at the same time more errors have popped up!
errors1.txt

Tom Keffer

unread,
Dec 24, 2024, 7:37:40 PM12/24/24
to weewx...@googlegroups.com
Those are new errors, but there is a clue in one of them:

ValueError: could not convert string to float: ''

This implies that one of the values is a null string. Test for them:

sqlite3 /var/lib/weewx/weewx.sdb
sqlite> select dateTime, windDir, windGustDir from archive where windDir='' or windGustDir='';

This will show you any null strings for types windDir and windGustDir. There may also be null strings for other types.

Set them to a real null as follows:

sqlite> update archive set windDir=null where windDir='';
sqlite> update archive set windGustDir=null where windGustDir='';

Then drop and rebuild the daily summaries.





Auchtermuchty Weather

unread,
Dec 25, 2024, 1:28:57 PM12/25/24
to weewx-user
I fixed those which reduced the number of errors. With a mix of guesswork and turning on debugging, I found the other values which needed fixing. They included lightning_distance and lightning_strike_count.

No errors now, thankfully! 

BTW it would be good to be able to drop and rebuild the summary for just one of the values in archive, on the grounds that I know what columns I've updated and there is only a need to rebuild the summary / summaries for those columns. But again, maybe this is a rather rare use-case.
Reply all
Reply to author
Forward
0 new messages