You might want to consult the wiki.  That's why hundreds of hours have been 
spent creating it.

https://github.com/weewx/weewx/wiki/Cleaning-up-old-'bad'-data

On Tuesday, May 7, 2024 at 9:19:04 AM UTC-7 Kevin Crivelli wrote:

> or perhaps there is a way to rebuild the raintotals fields from the 
> current rainrate data
>
> On Tuesday, May 7, 2024 at 12:17:20 PM UTC-4 Kevin Crivelli wrote:
>
>> I removed bad rainrate data but it did not effect the raintotals field. I 
>> was able to determine the epoch date-time for the bad rainrate data. Having 
>> those I was going to delete the rain_total values for those entries but how 
>> would I have that then reflect in the following rain_total fields?
>>
>> chatgpt gave me this which I feel is a start but I'm not quite there yet. 
>> anyone able to help me with this?
>>
>> -- Store the rain total of the specific datetime in a variable
>> SET @deleted_rain_total = (SELECT rain_total FROM your_table WHERE 
>> datetime = specific_datetime);
>>
>> -- Delete the rain total at the specific datetime
>> DELETE FROM your_table WHERE datetime = specific_datetime;
>>
>> -- Decrease the rain totals for the following datetimes
>> UPDATE your_table
>> SET rain_total = rain_total - @deleted_rain_total
>> WHERE datetime > specific_datetime;
>>
>> These are the date and times of the entries that need their raintotal 
>> nulled and then the proceeding raintotals to reflect the change
>>
>>     1699559700: 2024-05-10 01:55:00
>>     1699560000: 2024-05-10 01:56:40
>>     1709221800: 2024-05-26 06:50:00
>>     1709222100: 2024-05-26 06:55:00
>>     1713436800: 2024-06-16 10:00:00
>>     1713437100: 2024-06-16 10:05:00
>>     1713780900: 2024-06-20 03:35:00
>>     1713781200: 2024-06-20 03:40:00
>>     1714771200: 2024-06-25 18:40:00
>>     1714771500: 2024-06-25 18:45:00
>>     1699559400: 2024-05-10 01:50:00
>>     1699560300: 2024-05-10 01:51:40
>>     1709221500: 2024-05-26 06:45:00
>>     1713437400: 2024-06-16 10:10:00
>>     1713781500: 2024-06-20 03:05:00
>>     1714771800: 2024-06-25 18:10:00
>>
>>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/b687da34-99af-42a8-a84b-490f6c902d91n%40googlegroups.com.

Reply via email to