WUReports/History Query [Solved]

I am not sure if this belongs here or over in the PWS_Dashboard stuff, but i have the WU History/Reports installed in my PWS menu and its working just fine.

I notice, however, that in counting the raindays per month in the reports, it counts the “0” days as a rainday such that the total number of rain days each month is always the number of days in the month.

I have stared for some time at the code in the WUReports directory and see where i think its counting the number of days, but a solution exceeds my understanding and knowledge.

Any suggestions apprecaited.

Regards,

Jim

Have to say, mine doesn’t:

I did once ask Wim if we could have integer numbers for raindays, but I can’t remember the answer. . .

Hmm, i wonder if we have the same files dates. Mine are dated 2021-5-10 in the WUReports directory, with a version 4.04, except for those without dates that are v. 4.0.

Thanks,

Jim

Errmmm, I might be using a mixture of beta and last download :wink:

wsReports1part.php and wsReportsFreeze.php are both 4.05, wsReportsFunctions.php is 4.01 and the others seem to be 4.00. . .

Which file do you think has the offending code?

wsReports1part is my likely candidate. wsReportsFunctions seems to most convert units and Freeze is unrelated to rain days. PM forthcoming.

Thanks

Jim

Our files are absolutely identical, yet we produce different results. Very weird.

Jim

After considerable bleary-eyed staring at the code, i found, what i think is the problem. Both in wsReportsSum.php (@ line 220) and in wsReportsDaily.php (@ line 198) is the line $value = @arrTotals[1][$k];

arrTotals[1] holds the number data elements in the array (i.e. the number of days in the month) whereas arrTotals[4] holds the number of non-zero data elements.

changing arrTotals from 1 to 4 on those two lines results in correct raindays in all the reports. The seasonal summary had some wildely creative totals, but this change brought everything into line.

Am i having fun yet?

Regards to all

Jim

I still don’t understand why it works for me but not for you. . . even if I’m metric and you’re imperial :wink:

On that uom note, I note that your rainday numbers have 2 decimal places to my one :laughing:

(Found the earlier query at External scripts which use WeatherUnderground .CSV data - #76 by BEAUJOLAIS)

I don’t understand that either. But look at your seasonal total raindays. They don’t look right. I think i remember seeing the decimal place difference somewhere in the unit normalization code which doesn’t differentiate between rainfall and raindays.

I saw that older thread, but didn’t learn much from it.

Regards,

Jim

You’re right, they didn’t :confused:

Probably never looked at them before. . . anyway, can confirm the changes you posted seem to work for me as well :slightly_smiling_face:

Interestingly, raindays in the older version of Reports installed on my 1907 dashboard (access from Menu on 2012_lts) all work fine with $value = $arrTotals[1][$k];

No changes needed.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.