Page 1 of 3

Data Summary - possible calculation error

Posted: Fri 22 May 2020 10:54 am
by RayProudfoot
This problem appears related to arithmetic on the excellent Data Summary PHP code. Looking at the attached image the total of rainfall for Spring 2020 is shown as 4.13".

However, if you add up the three individual month totals of 2.19, 0.67 and 0.27 they sum at 3.13", not 4.13". Other season totals are fine. Just a bug in the current season calculation perhaps?
Rainfall_Error.jpg

Re: Data Summary - possible calculation error

Posted: Fri 22 May 2020 12:02 pm
by Mapantz
Don't quote me on it, but I have a feeling this was mentioned some time ago and it was fixed?!

Re: Data Summary - possible calculation error

Posted: Fri 22 May 2020 12:04 pm
by sfws
Ray, unless I am muddling this up with something else, my memory tells me your bug has already been reported and resolved, as it is a very very old one. Glad to see mapantz agrees with me on at least that it was fixed.

If it has resurfaced, me wonders about version control. More likely, knowing you well through your comments, you have stuck with an old version.

If my memory is faulty, ignore this post. Maybe you can find the post about this, it is somewhere on the forum. Unfortunately daily summary issues get scattered between different sub-forums. I might be wrong, but my memory suggests Mark worked out the solution.

I can't recall enough to quote the solution, but I do recall the extra "1" comes from adding in the boolean test result of true, so you might even be able to spot the place in the code where a boolean is added into sum.

Re: Data Summary - possible calculation error

Posted: Fri 22 May 2020 12:15 pm
by RayProudfoot
Gents, thanks for your replies. Maybe there was an update I missed as I tend to leave well alone.

I’ll have a look though the code and see if I can spot it. I’ll be back later with or without good news.

Re: Data Summary - possible calculation error

Posted: Fri 22 May 2020 12:19 pm
by beteljuice
You are running quite an old version ...

'Seasonal' now starts with Spring.

Yet Another Dayfile Reader

Re: Data Summary - possible calculation error

Posted: Fri 22 May 2020 12:35 pm
by RayProudfoot
beteljuice wrote: Fri 22 May 2020 12:19 pm You are running quite an old version ...

'Seasonal' now starts with Spring.

Yet Another Dayfile Reader
I'm not surprised since I rarely check for updates if things are working okay. Can you point me to the latest version please? Is it just betel_datasummary.php I need to replace? Do I lose any settings if I do that?

Re: Data Summary - possible calculation error

Posted: Fri 22 May 2020 12:38 pm
by RayProudfoot
I've found betel_7.1.3.zip so I shall follow your instructions in that, thanks! :)

Re: Data Summary - possible calculation error

Posted: Fri 22 May 2020 7:19 pm
by RayProudfoot
I've updated to the latest build and although the rainfall totals for Spring 2020 is correct I'm confused about how Winter is determined. I've always used Dec, Jan and Feb for the three months so for example December 2009 - February 2010 would be deemed to be Winter 2010 since all but 10 days fall in 2010.

But if you select Average Temps and Seasonal here http://www.cheadlehulmeweather.co.uk/be ... ummary.php and then compare to my manually calculated seasonal average temps here http://www.cheadlehulmeweather.co.uk/seasonaverages.htm my average of 2.8 is shown against 2009 when it should be 2010. All the Winter entries are one year out.

Finally, Jan and Feb are shown in red in the Winter column. Why? Some error in my setting up?

Re: Data Summary - possible calculation error

Posted: Fri 22 May 2020 7:38 pm
by Mapantz
The red colouring is to indicate that those months are not in the current year - Winter being spread in two different years.

Re: Data Summary - possible calculation error

Posted: Fri 22 May 2020 7:40 pm
by Mapantz
RayProudfoot wrote: Fri 22 May 2020 7:19 pm I've always used Dec, Jan and Feb for the three months so for example December 2009 - February 2010 would be deemed to be Winter 2010 since all but 10 days fall in 2010.
No. February 2010 would be part of Winter 2009. We usually refer to it as "The Winter of 2009/2010"

The infamous December 2010 would be part of Winter 2010/2011.

Re: Data Summary - possible calculation error

Posted: Fri 22 May 2020 7:54 pm
by mcrossley
RayProudfoot wrote: Fri 22 May 2020 7:19 pm ...since all but 10 days fall in 2010.
Meteorological winter starts on the 1st December, not the solstice.

Re: Data Summary - possible calculation error

Posted: Fri 22 May 2020 8:42 pm
by mcrossley
Mapantz wrote: Fri 22 May 2020 7:40 pm
No. February 2010 would be part of Winter 2009. We usually refer to it as "The Winter of 2009/2010"

The infamous December 2010 would be part of Winter 2010/2011.
Though to be fair the met office seem to mix the two conventions. They refer to winter 2010/11 but then on some data sets make it winter 2011/10 :?

Re: Data Summary - possible calculation error

Posted: Fri 22 May 2020 9:00 pm
by RayProudfoot
Mapantz wrote: Fri 22 May 2020 7:40 pm No. February 2010 would be part of Winter 2009. We usually refer to it as "The Winter of 2009/2010"

The infamous December 2010 would be part of Winter 2010/2011.
Sorry, that’s wrong. I started keeping records in May 2009 my first winter record would be December 2009 to February 2010. And that average temp of 2.8°C is shown on my manually calculated Winter 2010 entry.

But that 2.8°C is shown on the Data Summary page under Winter 2009. That is not correct. The previous PHP page had them correctly. This one is wrong.

@mcrossley, yes, my mistake. 31 days of winter in 2009 and 59 or 60 in 2010. So Winter entries should always be in the year Winter ends, not starts.

Re: Data Summary - possible calculation error

Posted: Fri 22 May 2020 9:17 pm
by RayProudfoot
I’ve had a look at the Met Office for guidance on how to store winter records but it doesn’t give a definitive answer.

Given we seem to have different opinions I would rather stick to my system of storing the average against the year winter ends, not starts.

I shall revert to my previous PHP file and accept the temporary miscalculation of rainfall.

Re: Data Summary - possible calculation error

Posted: Fri 22 May 2020 9:26 pm
by freddie
RayProudfoot wrote: Fri 22 May 2020 9:17 pm I’ve had a look at the Met Office for guidance on how to store winter records but it doesn’t give a definitive answer.
Winter is attributed to the year in which it starts. That is the meteorological convention. I'll try and find a link that specifically states this. One I know of in passing is this: https://www.metoffice.gov.uk/weather/le ... nter-start