Hi Tom, I think this helps. Might need to tinker around with it and get my 
hands dirty to have a full comprehension. The database call I put in is a 
good band-aid, but I'd like to opt for built-in features when possible. I 
am doing a good handful of database lookups in the SLE - should i move them 
to get_extension_list() instead?

Back to all time:

I'm only using $alltime.rain.sum once, but I am using $alltime 34 times 
within 1 template. The output above showed the rain being re-calculated 13 
times. 

root@weewxlab:/etc/weewx/skins/Belchertown# grep -Rn "\$alltime" * | wc -l
34

Are you suggesting that every time an $alltime tag is called (even if in 
the same template?), the entirety of $alltime is re-generated? I guess that 
makes sense, but I don't have a grasp on why the values would change. 
Unless it has something to do with the Timebinder changing it's time search 
and the final array of $alltime isn't really "all time".

I understand how it should work logically, but (obviously) programatically 
I need a little more work to understand the full flow. 



On Monday, November 12, 2018 at 7:59:03 PM UTC-5, Tom Keffer wrote:
>
> Take a look at this post from last spring and see if it explains why you 
> are getting so many values: 
> https://groups.google.com/d/msg/weewx-user/JQSSKweeam8/2mIWO96PBgAJ
>
> You may want to restructure your code to use a later binding. The function 
> get_extension_list() is where you stage things, but it is usually not where 
> you hit the database. As an example, the class cheetahgenerator.Stats 
> creates a TimeBinder object in get_extension_list, but it doesn't actually 
> hit the database until Cheetah starts asking for attributes of TimeBinder 
> (such as "week", "month", etc.)
>
> Hope this explains things.
>
> -tk
>
> On Mon, Nov 12, 2018 at 2:08 PM Pat O'Brien <[email protected] 
> <javascript:>> wrote:
>
>> It's part of the Belchertown skin. You can find the SLE and the 
>> all_stats copy/paste from your documentation here 
>> <https://github.com/poblabs/weewx-belchertown/blob/master/bin/user/belchertown.py#L304>.
>>  
>> Then the $alltimel.rain.sum was here 
>> <https://github.com/poblabs/weewx-belchertown/blob/9e2a16151493e70df78bde5be9acc219caebe705/skins/Belchertown/records/index.html.tmpl#L179>,
>>  
>> but I've since removed it 
>> <https://github.com/poblabs/weewx-belchertown/blob/master/skins/Belchertown/records/index.html.tmpl#L178>
>>  
>> since a recent commit to get the data from the database instead. 
>>
>> Hope this helps?
>>
>>
>> On Monday, November 12, 2018 at 4:55:54 PM UTC-5, Tom Keffer wrote:
>>>
>>> Hi, Pat
>>>
>>> I'd have to see the exact instrumented code to comment. Could you post?
>>>
>>> -tk
>>>
>>> On Mon, Nov 12, 2018 at 6:04 AM Pat O'Brien <[email protected]> 
>>> wrote:
>>>
>>>> Hi there, I'm using the all_stats code found in the Customization Guide 
>>>> <http://www.weewx.com/docs/customizing.htm#defining_new_tags> and 
>>>> noticed a potential error. Full code snippet:
>>>>
>>>>  all_stats = TimespanBinder(timespan,
>>>>      db_lookup,
>>>>      formatter=self.generator.formatter,
>>>>      converter=self.generator.converter,
>>>>      skin_dict=self.generator.skin_dict)
>>>>
>>>>  search_list_extension = {'alltime' : all_stats 
>>>>
>>>> When using the $alltime.rain.sum it was returning a lot of results, 
>>>> which only 1 was accurate. I'm not sure why so I wanted to ask here. 
>>>>
>>>> Within the SLE Python I ran:
>>>>
>>>> print all_stats.rain.sum
>>>>
>>>> it returns:
>>>>
>>>> 120.70 in
>>>> 50.84 in
>>>> 120.70 in
>>>> 120.70 in
>>>> 3.75 in
>>>> 120.70 in
>>>> 120.70 in
>>>> 120.70 in
>>>> 120.70 in
>>>> 120.70 in
>>>> 120.70 in
>>>> 120.70 in
>>>> 120.70 in
>>>>
>>>> The correct answer here is 50.84. Do you know why all of the other 
>>>> results would show up? Is this a TimespanBinder limitation issue (like 
>>>> what 
>>>> I saw early on in Belchertown's creation)?
>>>>
>>>>

Reply via email to