I second this. Folks here are amazing with helping and have patience beyond belief!
Tom ________________________________ From: [email protected] <[email protected]> on behalf of monmul <[email protected]> Sent: Monday, January 14, 2019 7:05 PM To: weewx-user Subject: [weewx-user] Re: Getting the RPi 3 with Davis Vantage up and running As ever, thank you for your help and your patience! On Tuesday, 15 January 2019 11:39:26 UTC+13, gjr80 wrote: $alltime.rain.sum will certainly work, but I suspect it will not give you what you seek. Hence the question about what you wanted to display. $alltime says work out an aggregate over all records in the database, .rain says work out the aggregate on the rain field and .sum means sum the records. So $alltime.rain.sum will give you the total rainfall from all records in your database, which I don't think is what you want. If you want to look at wettest days you can make use of the maxsum (the value) and maxsumtime (when the value occurred) aggregates. So now that you have $alltime available something like $alltime.rain.maxsum will give you the highest alltime daily rainfall and $alltime.rain.maxsumtime will give you when it occurred. Similarly, $year.rain.maxsum and $year.rain.maxsumtime will give you the same statistics but for the year to date. These aggregates are possible because weeWX stores (apart from the archive records in the archive table) summary data for each observation and this summary data is stored on a per day basis. Hence it is very easy to get the wettest day, unfortunately weeWX does not record summary data on a year (or month or week) basis so finding the wettest year, month or week requires a bit of code. Gary On Tuesday, 15 January 2019 04:28:41 UTC+10, monmul wrote: Thank you so much for that.....so John's suggestion of $alltime.rain.sum is not going to work? Is there a tag for the day in the data series which had the most rain? I am nearly finished and will leave you all in peace soon! Thank again to all! On Tuesday, 15 January 2019 00:36:47 UTC+13, gjr80 wrote: No problems, I think calendar year can be taken either way. In that case $year will do just fine. There is no simple tag to give you the may yearly rainfall over a number of years, to come up with this requires a little code. There are a few ways you could handle this, one of the easiest ways is to add a little inline python to to a template the iteration capabilities of the weeWX tags<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fweewx.com%2Fdocs%2Fcustomizing.htm%23Iteration&data=02%7C01%7C%7C0ab53c605251405c2c5b08d67a859c02%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636831111592228138&sdata=tmP22NDpzXlNicMpWuU4C4MHEdv3JsozurEO1cIICt4%3D&reserved=0>. In the template you wish to display the max annual rainfall add the following code somewhere before you want to display the annual rainfall data (near the top of the template is often convenient): #set $max_rain = 0 #set $max_rain_year = None #for $y in $alltime.years #set $year_no = $y.start #set $year_rain = $y.rain.sum #if $year_rain.raw > $max_rain #set $max_rain = $year_rain.raw #set $max_rain_vh = $year_rain #set $max_rain_year = $year_no #end if #end for Provided you have the xstats extension installed and provided you have added search_list_extensions = user.xstats.ExtendedStatistics to skin.conf as per the xstats instructions, you can then use the tag $max_rain_vh to display the maximum annual rainfall and the tag $max_rain_year to display the year. $max_rain_vh is able to use the weeWX formatting and conversion options so $max_rain_vh.mm<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmax_rain_vh.mm&data=02%7C01%7C%7C0ab53c605251405c2c5b08d67a859c02%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636831111592228138&sdata=Aanw6LqbY5VbfoSYO9dEiHUyZ9NDTUFO4rjfx%2Bnzs%2Fc%3D&reserved=0> will display the rainfall in mm using default formatting and adding a label eg 1234.5 mm. For example, using the above code you could use something like: #if $max_rain_year is not None Maximum annual rainfall was $max_rain_vh.mm in $max_rain_year.format("%Y") #else No rainfall data available #end if to display something like: Maximum annual rainfall was 1326.4 mm in 2015 The code between the #else and #end if is there to catch the case where there may have been no rainfall data. Hopefully something for you to experiment with. Gary On Monday, 14 January 2019 20:19:40 UTC+10, monmul wrote: No, I only want a number for the full calendar year Jan 1 to Dec 31....for the data that I have....then I want to find the maximum value in that series. I am not interested in a running total. Sorry, I did not make myself very clear. Very basic, old fashioned, total rain in each calendar year. On Monday, 14 January 2019 23:10:00 UTC+13, gjr80 wrote: If you mean say, total rainfall for the 1 year ending today (ie 14 Jan 2018 to 14 Jan 2019), then $span($year_delta=1).rain.sum will give you what you are after. Refer to the $span tag (http://weewx.com/docs/customizing.htm#_________Tag_$span_______<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fweewx.com%2Fdocs%2Fcustomizing.htm%23_________Tag_%24span_______&data=02%7C01%7C%7C0ab53c605251405c2c5b08d67a859c02%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636831111592228138&sdata=2j%2FbFVygrPe8Cn1oBWGdmdkkYQ2hH00ukYIyJQfCdEE%3D&reserved=0>) in the Customization Guide. Gary -- 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]<mailto:[email protected]>. For more options, visit https://groups.google.com/d/optout<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Foptout&data=02%7C01%7C%7C0ab53c605251405c2c5b08d67a859c02%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636831111592228138&sdata=qO7E3bE%2BeZVDa%2ByUG2Rkkh9y7BOHr%2BWtuoyrmNqXw2g%3D&reserved=0>. -- 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]. For more options, visit https://groups.google.com/d/optout.
