I'm sorry this will be a long reply. Your db is very odd and has a lot of very unusual content.
To illustrate, this command looks at anything after 2019-03-01 as an example and reports the archive period interval and human-friendly yyyy-mm-dd date to show you what I'm seeing.
echo "select interval,datetime(dateTime,'unixepoch','localtime') from archive where interval!=5 and datetime(dateTime,'unixepoch','localtime')>'2019-03-01;" | sqlite3 weewx_20251103_1915.sdb | awk '{print $1}' | uniq
As an example - 2016-07-24 has 38 different archive intervals (wow) ranging from 2 to 60. That's so odd I don't know what to suggest there.
So you have a few choices in this very unusual case:
- 1. delete all data before the dateTime when the db intervals looked odd, meaning any data from 2016-03-01 to 2019-0315 would be deleted
- 2. or keep it all and just fix up rain and rainRate for anyplace there's stuff in there that you think needs fixing up
- 3. or totally null out rain and/or rainRate for all records from 2016-03-01 to 2019-0315 when the intervals were odd
- 4. or just clean up rainRate and see if that's good enough for you
Given how wildly unusual your db is, I really can't suggest which option above to do. Sorry.
That said - assuming you want to do option-2 above and keep all your data and fix up only the overly high rain or rainRate data, here's how you can do it...
# 1. Save a list of dates have high rainRate(s) or high rain for an archive period - you'll need this later
echo "select datetime(dateTime,'unixepoch','localtime') from archive where rainRate>10;" | sqlite3 weewx_20251103_1915.sdb | awk '{print $1}' | sort |uniq
echo "select datetime(dateTime,'unixepoch','localtime') from archive where rain>1;" | sqlite3 weewx_20251103_1915.sdb | awk '{print $1}' | sort |uniq
Note - I picked 10" for rainRate as you asked, and 1" for rain because it seemed more reasonable based on what is in your db. You might even lower the rainRate threshold to a lower number.
# 2. To clear the archive up you basically change "select something from archive where...." to "update archive set something=....." in your command
update archive set rain=NULL where rain>1
update archive set rainRate=NULL where rainRate>10
Unfortunately I didn't have luck updating both at once, but running two commands is very quick so I didn't dig in google for more sqlite3 magic syntax to 'or' (not 'and') the two things together.
# 3. then to fix up the archive_day_rain and archive_day_rainRate summary tables you would rebuild-daily for just the dates you saved above...
weectl database rebuild-daily
[[--date=YYYY-mm-dd] | [--from=YYYY-mm-dd] [--to=YYYY-mm-dd]]
[--config=FILENAME] [--binding=BINDING-NAME]
[--dry-run] [-y]
Given the odd intervals for many of the affected dates, I personally would manually rebuild-daily for each of the dates with data you need to clean up. I come up with the following list of days with rainRate > 10 "or" rain > 1 for whatever archive period you had set then. Given the odd and very varying archive periods, you might want to look day-by-day at each date before 2019-03-16 and consider if the totals there are ok for you. I really don't know what rebuild-daily is going to do with such a varying interval even within one calendar day.
(dates with odd intervals)
2016-07-24
2016-08-12
2016-08-28
2017-09-15
2017-09-18
2017-09-22
2017-09-23
2017-09-26
2017-09-27
2018-03-17
(dates with reasonable consistent intervals)
2019-10-11
2020-02-17
2020-05-17
2020-07-11
2021-06-24
2021-08-30
2022-02-22
2022-07-08
2023-08-10