Any option to force wee_import to overwrite database fields?

84 views
Skip to first unread message

Mehdi Attaran

unread,
May 25, 2023, 1:50:13 AM5/25/23
to weewx-user
I'm running weewx on an Intel NUC running Debian Bullseye.

I have two weather stations... a Weatherflow Tempest which has been running for a couple of years without any issues (aside from the calculated rain values) and a Davis Vantage Pro2.  The tempest is providing data to WU.

There were some issues with my Davis Vantage Pro2 which has caused it to record random inaccurate temperature data from 2023-04-26 through 2023-05-22. (The values are within the min/max range, so can't easily be filtered out, unfortunately.)

I would like to import the WU data from my Tempest station using the wee_import utility and overwrite all the temp data for that specific date range. However, wee_import is not changing any of the data since the database already contains data for those dates.

Are there any undocumented option to force wee_import to overwrite the database fields? 

Maybe I could use sqlite3 and set the outTemp value to NULL for those days? Would that allow wee_import to work?

Are there other/better options to achieve this without losing the other data I have collected for the past several years?

Thanks.

gjr80

unread,
May 30, 2023, 6:01:32 AM5/30/23
to weewx-user
Currently wee_import does not support overwriting/updating archive records that already exist in the archive. If effect, the test for whether an archive record exists is whether there is a valid archive record timestamp, so no nulling/deleting field data will alter that behaviour. Nor are there any undocumented options that allow/enable it. That being said there is a current PR on GitHub to add an archive update ability, but it will require some changes to the PR and further testing and I do not expect to have that complete for another couple of months.

It's somewhat complex but one option you could try is to(untested):

1. export the existing archive data for the period concerned in CSV format
2. delete the data in the offending columns in the CSV file resulting from step 1
3. download WU data for the corresponding period in CSV format
4. copy the WU sourced data for the offending columns to the CSV file resulting from step 2
5. delete all archive records for the period concerned
6. run wee_import to import the hybrid CSV file resulting from step 4

Any half way decent spreadsheet should allow fairly easy column based manipulation of CSV data required at steps 2 and 4.

One thing to watch out for is the timestamps on the WU data; they need to match the archive record timestamps. Given the past generally dismal performance of WU there is no guarantee they will match or even if they will all exist.

Of course always, always make a backup copy of your database before attempting any changes.
 
Gary
Reply all
Reply to author
Forward
0 new messages