Rain cumulative total wrong total in graph

252 views
Skip to first unread message

Greg from Oz

unread,
Jun 24, 2023, 12:27:39 AM6/24/23
to weewx-user
I have made a graph to show the cumulative rainfall and it seems to show the correct values on the graphs for day, week and month. They tally up with the figures that weewx has calculated but the year total is way out and the graph numbers are way out as well.
I cannot see why it would be so different.

I am using weewx version 4.10.2 and mysql

Here is the year configuration I am using which is similar to the day, week and month.

        [[[yearraincumulation]]]
           [[[[rain1]]]]
              data_binding = wx_binding
              data_type = rain
              aggregate_type = cumulative
              aggregate_interval = 604800 #1 day
              label = Rain cumulative
              plot_type = line
              line_type = solid
              line_gap_fraction = 0.5
It generates the graph:
weewxcumulative.png
The total weewx tells me for the year is:
478.8 mm
which is nowhere near the 1200 on the graph.
Very strange the other graphs work.

Here is my web page:

Any ideas?
Thanks

Graham Eddy

unread,
Jun 24, 2023, 12:50:21 AM6/24/23
to WeeWX User
rainyear date?
⊣GE⊢

On 24 Jun 2023, at 2:27 pm, Greg from Oz <ubea...@gmail.com> wrote:

I have made a graph to show the cumulative rainfall and it seems to show the correct values on the graphs for day, week and month. They tally up with the figures that weewx has calculated but the year total is way out and the graph numbers are way out as well.
I cannot see why it would be so different.

I am using weewx version 4.10.2 and mysql

Here is the year configuration I am using which is similar to the day, week and month.

        [[[yearraincumulation]]]
           [[[[rain1]]]]
              data_binding = wx_binding
              data_type = rain
              aggregate_type = cumulative
              aggregate_interval = 604800 #1 day
              label = Rain cumulative
              plot_type = line
              line_type = solid
              line_gap_fraction = 0.5
It generates the graph:
<weewxcumulative.png>
The total weewx tells me for the year is:
478.8 mm
which is nowhere near the 1200 on the graph.
Very strange the other graphs work.

Here is my web page:

Any ideas?
Thanks


--
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/97c7b8b9-d177-465a-b258-692a1e06226dn%40googlegroups.com.
<weewxcumulative.png>

Greg Reive

unread,
Jun 24, 2023, 1:03:26 AM6/24/23
to weewx...@googlegroups.com
What do you mean rain year date?


You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/Td-2dHCXwaA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/35952BFA-6255-4349-88DD-E1BB7B954697%40geddy.au.

Greg from Oz

unread,
Jun 24, 2023, 1:52:54 AM6/24/23
to weewx-user
I put this part in:
              rain_year_start = 1
But still not correct.

Graham Eddy

unread,
Jun 24, 2023, 2:40:56 AM6/24/23
to WeeWX User
i just assumed you were comparing aggregation of 12 months with aggregation since start of rainyear
⊣GE⊢

Greg Reive

unread,
Jun 24, 2023, 2:42:26 AM6/24/23
to weewx...@googlegroups.com
I just want the cumulative total for the year to date.
It seems to work for day, week, month.

Rainer Lang

unread,
Jun 24, 2023, 8:42:18 AM6/24/23
to weewx...@googlegroups.com
the below works for me ...
        [[[yearrain1]]]
            # Make sure the y-axis increment is at least 0.02 for the rain plot
            yscale = None, None, 0.02
            plot_type = bar
            width = 1
            [[[[rain1]]]]
                fill_color = "#ff4500"  #red

                 data_binding = wx_binding 
                 data_type = rain
                aggregate_type = cumulative
                label = text

Rainer Lang

unread,
Jun 24, 2023, 8:45:26 AM6/24/23
to weewx-user

gjr80

unread,
Jun 24, 2023, 3:35:35 PM6/24/23
to weewx-user
The current WeeWX cumulative series xtype is rather primitive and only produces a series where the first data point is zero and subsequent data points are cumulated by the aggregate interval over the plot time span. The default day, week, month, year plots produced by the image generator cover a (roughly) day, week, month and year from the current time. For example, the day plot starts on a three hour boundary 27 hours before the next three hour boundary after the current time (eg it is 7:30pm as I write this so a default day plot produced now will cover the period from 6:00pm yesterday until 9:00pm tonight). So what? Well if the plot was cumulative the first data point (6:00pm yesterday) would be zero and the plot would cumulate from there. No reset at midnight (or any other time for that matter). Similar effect for week, month and year plots. So a year plot produced today 24 June 2023 would have its first data point on 1 June 2022 (year plots start on the 1st of a month) and it would be zero, the plot then cumulates from that point on until today, 24 June 2023. No reset on 1 January 2023. In other words the value of the last point of the plot will include data from part of last year as well as all of this year.

So the effect your are seeing is expected. Looking at your site the day, week and month plots indeed look correct, not because of the cumulative aggregate behaviour but rather because there was no rain in the plot period before midnight, Sunday and 1 June on the day, week and month plots respectively. If you wait until July you will note you month cumulative plot will be out because it will include rain from June. In time your cumulative day and week plots will show similar 'wrong' data.

What to do about it? You either ensure your plots start on the time that you want the cumulative value to reset (eg midnight for day plots) or you change the cumulative series xtype behaviour. Neither can easily be done by the user via config changes. The former is just going to produce ugly plots and will be difficult/messy to implement, modifying the cumulative series xtype has the advantage of needing no change to the WeeWX plot engine. Late last year it got to me and I produced a WeeWX service that replaces the cumulative series xtype shipped with WeeWX with a more capable version that allows the user to specify a reset time for the cumulative value (the service works by placing the more capable cumulative series xtype ahead of the shipped cumulative series xtype in the xtype list so the modified version is always used). I've been using the modified xtype with my solar PV system to report cumulative daily energy since late last year and it seems to work acceptably. I haven't gotten around to implementing it for my (weather) station.

If anyone is interested you can find it on GitHub here. The wiki has some basic details of how to configure the image generator plots to use the reset times as well as some example plots. Note the extension requires WeeWX v4.6.0 or later.

Gary

Greg from Oz

unread,
Jun 24, 2023, 7:21:28 PM6/24/23
to weewx-user
Thanks Gary I will try your extension.
The instructions say to do this:
The above is not found .
Should be below statement:?

Question: If I install it do I need to do anything else to produce the cumulative graph?
Do I need to remove anything that is already there in the config file?

I don't want to break my station :)

Greg from Oz

unread,
Jun 24, 2023, 7:46:59 PM6/24/23
to weewx-user
OK I have installed the extension and it seems to work!
Thanks Gary

You might want to put in the documentation about how to set the reset times examples.
I used:
reset = day
reset = week
reset =month
reset = year

        [[[yearraincumulation]]]
           [[[[rain1]]]]
             data_binding = wx_binding
              rain_year_start = 1

              data_type = rain
              aggregate_type = cumulative
              aggregate_interval = 604800 #1 day
              label = Rain cumulative
              plot_type = line
              line_type = solid
              line_gap_fraction = 0.5
              reset = year

Thanks again.
Check it out on my web site:

Screenshot from 2023-06-25 09-45-13.png

gjr80

unread,
Jun 25, 2023, 4:42:46 PM6/25/23
to weewx-user
On Sunday, 25 June 2023 at 00:21:28 UTC+1 Greg from Oz wrote:
Thanks Gary I will try your extension.
The instructions say to do this:
The above is not found .
Should be below statement:?
Correct, thanks, fixed. 

On Sunday, 25 June 2023 at 00:46:59 UTC+1 Greg from Oz wrote:
OK I have installed the extension and it seems to work!
Thanks Gary

You might want to put in the documentation about how to set the reset times examples.
I used:
reset = day
reset = week
reset =month
reset = year

        [[[yearraincumulation]]]
           [[[[rain1]]]]
             data_binding = wx_binding
              rain_year_start = 1

              data_type = rain
              aggregate_type = cumulative
              aggregate_interval = 604800 #1 day
              label = Rain cumulative
              plot_type = line
              line_type = solid
              line_gap_fraction = 0.5
              reset = year
 

Greg Reive

unread,
Jun 25, 2023, 4:59:37 PM6/25/23
to weewx...@googlegroups.com
Sorry I didn't see the wiki part.
I just read the install bits.
Yes the wiki will cut it.

Also are you going to make this a standard in weewx?

Thanks again it is great.
I will pay around with it later and make the reset 9am due day graphs.


--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/Td-2dHCXwaA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.

gjr80

unread,
Jun 25, 2023, 5:06:12 PM6/25/23
to weewx-user
Need to talk to Tom about that, high standards and I'm not sure I am there yet. Plus v5 is the focus at the moment.

Gary

DR

unread,
Jun 27, 2023, 7:16:27 PM6/27/23
to weewx...@googlegroups.com
I'm trying to learn how to do a fwe things, but am confused by the need
for the data_binding statement:


> data_binding = wx_binding


Isn't this a default linkage, and for those of us with simple databases
and setups, not needed?  Just trying to cipher this out.

Thanks for any explanation.  Dale


Greg Reive

unread,
Jun 27, 2023, 7:23:02 PM6/27/23
to weewx...@googlegroups.com
I don't think you need that line. Just comment it out.
I was playing with lots of options and forgot to remove that line.


--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/Td-2dHCXwaA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.


--
¯\_(ツ)_/¯

Rainer Lang

unread,
Jun 28, 2023, 5:13:57 AM6/28/23
to weewx...@googlegroups.com
It can be omitted (under normal circumstances)
I was/am using it because I combine/d different observations from different weewx databases
with different rain gauges into one graph/picture.
I think the image generator needs to be told from where to take the data if more than one
observation is under the e.g. [[[dayrainx]]] stanza in several [[[[nnnn]]]] stanzas taking data from different databases
(plus it increases the readability of the code 😎)
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/CAD_tbc8b5E47XCULGH9%2BLnaT%3DgC%3DJca26k-JptVA0sTrJf_Gng%40mail.gmail.com.


Reply all
Reply to author
Forward
0 new messages