adding mm to daily rainfall

264 views
Skip to first unread message

Δημήτρης Βήχος

unread,
Jun 17, 2023, 4:42:54 AM6/17/23
to weewx-user
i want like to add some mm to my daily rainfall beacuse after power loss , my console (fine offset)  have 10mm above the weewx after the power on again.
i had loss 10mm in my daily rain.

thank you!

Stefanos Kalaitzis

unread,
Jun 17, 2023, 5:11:40 AM6/17/23
to weewx...@googlegroups.com
First find the range of time(epoch)  that you want to add the rain 
Enter to weeex.sdb

sudo sqlite3 /home/weewx/archive/weewx.sdb

Then check what values your station recorded

 select datetime, datetime(dateTime, 'unixepoch','localtime'), rain from archive where dateTime > 1686881600 and dateTime <= 1686981600;

Then correct the time you want 
For example 

update archive set rain=1.0 where dateTime = 1686975900;

Then exit the db

.quit

Stop weewx 

After all corrections rebuild the data base for that day


sudo /home/weewx/bin/wee_database --rebuild-daily --from=2023-06-17 --to=2023-06-17

Start weewx
 
Thats what i am doing when i have to add some missing mm in my db 



--
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/e96ce7e9-1085-46f6-adf4-b82275bf4df4n%40googlegroups.com.

Δημήτρης Βήχος

unread,
Jun 20, 2023, 2:04:56 AM6/20/23
to weewx-user
here is me commands in terminal . trying to plus 12.1 missing mm  in 17 july  total rainfall

metfm@metfm:~$ sudo sqlite3 /var/weewx/weewx.sdb
[sudo] password for metfm:
SQLite version 3.34.1 2021-01-20 14:10:07
Enter ".help" for usage hints.
sqlite> select datetime, datetime(dateTime, 'unixepoch','localtime'), rain from archive where dateTime > 1686881600 and dateTime <= 1686981600
   ...> update archive set rain=12.6 where dateTime = 1686975900
   ...> .quit
   ...>
metfm@metfm:~$ sudo wee_database --rebuild-daily --from=2023-06-17 --to=2023-06-17
[sudo] password for metfm:
Using configuration file /etc/weewx/weewx.conf
Using database binding 'wx_binding', which is bound to database 'archive_sqlite'
Daily summary for 2023-06-17 will be rebuilt.
Proceed (y/n)? y
Rebuilding daily summaries in database 'weewx.sdb' ...
Processed 276 records to rebuild 1 daily summary in 0.12 seconds
Rebuild of daily summaries in database 'weewx.sdb' complete
metfm@metfm:~$ sudo /etc/init.d/weewx start
Starting weewx (via systemctl): weewx.service.
metfm@metfm:~$

something missing? something im doing wrong? the exetra mm never shows in weewx restarting and updating.

Rainer Lang

unread,
Jun 20, 2023, 3:21:47 AM6/20/23
to weewx...@googlegroups.com
at first glance looks ok to me -
but what I would do is:
download and install sqlitebrowser  (suso apt-get install sqlitebrowser)
start it in update mode
sudo sqlitebrowser /var/weewx/weewx.sdb
and then go to your time stamp and add the values manually in the database
(don't forget to move the cursor to another field once you have filled in your new data before pressing the write changes button in the menu: File --> write changes)
also, check your database entries for rain, they may be in inches, so the 12.6 mm need to be divided by 25.4 before entering into the database field)
afterwards run wee_database (between the archiving times !)
sudo wee_database --rebuild-daily --date=2023-06-17
after the next archiving cycle the rain data should show (in the weekly and monthly view)
you may have to delete the weekly and monthly pictures from your reporting folder as weewx creates new entries only every half-day or daily for the longer periods beyond daily.

Maybe your update worked but only the weekly/monthly pictures and high/low data were not updated in the report yet

a restart of weewx should not be needed

michael.k...@gmx.at

unread,
Jun 20, 2023, 4:20:17 AM6/20/23
to weewx-user
My guess: You are missing a "COMMIT;" statement.

gjr80

unread,
Jun 20, 2023, 7:10:28 AM6/20/23
to weewx-user
At a guess I would say your sqlite3 commands were never executed due to missing semi-colons at the end of each sqlite3 command line. Your commands are basically fine, but you need to be careful with the datetime/dateTime case in the commands. No need for commits as your are not processing multiple commands as a transaction. When editing the database you do need to be mindful of your database units and make sure you use the same units in your update queries. If using sqlite command line the easiest thing to do is to look at the usUnits field. 1=US customary=inches, 16=Metric=cm, 17=MetricWX=mm. Whether you use sqlite3 or a gui tool like sqlitebrowser does not really matter, just check that your data was changed after you make the change and if using a gui be very careful to not leave any fields with null strings(though this is usually associate with deleting data rather than updating it). FWIW if using sqlite3 I would use this sequence of commands:

$ sqlite3 /home/weewx/archive/weewx.sdb
sqlite> SELECT dateTime, datetime(dateTime, 'unixepoch','localtime'), usUnits, rain FROM archive WHERE dateTime > 1686881600 AND dateTime <= 1686981600;
sqlite> UPDATE archive SET rain=12.6 WHERE dateTime = 1686975900;
sqlite> SELECT dateTime, datetime(dateTime, 'unixepoch','localtime'), usUnits, rain FROM archive WHERE dateTime=1686975900;
sqlite> .q
$ sudo wee_database --rebuild-daily --date=2023-06-17

In terms of the Seasons skin your updated data may causes changes to rain plots (all except the 'today' plot), the June 2023 and 2023 NOAA format reports and the statistics widget/page. All should come good in time (max 24 hours) provided you update your data sometime this month, but if you want to speed things up delete all your rain plots on your WeeWX machine. If you update your data in say July you will need to delete the June 2023 and 2023 NOAA format reports and all subsequent NOAA format reports to force regeneration.

Can't speak for any other skins.

Gary

Δημήτρης Βήχος

unread,
Jun 21, 2023, 12:48:19 AM6/21/23
to weewx-user
the commands with semi-colons. send me (with sudo also and with suo su )

metfm@metfm:~$ sudo sqlite3 /var/weewx/weewx.sdb
SQLite version 3.34.1 2021-01-20 14:10:07
Enter ".help" for usage hints.
sqlite> SELECT dateTime, datetime(dateTime, 'unixepoch','localtime'), usUnits, rain FROM archive WHERE dateTime > 1686881600 AND dateTime <= 1686981600;
Error: unable to open database "/var/weewx/weewx.sdb": unable to open database file
metfm@metfm:~$

without semi-colons database open

metfm@metfm:~$ sudo sqlite3 /var/weewx/weewx.sdb
[sudo] password for metfm:
SQLite version 3.34.1 2021-01-20 14:10:07
Enter ".help" for usage hints.
sqlite> select datetime, datetime(dateTime, 'unixepoch','localtime'), rain from archive where dateTime > 1686881600 and dateTime <= 1686981600
   ...> update archive set rain=12.6 where dateTime = 1686975900
   ...> .quit
   ...>
metfm@metfm:~$ sudo wee_database --rebuild-daily --from=2023-06-17 --to=2023-06-17
[sudo] password for metfm:
Using configuration file /etc/weewx/weewx.conf
Using database binding 'wx_binding', which is bound to database 'archive_sqlite'
Daily summary for 2023-06-17 will be rebuilt.
Proceed (y/n)? y
Rebuilding daily summaries in database 'weewx.sdb' ...
Processed 276 records to rebuild 1 daily summary in 0.12 seconds
Rebuild of daily summaries in database 'weewx.sdb' complete
metfm@metfm:~$ sudo /etc/init.d/weewx start
Starting weewx (via systemctl): weewx.service.
metfm@metfm:~$
  but after restarting weewx no change in database. no 12.6 plus mm who i needs

gjr80

unread,
Jun 21, 2023, 2:55:34 AM6/21/23
to weewx-user
Have you customised your WeeWX install? You appear to be using a package install so unless you have changed it your WeeWX database should be in /var/lib/weewx not /var/weewx.

Gary

Δημήτρης Βήχος

unread,
Jun 21, 2023, 4:03:40 AM6/21/23
to weewx-user
debian installed. also triyng with sudo sqlite3 /var/lib/weewx/weewx.sdb same thing.

Stefanos Kalaitzis

unread,
Jun 21, 2023, 4:28:58 AM6/21/23
to weewx...@googlegroups.com
It should be /var/lib/weewx/archive/weewx.sdb

Can you give us a screenshot where the weewx.sdb is??

gjr80

unread,
Jun 21, 2023, 4:49:35 AM6/21/23
to weewx-user
No. The default Debian based distro database is /var/lib/weewx/weewx.sdb. The archive directory is only used (by default) for setup.py installs.

OP. Have you confirmed the location (and name) of your WeeWX database? What does the following command show:

$ ls -ail /var/lib/weewx

Gary

Δημήτρης Βήχος

unread,
Jun 21, 2023, 7:24:55 AM6/21/23
to weewx-user
my database is on /var/lib/weewx/weewx.sdb

metfm@metfm:~$ ls -ail /var/lib/weewx
σύνολο 18692
264962 drwxr-xr-x 1 root root       18 Ιουν 21 14:20 .
   269 drwxr-xr-x 1 root root      592 Φεβ  26 18:30 ..
270727 -rwxrwxrwx 1 root root 19140608 Ιουν 21 14:20 weewx.sdb
metfm@metfm:~$

Rainer Lang

unread,
Jun 21, 2023, 9:17:58 AM6/21/23
to weewx...@googlegroups.com
At the end of the day it doesn't matter where the weewx.sdb is located - as long as weewx and wee_database via weewx.conf and sqlite3 via the path in the command know/are told
where it is located.

You can still check with sqlitebrowser what your entry in your database for the respective EPOCH timestamp is (see my earlier mail) - and you can change it manually
(provided you start it with sudo sqlitebrowser /var/lib/weewx/weewx.sdb [in your case]).
That's the pragmatic approach.

Of course you can still try to figure out why your SQL command doesn't seem to have been successful.

Δημήτρης Βήχος

unread,
Jun 21, 2023, 3:45:48 PM6/21/23
to weewx-user
finaly i did it with sqlitebrowser easily! thank you!
is there way my data base appears values to mm and C for temp, instead to inches and F ?

Rainer Lang

unread,
Jun 21, 2023, 3:51:04 PM6/21/23
to weewx...@googlegroups.com

afaik only if from the very beginning you choose this unit system - once started you cannot change this anymore
(or at least not easily - in principle you could make a migration, but in my estimate this would require quite some effort)

Tom Keffer

unread,
Jun 22, 2023, 3:15:13 PM6/22/23
to weewx...@googlegroups.com

Δημήτρης Βήχος

unread,
Jun 23, 2023, 2:03:33 AM6/23/23
to weewx-user
changed from US  default to METRIXCW weewx dont startup

Rainer Lang

unread,
Jun 23, 2023, 2:22:44 AM6/23/23
to weewx...@googlegroups.com
what exactly did you do ?
migrated the (data from the) old database into a new database with METRICWX as described in Tom's link in the customization guide ?
(by the way, the unit system nam is METRICWX and NOT METRIXCW - could this be the reason for weewx not coming up ?)

Can you please set DEBUG=3 in weewx.conf, restart weewx and provide the syslog data here ....
Some information will be there ...

Δημήτρης Βήχος

unread,
Jun 23, 2023, 2:37:54 AM6/23/23
to weewx-user
changed in weewx.conf from US to METRICWX. weewx never starts. i ll trying one more time.

michael.k...@gmx.at

unread,
Jun 23, 2023, 2:45:27 AM6/23/23
to weewx-user

Rainer Lang

unread,
Jun 23, 2023, 4:23:12 AM6/23/23
to weewx...@googlegroups.com
only changing the weewx.conf entry in [StdConvert] will not suffice, will not work !
You have to do the whole database migration !!
As described in Tom Keffer's reply to the topic (details in the link in Tom'S mail)
Reply all
Reply to author
Forward
0 new messages