Seasons statistics.inc question for displaying windrun

47 views
Skip to first unread message

Jared

unread,
Nov 26, 2019, 9:09:05 PM11/26/19
to weewx-user
Hi,

I've enabled windrun, and it seems to be writing to the database and functioning normally.  For my skin I'm running Seasons but adding a couple of data points.  I now want to add windrun to my statistics page, and it seemed like it should function exactly like rain would, since the both aggregate on a daily basis.

Rain <tr> looks like:

        <tr>
          <td class="label">$obs.label.rain</td>
          <td class="units">$unit.label.rain</td>
          #for $archive in $archive_data
          <td class="data new_row">$archive.rain.sum.format(add_label=False)</td>
          #end for
        </tr>


My new windrun <tr> looks like:

        <tr>
          <td class="label">$obs.label.windrun</td>
          <td class="units">$unit.label.windrun</td>
          #for $archive in $archive_data
          <td class="data new_row">$archive.windrun.sum.format(add_label=False)</td>
          #end for
        </tr>


But for some reason this isn't taking the "max sum" for the day like Rain does, it's adding it for the whole week.  Here's the HTML output for both (Today in column 1 and Week in column 2) and the last 10 archive_day records for both from the database.  There's the 0.76 for rain.  But it's adding the windrun all together to make 66.7 for the week, rather than taking 31, the highest value so far for the week.  8.75 + 27.0 + 31.0 = 66.75.  Why are they behaving differently?







gjr80

unread,
Nov 26, 2019, 9:35:26 PM11/26/19
to weewx-user
Hi,

I am not sure I am seeing anything unexpected in your data/output. You mention 'max sum' but I don't see 'max' anywhere in the code, only 'sum'. The Seasons skin statistics module gives statistics over various periods. By default it is day, week, month and year. For rainfall this is the total rainfall for the current day, current week, current month and current year. If you have duplicated the statistics.inc rain code substituting windrun for rain then you will have the total windrun for the current day, current week etc. From the data you show and code you are using the output is exactly that. If you are seeking to display the highest daily windrun for the current week, current month and current year then you need to change your windrun code to use the appropriate aggregate. Changing $archive.windrun.sum.format(add_label=False) to (untested) $archive.windrun.maxsum.format(add_label=False) should work.

Or have I missed the issue you are having?

Gary

Jared

unread,
Nov 27, 2019, 8:07:41 AM11/27/19
to weewx-user
No, you've got it.  And ah, I see what I was missing.  I was thinking of "week" as in the last seven days, and so expected the rain total to be higher.  It was a coincidence that I started windrun on Sunday and that was also the last day we had rain, otherwise maybe I would have caught it.

And you're correct, 'maxsum' works as you described!

Thanks a lot for your help :)
Reply all
Reply to author
Forward
0 new messages