updating missing data fields in the weewx database - can I use wee_import ?

55 views
Skip to first unread message

Rainer Lang

unread,
Dec 23, 2020, 4:32:43 PM12/23/20
to weewx...@googlegroups.com

Hi,

I'm about to close gaps in my data history (due to system downtime and also historical data from my pre-weewx times).
Adding missing records is nicely described and looks rather simple and straightforward.

However, I don't know how to handle the update of already existing records.
E.g. due to missing information my radiation data in the DB are missing while all other sensor data are already stored.

Can I use wee_import the same way I do for importing new records ?

If so, what data do I have to provide ? Only the content of the to-be-updated fields or the whole record (i.e. values for all fields).

Or, does it not work with wee_import and I have to do it differently ?
If so, how ?

--------------

Another question indirectly related to the import of history data.

How do I display earlier years (in day, week, month, year aggregation like in the current year ?) beyond the scarce reports to be chosen in the "upper right corner" ?

Will I have to create a sort of history skin where I can select date, week, month, year and based on this selection the picture generator will provide the graphics ?
Or does some such"piece" already exist (fully, partially, ...) ?

Please advise.

Thanks
Rainer

gjr80

unread,
Dec 26, 2020, 6:38:00 PM12/26/20
to weewx-user
It's not really practical to use wee_import in the manner your describe. wee_import works by obtaining an archive record from the source and then inserting the archive record in the database, if a record with the same dateTime value already exists in the archive then the imported record is discarded. The only way you could use wee_import would be to export the records concerned from the WeeWX archive in their entirety, delete the records concerned from the archive, add the missing data to the exported data and then import the updated data back into WeeWX. It would work and could be automated to some extent, but there is still going to be a good bit of manually manipulation of the data.

You may find that you can do better by operating directly on the archive table with some well chosen SQL. The wee_import approach may be safest but I imagine will be the most labour intensive. The SQL approach may be quicker but also more risk of doing something bad to your, that could be mitigated by some testing on expendable data. You would also need to use wee_database to rebuild your daily summaries after using SQL to update the archive.

Key point in either case would be to backup your data first.

Gary
Reply all
Reply to author
Forward
0 new messages