I would not expect the standard SQL behavior (ignoring nulls and averaging 
the rest of the values) to result in what I am seeing in the graphs, but 
you are probably right that I am going to have to define a specialty 
aggregation.

On Saturday, June 3, 2023 at 8:10:26 PM UTC-4 Tom Keffer wrote:

> WeeWX uses a SQL statement to calculate the averages. SQL ignores any 
> nulls in an aggregate interval. So, if there is nothing but nulls in an 
> interval, the result will be null, not zero.
>
> Null values signify unknown values, not zero. I didn't follow the 
> discussion of your service, but if you can't change it to store zero when 
> the value is, well, zero, then you'll have to define your own specialty 
> xtype aggregations, which treats null as a zero, perhaps by using the SQL 
> function IFNULL(). 
>
> Instructions on defining custom xtype aggregations: 
> https://github.com/weewx/weewx/wiki/xtypes#calculating-aggregates
>
>
> On Sat, Jun 3, 2023 at 4:39 PM 'Peter Fletcher' via weewx-user <
> weewx...@googlegroups.com> wrote:
>
>> For reasons discussed elsewhere, I have a user service which saves nulls. 
>> rather than zeros to the archive records for UV and solar radiation values 
>> during the night. Daily and weekly graphs continue to look as they should 
>> (with the daytime tracings arising from at or very near to the zero axis). 
>> On the monthly graphs, however, the tracings do not touch the zero axis at 
>> either end of the daytime peak, I am guessing that, in calculating averaged 
>> data points for the longer term graphs, weewx is treating the average of 
>> any group of values that contains a null value as null. There is some logic 
>> to this, but the results are unhelpful in this case. Am I right about the 
>> cause of the problem, and is there a workaround for it? 
>>
>> -- 
>> 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/aff03e49-1c45-4383-bc80-a3db9425ac8fn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/weewx-user/aff03e49-1c45-4383-bc80-a3db9425ac8fn%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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/0f0dab2d-ad9f-4297-a5db-c87c23981ae8n%40googlegroups.com.

Reply via email to