Solution to bypass wee_database utility prompt

66 views
Skip to first unread message

Christophe CAVALLIÉ

unread,
May 8, 2019, 5:10:22 AM5/8/19
to weewx-user
Hello,
I use Weewx for my station WS2300 in France I have to correcting lot of measure errors.
I want to automatize this with crontab command but I can't with the prompt "Proceed (y/n)".
Have you a solution to bypass this prompt?
Thanks for your response
Christophe Cavallié

Andrew Milner

unread,
May 8, 2019, 5:43:48 AM5/8/19
to weewx-user
what kind of errors are you correcting with the utility??  If you are using checkstrings/fixstrings this should not need to be run on a regular basis via cron since it is really finding and correcting errors introduced by a database editor.

If you have a database editor that introduces null strings rather than null values when deleting values then I would suggest either changing the editor to solve the problem completely or just getting into the habit or running wee_database to check for null strings after running the editor.

Christophe CAVALLIÉ

unread,
May 8, 2019, 5:53:21 AM5/8/19
to weewx-user
I make the corrections myself via a mysql command executed by bash shell script and I must therefore perform a frequent recalculation of the daily data because I have up to 30 errors on the wind speed and wind gust data per day.

Andrew Milner

unread,
May 8, 2019, 7:18:24 AM5/8/19
to weewx-user
30 errors per day seems to be excessive.  Do you have something causing the errors?  What kind of errors are you correcting? Recalculating the daily data from the archive data is, I would have thought, likely to create more 'errors', and possibly lose max gust data which may have been in a loop packet for example.  How do you know the recorded data is wrong, and how do you know what the correct value should be??  All seems to not make much sense on the face of it.  Maybe your best option is to create your own special version of wee_database which does not issue the prompt request so that you can run it via cron (although running wee_database via cron seems a wrong thing to have to do anyway!)  Surely though you only need to do the recalculation after editing the data - so why not just include the call to wee_database within the script you invoke when you decide to edit the data.  I assume the actual edit is a manual process.  Maybe understanding what your problem is caused by would shed some light on how to correct it - at the moment I feel somewhat lost.

Christophe CAVALLIÉ

unread,
May 8, 2019, 8:54:01 AM5/8/19
to weewx-user
Here is the query I execute to correct the errors:
update weewx.archive set windGust='0' where windGust 
 in ('183.600456336138','183.960914462966','137.880685399835','91.9804572314828','91.8004563367049');

The values in question are very frequent and are systematically for a winDir=315

Andrew Milner

unread,
May 8, 2019, 9:41:02 AM5/8/19
to weewx-user
If it were me I would be trying to tackle where these strange windGust values come from when the windDir is 315!  Is it the console outputting incorrect data or is it the weewx driver corrupting the data as it reads it?  

Leon Shaner

unread,
May 8, 2019, 10:26:40 AM5/8/19
to weewx...@googlegroups.com
Hey, Christophe,

Sounds like you have been clever enough to write some code to find and correct those values.  Seems like you should be able to take the same logic and adapt it for use as python expressions and use the weewx built-in calibration features.

I wrote a post a while back, which may give you some ideas:


The first post there shows how I used python to test the eval statements, which I later put right into weewx.conf.  I did find out that you can't re-use the same weewx variable twice, which is owing to a weewx/python implementation detail in how weewx stores the calibration statements.  But there is a workaround mentioned in the second post.

Never mind that I ended up abandoning the idea.  What I show there is a sound approach to using a standalone python script to get the expressions working correctly, and then you copy/paste the exact same expressions into weewx.conf calibration section.

Meanwhile, if all else fails, have you tried piping "y" in your script?

    $ echo y | whatever_comand_has_a_yn_prompt ...

There is also the "yes" command which just endlessly echo's y's forever:

    $ yes | whatever_comand_has_a_yn_prompt ...

Regards,
\Leon
--
Leon Shaner :: Dearborn, Michigan (iPad Pro)
--
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/d7f93914-f767-4e91-a9e2-d12c3e57457b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christophe CAVALLIÉ

unread,
May 8, 2019, 2:34:41 PM5/8/19
to weewx-user
Thanks "echo y | ...' works fine
Christophe Cavallié
Reply all
Reply to author
Forward
0 new messages