Thanks, it worked!!! ..... it is in this moments that one appreciate to
have around backups :-)
suggestion: maybe you can the SQL for "rain update" in the wiki wit
windgust and windspeed?
In case someone out there is interested i post here the small script with
the amended line also for making a db copy before tring to fix any valu -
beware it is not well tested and can screw up your data
-------------------------------
#!/bin/sh
echo weewx db fixer
# Script to fix wrong data collected from weather sensors
#help
usage() {
echo "usage: sudo weewx-db-fixer.sh [[[-f --force ] | [-h]]"
}
#read options passed at launch time
while [ "$1" != "" ]; do
case $1 in
-f | --force)
b=1
;;
-h | --help ) usage
exit
;;
* ) usage
exit 1
esac
shift
done
#lets start stopping weewx daemon
echo
echo stop weewx daemon
/etc/init.d/weewx stop
echo creating a copy of the db in /var/lib/weewx/weewx.sdb.$(date
+"%m-%d-%y-%T")
echo
cp /var/lib/weewx/weewx.sdb /var/lib/weewx/weewx.sdb.$(date
+"%m-%d-%y-%T")
echo
echo start looking for data to fix
echo
echo looking for windGust \> 100
a=$(echo "SELECT datetime(datetime, 'unixepoch'), windGust FROM archive
WHERE (windGust > 100);" | sqlite3 /var/lib/weewx/weewx.sdb)
if test -z "$a"; then
echo nothing to do, good!
else
echo found: $a values
echo "UPDATE archive SET windGust=NULL WHERE (windGust > 100);" | sqlite3
/var/lib/weewx/weewx.sdb
b=1
fi
echo found: $a values
echo
echo looking for windspeed \> 100
a=$(echo "SELECT datetime(datetime, 'unixepoch'),windSpeed FROM archive
WHERE (windSpeed > 100);" | sqlite3 /var/lib/weewx/weewx.sdb)
if test -z "$a"; then
echo nothing to do, good!
else
echo found: $a values
echo "UPDATE archive SET windSpeed=NULL WHERE (windSpeed > 100);" | sqlite3
/var/lib/weewx/weewx.sdb
b=1
fi
echo found: $a values
echo
echo looking for rain \>5 inch per hour
a=$(echo "SELECT datetime(datetime, 'unixepoch'),rain FROM archive WHERE
(rain > 5);" | sqlite3 /var/lib/weewx/weewx.sdb)
if test -z "$a"; then
echo nothing to do, good!
else
echo found: $a values
echo "UPDATE archive SET rain=NULL WHERE (rain > 5);" | sqlite3
/var/lib/weewx/weewx.sdb
b=1
fi
echo found: $a values
echo
echo rebuild db stuff
echo $b
if test -z "$b"; then
echo nothing to do, good!
else
echo fix strings
wee_database /etc/weewx/weewx.conf --fix --string-check
echo drop daily
wee_database /etc/weewx/weewx.conf --drop-daily
echo backfill daily
wee_database /etc/weewx/weewx.conf --backfill-daily
echo regen reports
wee_reports /etc/weewx/weewx.conf
fi
echo
echo restart weewx
/etc/init.d/weewx start
-------------------------------
Il giorno venerdì 11 novembre 2016 15:11:31 UTC+1, Tom Keffer ha scritto:
>
> The plots are of *rain*, not rain rate. You have to fix the rain values.
>
> -tk
>
> On Fri, Nov 11, 2016 at 5:55 AM, Maurizio Andreotti <
> [email protected] <javascript:>> wrote:
>
>> thanks, I thought the same and deleted already several time, but it keeps
>> regenerating the same images
>>
>> the data where around 36.inches of rain and i am sure i dont have now
>> resulting more than 5......
>> unless there is something else to do in addition to:
>> echo "UPDATE archive SET rainRate=NULL WHERE (rainRate > 5);" | sqlite3
>> /var/lib/weewx/weewx.sdb
>>
>> or maybe i have done wrong anything?
>>
>>
>>
>> Il giorno venerdì 11 novembre 2016 14:50:42 UTC+1, Maurizio Andreotti ha
>> scritto:
>>
>>> here are the links to the incriminated graphs
>>> http://www.innovationengineering.it/meteo/yearrain_wrong.png
>>>
>>> http://www.innovationengineering.it/meteo/monthrain_wrong.png
>>>
>>>
>>> Il giorno venerdì 11 novembre 2016 14:04:41 UTC+1, Maurizio Andreotti ha
>>> scritto:
>>>>
>>>> Help!! :-)
>>>>
>>>> I am using weewx since 3 years now and updated quite regularly -
>>>>
>>>> I am now facing an issue about fixing a wrong rain data collected at
>>>> end of october.
>>>>
>>>> I followed the wiki and I think I moved to NULL all lines where hte
>>>> rain was reported wrongly too high.....
>>>>
>>>>
>>>> but the yearly /monthly graphs still shows the wrong peak.....
>>>>
>>>> after fixing I did
>>>> wee_database --drop-daily and
>>>> wee_database --backfill-daily and
>>>> wee_reports
>>>>
>>>> several time, looker around the wiki and web,.. but it's but the
>>>> yearly /monthly graphs still shows the wrong peak.....
>>>>
>>>>
>>>> [image: rain]
>>>> [image: rain]
>>>>
>>>>
>>>> I tried also automating the fix creating this scrippt but.... no luck
>>>>
>>>> #!/bin/sh
>>>>
>>>>
>>>> usage() {
>>>> echo "usage: sudo weewx-db-fixer.sh [[[-f --force ] | [-h]]"
>>>> }
>>>>
>>>> #read options passed at launch time
>>>> while [ "$1" != "" ]; do
>>>> case $1 in
>>>> -f | --force)
>>>> b=1
>>>> ;;
>>>> -h | --help ) usage
>>>> exit
>>>> ;;
>>>> * ) usage
>>>> exit 1
>>>> esac
>>>> shift
>>>> done
>>>>
>>>>
>>>>
>>>> echo weewx db fixer
>>>> echo stop weewx daemon
>>>> /etc/init.d/weewx stop
>>>> echo creating a copy of the db in $dest
>>>> cp /var/lib/weewx/weewx.sdb /var/lib/weewx/weewx.sdb.$(date
>>>> +"%m-%d-%y-%T")
>>>>
>>>> echo looking for data to fix
>>>> echo
>>>> echo ----------
>>>> echo looking for windGust \> 100
>>>> a=$(echo "SELECT datetime(datetime, 'unixepoch'), windGust FROM
>>>> archive WHERE (windGust > 100);" | sqlite3 /var/lib/weewx/weewx.sdb)
>>>> if test -z "$a"; then
>>>> echo nothing to do, good!
>>>> else
>>>> echo found: $a values
>>>> echo "UPDATE archive SET windGust=NULL WHERE (windGust > 100);" |
>>>> sqlite3 /var/lib/weewx/weewx.sdb
>>>> b=1
>>>> fi
>>>> echo found: $a values
>>>> echo ----------
>>>> echo looking for windspeed \> 100
>>>> a=$(echo "SELECT datetime(datetime, 'unixepoch'),windSpeed FROM
>>>> archive WHERE (windSpeed > 100);" | sqlite3 /var/lib/weewx/weewx.sdb)
>>>> if test -z "$a"; then
>>>> echo nothing to do, good!
>>>> else
>>>> echo found: $a values
>>>> echo "UPDATE archive SET windSpeed=NULL WHERE (windSpeed > 100);" |
>>>> sqlite3 /var/lib/weewx/weewx.sdb
>>>> b=1
>>>> fi
>>>> echo found: $a values
>>>> echo ----------
>>>> echo looking for rainrate \>5 inch per hour
>>>> a=$(echo "SELECT datetime(datetime, 'unixepoch'),rainRate FROM archive
>>>> WHERE (rainRate > 5);" | sqlite3 /var/lib/weewx/weewx.sdb)
>>>> if test -z "$a"; then
>>>> echo nothing to do, good!
>>>> else
>>>> echo found: $a values
>>>> echo "UPDATE archive SET rainRate=NULL WHERE (rainRate > 5);" | sqlite3
>>>> /var/lib/weewx/weewx.sdb
>>>> b=1
>>>> fi
>>>> echo found: $a values
>>>>
>>>>
>>>> echo ----------
>>>> echo looking for archive-rain_day max rain \>5 inch per hour
>>>> a=$(echo "SELECT datetime(datetime, 'unixepoch'),max FROM
>>>> archive_day_rain where max > 5;" | sqlite3 /var/lib/weewx/weewx.sdb)
>>>> if test -z "$a"; then
>>>> echo nothing to do, good!
>>>> else
>>>> echo found: $a values
>>>> sudo echo "UPDATE archive_day_rain SET max=NULL WHERE (max > 5);" |
>>>> sqlite3 /var/lib/weewx/weewx.sdb
>>>> b=1
>>>> fi
>>>> echo found: $a values
>>>> echo rebuild db stuff ----------
>>>> echo $b
>>>> if test -z "$b"; then
>>>> echo nothing to do, good!
>>>> else
>>>> echo rebuild db
>>>> wee_database /etc/weewx/weewx.conf --fix --string-check
>>>> wee_database /etc/weewx/weewx.conf --drop-daily
>>>> wee_database /etc/weewx/weewx.conf --backfill-daily
>>>> wee_reports /etc/weewx/weewx.conf
>>>> fi
>>>>
>>>>
>>>> echo ----------
>>>> echo restart weewx
>>>> /etc/init.d/weewx start
>>>>
>>>>
>>>>
>>> --
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
--
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.