> Since there are now wrong value/unit type entries in the database, how can 
> I delete it? Just delete the sdb file when weewx is stopped (will it create 
> a new one?). 
>

Depends what you want to do. If you are happy to lose all of your recorded 
data to date then you can stop weeWX, delete weewx.sdb then start weeWX. A 
new database (weewx.sdb) will be automatically created upon startup. If you 
wish to retain some of your recorded data then you will need to manipulate 
your database. There are a number of ways you can do this, there are 
graphical tools for manipulating the database or you can use a bit of SQL 
directly through the sqlite3 utility. If you want to go down this path:

1. if not already installed then install sqlite3:

$ sudo apt-get install sqlite3

2. stop weeWX
3. make a copy of weewx.sdb
4. start the sqlite3 utility using your weeWX database as the source:

$ sqlite3 /home/weewx/archive/weewx.sdb

5. find the data that you want to get rid of. This could be all data before 
a given timestamp (ie dateTime value), it could be all records where outTemp 
< 40 (eg outTemp was incorrectly converted). Whatever condition you come up 
with that defines the records you want to delete test it with a SELECT 
query before you actually delete it with a DELETE query, eg:

sqlite> SELECT * FROM archive WHERE dateTime<1496922300;

will display all records with a dateTime before 8 June 2017 11:45:00 GMT. 
Using something like 

sqlite> SELECT datetime(dateTime, 'unixepoch', 'localtime'),* FROM archive 
WHERE dateTime<1496922300;

will prepend a human readable version of the record timestamp(field dateTime) 
to the list of record displayed. If you want to query on field outTemp (or 
some other observational field) something like:

sqlite> SELECT datetime(dateTime, 'unixepoch', 'localtime'),* FROM archive 
WHERE outTemp<40;

will display all records where outTemp is less than 40. Once you are able 
to select the records you wish to delete then you can use a DELETE query to 
delete them. Say you want to delete all records before timestamp 1234567879:

sqlite> DELETE FROM archive WHERE dateTime<123456789;

to delete all records where outTemp<40:

sqlite> DELETE FROM archive WHERE outTemp<40;

6. once you have deleted the desired records exit sqlite with the .quit 
command. If you need to revert to your back because you deleted the wrong 
records, just exit sqlite3 using the .quit command, delete the erroneous 
weewx.sdb and make a copy you backup as weewx.sdb. You can then go back to 
step 4.
7. rebuild your daily summaries using the wee_database utility:

$ /home/weewx/bin/wee_database --rebuild-daily

8. start weeWX 

Manipulating the database though reasonably straightforward can be 
daunting. You do run the risk of corrupting/losing your data. So if the 
process puts you off and you have only a small amount of recorded data you 
may wish to just start with a new database.
 

> Additionally, what about files like weewx.conf.{random_number}, 
> weewx.conf.dist or weewx.conf.save which have been created over the time 
> using weewx? Are they safe to delete? Since at the beginning there was only 
> the weewx.conf (same issue goes for skin.conf).
>

weewx.conf.{random_number} files are backup copies of weewx.conf when some 
process (such as an extension installer or some other weeWX tool/utility) 
altered weewx.conf. The seeminly random number is the date-time the file 
was backed up in YYYMMDDhhmmss format. You can generally safely delete them 
once whatever it was that made the change (eg a new extension etc) has been 
shown to work properly. If problems were encountered then having the 
weewx.conf backup helps you to revert to your previous weeWX config. 
Personal choice what you do, I prefer to keep them as they take up little 
space, but then again I make a lot of changes ot my system that sometimes 
do not work out.

weewx.conf.dist will generally be as a remnant from upgrading weeWX, if the 
upgrade went smoothly and everything works as it should you can safely 
delete them. Not so sure about weewx.conf.save but believe it is 
essentially the same, a remant of an upgrade.

Can't say I have seen the same for skin.conf but then again I don't let 
weeWX upgrades touch my skins, I work through them manually since they are 
customised. I suspect they are upgrade remnants as well and provideed your 
system is operating as expected they can be safely deleted.

Gary

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to