--rebuild-daily : ValueError: Non-positive value for record field 'interval': 0

39 views
Skip to first unread message

Cyril D

unread,
Sep 30, 2019, 11:58:21 AM9/30/19
to weewx-user
Hello,

Following a bug on my system that sends incorrect values to weewx, I had to delete records from the archive database.
Then I run:
wee_database weewx.conf --drop-daily

Followed by
wee_database weewx.conf --rebuild-daily

With this latest command I get this error:
./bin/wee_database weewx.conf --rebuild-daily
Using configuration file weewx.conf
Using database binding 'wx_binding', which is bound to database 'archive_mysql'
All daily summaries will be rebuilt.
Proceed (y/n)? y
Rebuilding daily summaries in database 'weewx' ...
Traceback (most recent call last):e: 2017-04-11 14:41:06 CEST (1491914466)
File "./bin/wee_database", line 794, in <module>
main()
File "./bin/wee_database", line 153, in main
rebuildDaily(config_dict, db_binding, options)
File "./bin/wee_database", line 263, in rebuildDaily
trans_days=20)
File "/home/pi/cleusb/weewx/bin/weewx/manager.py", line 1469, in backfill_day_summary
weight = self._calc_weight(rec)
File "/home/pi/cleusb/weewx/bin/weewx/manager.py", line 1582, in _calc_weight
raise ValueError("Non-positive value for record field 'interval': %s" % (record['interval'], ))
ValueError: Non-positive value for record field 'interval': 0

What should I do?

Thomas Keffer

unread,
Sep 30, 2019, 1:03:05 PM9/30/19
to weewx-user
Using the tool sqlite3 (you may have to install), see how many zero interval values are in your database:

Adjust path as necessary, but this path should be close:

$ sqlite3 /home/pi/cleusb/weewx/archive/weewx.sdb
sqlite> select dateTime, datetime(dateTime,'unixepoch','localtime'), interval from archive where interval<=0;

If there is only one or two of them, I'd just delete them, then try rebuilding the daily summaries again:

sqlite> delete from archive where interval<=0;

-tk

-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/1edda18d-b9df-4ee5-9175-f43a61ef4a1b%40googlegroups.com.

Cyril D

unread,
Sep 30, 2019, 1:19:40 PM9/30/19
to weewx-user
Thanks, the database is in MySQL, so it's easier to manage.
I have many lines with interval = 0 (none < 0)

Thomas Keffer

unread,
Sep 30, 2019, 1:23:43 PM9/30/19
to weewx-user
I don't know what "many lines" means, but you're going to have to make a judgment call. You can either

1. Delete them all; or
2. Set the values to the nominal archive interval that the rest of the database uses.

I think either approach is safe and unlikely to give you much trouble. Unless, of course, we're talking about a big fraction of the database!

-tk



On Mon, Sep 30, 2019 at 10:19 AM Cyril D <pour....@gmail.com> wrote:
Thanks, the database is in MySQL, so it's easier to manage.
I have many lines with interval = 0 (none < 0)

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

Cyril D

unread,
Sep 30, 2019, 2:10:09 PM9/30/19
to weewx-user
Deleted 24295 out of 354786 records.
--rebuild-daily went without error.

Thank you!

Thomas Keffer

unread,
Sep 30, 2019, 2:34:09 PM9/30/19
to weewx-user
So, that's about 7% of the records. You'll probably be OK.

-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.
Reply all
Reply to author
Forward
0 new messages