Not sure how I missed that in the Customisation Guide! Thanks for 
clarifying though. I’ll update the interval in the archive table and then 
drop/rebuild the daily summaries

On Wednesday 4 September 2024 at 16:44:40 UTC+1 Tom Keffer wrote:

> Your suspicion is correct. The unit for `interval` is minutes. I know it's 
> not consistent with the rest of WeeWX, but we inherited it from the wview 
> schema. 
>
> See the section *The database 
> <https://www.weewx.com/docs/5.1/custom/introduction/#the-database>* in 
> the Customization Guide.
>
> -tk
>
> On Wed, Sep 4, 2024 at 2:29 AM Peter Cooper-Davis <[email protected]> 
> wrote:
>
>> I recently noticed some issues with my weewx database when calculating 
>> average values from the weighted daily sums compared to from the individual 
>> records. For example:
>>
>> *select avg(outTemp) from archive where strftime("%m", 
>> dateTime,'unixepoch','localtime')=='09';* gives 16.44376...
>>
>> *select sum(sum)/sum(count) from archive_day_outTemp where* *strftime("%m", 
>> dateTime,'unixepoch','localtime')=='09';* gives 16.44402...
>>
>> BUT
>>
>> *select sum(wsum)/sum(sumtime) from archive_day_outTemp where* *where* 
>> *strftime("%m", 
>> dateTime,'unixepoch','localtime')=='09';* gives 12.76334...
>>
>> I looked into my database in more detail and noticed that some days have 
>> a much higher count and sumtime than others despite the same record count. 
>> Following this discrepancy further, I then noticed that on the days with 
>> the larger sumtime, some of my records had an interval of 300 and some had 
>> a interval of 5.
>>
>> This brings me to my question. What is the unit of interval in the 
>> database? I had assumed it was seconds (which matches the units of 
>> archive_interval in weewx.conf), so the records with an interval of 300 are 
>> 5-minute averaged catch-up records generated through my drivers 
>> genStartupRecords() where I manually specify the interval to be 300 
>> seconds. The records with an internal of 5 are generated from loop packets. 
>> I suspect my issue is that the units of interval is minutes, and therefore 
>> I should change 300 to 5 in my genStartupRecords() function and manually 
>> adjust my database to change all instances of interval=300 to interval=5 (I 
>> have always used a constant archive interval). Before I do this though, can 
>> someone confirm that my thinking is correct?
>>
>>
>> -- 
>> 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].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/weewx-user/23203cb0-2b36-49b7-8b49-6b0d7628367fn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/weewx-user/23203cb0-2b36-49b7-8b49-6b0d7628367fn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/0feeddb1-fadd-45fe-aa7b-4856c9ae77den%40googlegroups.com.

Reply via email to