This is great. I implemented it on my site this morning. I added it to the 
bottom of the Since Midnight table at the bottom. Does exactly what I was 
looking for.

The only issue I'm having is that I want to display the rain total only if 
it's not zero. I live in an area where there's typically no rain from May 
to October so I want to skip the line for the rain when it's 0. I tried an 
if statement but it's not effective. Any hints?

Here's the template code: 
              <tr>
                <td class="stats_label">
                  On This Day<br/>
                  $day.dateTime.format("%b %d")
                </td>
                <td class="stats_data">
                #for $day in $this_span.periods
                   $day.dateTime.format("%Y")<br/>
                   &nbsp; H: $day.outTemp.max &nbsp;&nbspL: 
$day.outTemp.min<br/>
                   #if $day.rain.sum > 0
                      &nbsp Rain: $day.rain.sum<br/>
                   #end if
                #end for
                </td>
              </tr>


On Wednesday, May 15, 2019 at 7:03:35 AM UTC-7, V. Kelly Bellis wrote:
>
> Thanks for doing this Gary. I'm too new to all of this stuff to have 
> anything to look back on, but it's very cool to see what can be done with 
> weewx.
> - Kelly
>
> On Tuesday, May 14, 2019 at 8:37:55 PM UTC-4, gjr80 wrote:
>>
>> I should have given this a little more thought before publishing. I have 
>> since made a slight change to the tag name to make it a little more logical 
>> and consistent with the other iterative tags that WeeWX supports (and to 
>> remove a 'this'). The tag now uses .periods in lieu of .this; for 
>> example, you would now use the $this_span tag as follows:
>>
>> #for $day in this_span.periods
>> $day.outTemp.max at $day.outTemp.maxtime
>> #end for
>>
>> Any existing template code will work fine with the current version with 
>> just the need to change '.this' to '.periods'.
>>
>> I have also created a page 
>> <https://github.com/gjr80/weewx_utilities/wiki/This-Search-List-Extension> 
>> in the wiki of the repo containing the this search list extension code 
>> that explains the installation and usage of the this search list 
>> extension. Hopefully this is a little more user friendly and easier to 
>> read than comments in the code.
>>
>> Gary
>>
>> On Monday, 13 May 2019 17:40:37 UTC+10, gjr80 wrote:
>>>
>>> I've put together a search list extension that should do what you want. 
>>> You will find the code here 
>>> <https://raw.githubusercontent.com/gjr80/weewx_utilities/master/search%20list%20extensions/this/bin/user/this.py>.
>>>  
>>> The SLE is based on the existing WeeWX tag machinery that enables 
>>> iteration <http://weewx.com/docs/customizing.htm#Iteration> over 
>>> periods. So with the SLE installed you can do something like:
>>>
>>> #for $day in this_span.this
>>> $day.outTemp.max at $day.outTemp.maxtime
>>> #end for
>>>
>>> to display the maximum daily temperature and the time it occurred on 
>>> this day in all years in the archive. The output would be something like:
>>>
>>> 24.5°C at 11 May 2017 12:51:00
>>> 26.7°C at 11 May 2018 13:31:00
>>> 23.4°C at 11 May 2019 13:15:00
>>>
>>> There are various parameters that can be set against $this_span to 
>>> limit the period covered (the default is all records but you can limit it 
>>> to the last x years, months etc as with the existing $span tag). There 
>>> are various parameters that can be applied to .this to set the day to 
>>> be used, for example, .this($period='week') and .this($period='month') 
>>> will provide stats for this week and this month respectively over all 
>>> years. There are many variations and permutations, I have tried to capture 
>>> a variety of use cases in the up front comment in this.py 
>>> <https://raw.githubusercontent.com/gjr80/weewx_utilities/master/search%20list%20extensions/this/bin/user/this.py>
>>> .
>>>
>>> To install/use:
>>>
>>> 1. Download the file this.py to the WeeWX machine and save to the 
>>> $BIN_ROOT/user directory:
>>>
>>>     for a setup.py install:
>>>     
>>> $ wget -P /home/weewx/bin/user https://
>>> raw.githubusercontent.com/gjr80/weewx_utilities/master/search%20list%20extensions/this/bin/user/this.py
>>>
>>>     otherwise:
>>>
>>> $ wget -P /usr/share/weewx/user https://
>>> raw.githubusercontent.com/gjr80/weewx_utilities/master/search%20list%20extensions/this/bin/user/this.py
>>>
>>> 2.  Add the following line to the skin config file [CheetahGenerator] 
>>> stanza for the skin in which the SLE is to be used:
>>>     
>>> search_list_extensions = user.this.ThisSLE
>>>
>>>     if the search_list_extensions config option already exists add 
>>> user.this.ThisSLE to the end of the option using a comma as a 
>>> separator, eg:
>>>     
>>> search_list_extensions = user,another.SLE, user.this.ThisSLE
>>>
>>> 3.  Add the required $this_span.this code to the template concerned.
>>>
>>> 4.  After the next report cycle is complete confirm there are no errors 
>>> in the log and the report has been generated as expected.
>>>
>>> Gary
>>>
>>> On Saturday, 11 May 2019 23:30:47 UTC+10, Robin wrote:
>>>>
>>>> I apologise if this has been asked before or if there is a simple and 
>>>> obvious way to do this, but I can't see it.
>>>>
>>>> I want to display the temperature (min,max) for today's date for each 
>>>> year since we started keeping records.
>>>>
>>>> Can somebody point me in the right direction?
>>>>
>>>> Thanks people.
>>>>
>>>

-- 
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/80387d7d-700d-454b-ab1d-745565a10508%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to