daysum and monthsum break if beginning of day/month isn't in the chart time window. **solved**

This section covers the Meteobridge PRO, PRO2, NANO SD, Raspberry Pi and VM platforms exclusively

Moderator: Mattk

Post Reply
User avatar
lightmaster
Junior Boarder
Junior Boarder
Posts: 37
Joined: Fri Oct 19, 2018 1:03 am

daysum and monthsum break if beginning of day/month isn't in the chart time window. **solved**

Post by lightmaster »

I'm trying to create a custom chart that will show me the rain rate, daily rain total, and monthly rain total for the last 48 hrs. I noticed that when I use either [rain0total-monthsum=in.2:0], and the time period is say Aug 4th through Aug 6th, both of those are giving me the sum of rainfall for Aug 4th-6th, not monthly total at 8/4/24 12am, then monthly total as of 8/4/24 1am, etc. In essence, it's summing the rainfall for the time period that the chart is displaying, not the rainfall since the first day of the month.

The same thing happens for daysum periods where the start of the graph isn't at 12am (ie, graph is from 7am to 7am cuz it's the last 24hrs).

Rain last 48 hours (rainfall for Aug 5th begins after the chart begins):
rain last 48 hrs.png
rain last 48 hrs.png (28.68 KiB) Viewed 2763 times
Rain last 36 hours (part of the rainfall for Aug 5th is before the chart beings):
rain last 36 hrs.png
rain last 36 hrs.png (30.24 KiB) Viewed 2763 times
Based on the text from the Templates page, I would think that these sums should work even if the first day of the month or minute of the day isn't in the chart time frame that's being pulled.
Sensors that deliver cumulated data like "rain0total", "sol0evo" and "sun0total" should be used with the following selectors only:

hoursum, daysum or sumday, monthsum, yearsum, allsum, ydaysum: selects summarized delta values from today, this month, this year, all time or yesterday. Example: "rain0total-sumday" is todays rain fall.
I also tried "[rain0total-sum@M0=in.2:0]" but that was no different than using monthsum.
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: daysum and monthsum break if beginning of day/month isn't in the chart time window

Post by admin »

Are you using most recent Meteobridge SW?
User avatar
lightmaster
Junior Boarder
Junior Boarder
Posts: 37
Joined: Fri Oct 19, 2018 1:03 am

Re: daysum and monthsum break if beginning of day/month isn't in the chart time window

Post by lightmaster »

Yes, when I posted it, I was using Aug 3rd, which was the newest at the time.
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: daysum and monthsum break if beginning of day/month isn't in the chart time window

Post by admin »

Can you please share your chart definitions, so that I can reproduce on my Meteobridge?
User avatar
lightmaster
Junior Boarder
Junior Boarder
Posts: 37
Joined: Fri Oct 19, 2018 1:03 am

Re: daysum and monthsum break if beginning of day/month isn't in the chart time window

Post by lightmaster »

I will, but I gotta recreate it. I had modified the default imperial rain chart, and apparently it got overwrote when I updated to the newest fw yesterday. Headed to bed now, so I'll make it again later today.
User avatar
lightmaster
Junior Boarder
Junior Boarder
Posts: 37
Joined: Fri Oct 19, 2018 1:03 am

Re: daysum and monthsum break if beginning of day/month isn't in the chart time window

Post by lightmaster »

This link will show the correct rain for Aug 6th.
[url]https://.../public/chart.cgi?chart=rain-test.chart&res=min&lang=en&start=H120&stop=H74[/url]

This link will show way too little rain for Aug 6th.
[url]https://.../public/chart.cgi?chart=rain-test.chart&res=min&lang=en&start=H113&stop=H74[/url]

Both show too little rain for the month one.

Here's a download link for the chart file (wouldn't let me upload as an attachment)
https://drive.google.com/file/d/1ZkJoGR ... drive_link
Last edited by lightmaster on Tue Aug 13, 2024 11:23 pm, edited 1 time in total.
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: daysum and monthsum break if beginning of day/month isn't in the chart time window

Post by admin »

Sorry, the links do no show any data when I click onto them.

In the release log it says for August 2019:
adds "daysum", "monthsum" and "yearsum" as selectors for template variables in export definitions. This allows for example to sum up daily rain in an export file that has rows in an hourly resolution.
I checked for exports and there it works as expected, when "monthsum" is used there is no going to zero on new day start but summing up correctly in the span of a month (only data within the defined interval is reflected, not necessary the whole month).

For charts "monthsum" is not defined as citation above explicitly talks about exports. Please use "rain0total-sum" which sums up all rain fall in your selected interval.
User avatar
lightmaster
Junior Boarder
Junior Boarder
Posts: 37
Joined: Fri Oct 19, 2018 1:03 am

Re: daysum and monthsum break if beginning of day/month isn't in the chart time window. **solved**

Post by lightmaster »

Yea, I didn't think about that the links are for a relative time period, so they are like 36 hours different now then when I posted it yesterday, lol.

So even for exports, daysum, monthsum, and yearsum would only work if the beginning of the day, month, or year are within the time period specified? That's essentially the same issue as with using them in charts, they work as long as the beginning of the day, month, or year are in the chart window, but not if the beginning of the day, month, or year is before the start of the chart.

My goal is to create a chart for a rolling 72hr window, and for a rolling 365 day window. It would have to correctly calculate the rain totals for the day and year that are at the start of the chart, without reducing the amount of rain shown as the amount of the first day/year shown is reduced.
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: daysum and monthsum break if beginning of day/month isn't in the chart time window. **solved**

Post by admin »

I tested on my Meteobridge and given this chart definition

defday.png
defday.png (20.14 KiB) Viewed 2564 times

I get this graph which shows raintotals summing up for each day.

graphday.png
graphday.png (20.71 KiB) Viewed 2564 times

When I use "month" in the definition as shown here

defmonth.png
defmonth.png (20.02 KiB) Viewed 2564 times

I get a summing up over the month.

graphmonth.png
graphmonth.png (21.09 KiB) Viewed 2564 times

This all looks like to be expected.

The URL parameters I used are:

Code: Select all

http://..../public/chart.cgi?chart=raintest.metachart&res=min&lang=en&start=2024022606&stop=2024022806
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: daysum and monthsum break if beginning of day/month isn't in the chart time window. **solved**

Post by admin »

lightmaster wrote: Mon Aug 12, 2024 11:41 pm So even for exports, daysum, monthsum, and yearsum would only work if the beginning of the day, month, or year are within the time period specified? That's essentially the same issue as with using them in charts, they work as long as the beginning of the day, month, or year are in the chart window, but not if the beginning of the day, month, or year is before the start of the chart.
Yes, the day/month/year selectors just tell if/when in the selected period a reset to zero should be done.
Following your expectation Meteobridge needs to compute all sums outside the requested interval first and to use this as a starting point for the interval to be shown. I will think if this can be achieved in an computational effective way for a future release.
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: daysum and monthsum break if beginning of day/month isn't in the chart time window. **solved**

Post by admin »

I invested some spare time today to implement the requested feature, where also "raintotal" data outside the specified inspection interval is taken into account when using "day", "month", "year" selectors.

Please give just released update a try.


Definition:

defday.png
defday.png (20.14 KiB) Viewed 2531 times

URL:

Code: Select all

http://.../public/chart.cgi?chart=raintest.metachart&res=min&lang=en&start=2024022706&stop=2024022806

Result:

newdaygraph.png
newdaygraph.png (20.95 KiB) Viewed 2531 times
User avatar
lightmaster
Junior Boarder
Junior Boarder
Posts: 37
Joined: Fri Oct 19, 2018 1:03 am

Re: daysum and monthsum break if beginning of day/month isn't in the chart time window. **solved**

Post by lightmaster »

Got the new update and I noticed that if I make a chart from H305 (beginning of Aug) to H0, it looks right and the monthly rain is correct. If I instead use H250 to H0, it is showing too much rain for Aug.

Using H250 as a start puts the start of the chart around 8am on Aug 3rd. Before Aug 3rd, we had no rain so Aug 3rd at 8am should show 0in of rain. It's instead showing 0.78in of rain at Aug 3rd, which is the exact amount of rain that we had on Aug 3rd.

If I put the start of the chart in Aug 5th, it says that the rain at the start of the chart is 5.26in whereas it should say 1.38in. We got 0.78in on Aug 3rd, 1.38in on Aug 4th, and 3.88in on Aug 5th. 0.78+1.38+3.88=5.26. Looks like when the start of the chart is within a day, it's adding the rain of the previous days, plus the rain of that day, as the starting rain of that day. So in the case of Aug 5th, 1.38 (previous days) + 3.88 (rain from the 5th) = 5.26, whereas it should just be 1.38 as of 4am on the 5th.

If the day that you are starting inside of has no rain, then the monthly sum is correct as the previous days + 0in = the previous days.

Day sum does appear work fine, starting at 00:00 Aug 5th gives a total rain for Aug 5th of 3.88in and a total rain at 11:00 Aug 5th of 0.46in. Starting at 11:00 Aug 5th, it gives a total rain for Aug 5th of 3.88in and a starting rain at 11:00 Aug 5th of 0.46in.

Yearsum seems to suffer the same issue as monthsum, in that if the chart starts on a day of rain, it's adding the rain of the day to the start of the day for yearsum.

I hope that makes sense, I'm not the best at trying to explain things.
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: daysum and monthsum break if beginning of day/month isn't in the chart time window. **solved**

Post by admin »

Thanks for testing. I made an update, please try again.
User avatar
lightmaster
Junior Boarder
Junior Boarder
Posts: 37
Joined: Fri Oct 19, 2018 1:03 am

Re: daysum and monthsum break if beginning of day/month isn't in the chart time window. **solved**

Post by lightmaster »

Initial testing looks good. The same tests I mentioned above are now showing the expected values. I'll keep poking it to see if I can find any issues though.
Post Reply