roe-dl/weewx-GTS

Unphysical values when some variables not measured

Closed this issue · 7 comments

I recently had a power cut which lost 5 hours of all my meteorological readings. When the power came back, there was a gap in all my readings, as expected, except for outThetaE, which took a value of -5,555,555,573.3 C for the duration of the outage. Exactly 12 hours later, there was another spell of exactly this value for exactly the same length of time, even though there were no missing values during this interval. I have attached a png file to illustrate the effect.
Would it be possible, please, to include a quality check on the calculated value of outThetaE, and just leave a gap if the value falls outside some sort of sensible limits?

outThetaE issue

roe-dl commented

Were there some logging messages along with those values?

I had expected a value of None in this situation, and I am not sure why it isn't returned.

I've got debug = 1 in my weewx.conf but a search on my syslog files on both days on which the unphysical values were generated does not find any errors at all connected with this. My syslog files contain no mention of outThetaE at all and the only mention of GTS is when it is successfully loaded. So I'm afraid I have no information from syslog.

Is there anywhere else you'd like me to check? And would an excerpt from my database file, maybe covering both Friday and Saturday, be of any help? I know the variables generated by GTS aren't stored in there, but it will show the time interval with nothing stored during the power cut, and the values stored in the second interval.

Also worth mentioning is the fact that my Monthly graphs in Belchertown do not have any such problem at all, so it's only in my Week graphs that the problem is apparent.

roe-dl commented

I guess outThetaE or the GTS extension is not required to be included in the message text. Ist there any error message during that period of time? May be, something related to XTYPE or unit conversion?

Yes, I can try to have a look into the database file. May be, there is some glue in it.

The only messages containing a reference to XTYPE is whenever it is successfully loaded.

I've extracted the database starting from 00:00 on Friday until a few minutes ago, then zipped the result; hope that's OK.
weewx.zip

roe-dl commented

Could it be that your hardware provides the barometer reading only, and WeeWX calculates the station pressure from it?

That could explain the 12 hour thing. The algorithm WeeWX uses to calculate the station pressure from the barometer value involves using the readings from 12 hours ago together with the actual readings. Within your database excerpt there is a period of time, where outTemp and outHumidity are both available, but pressure is not.

That is not at all the reason for the bug you uncovered, but it would explain part of the effect.

roe-dl commented

After all, I found out.

The value you saw is -1e10 degrees Celsius, converted to Fahrenheit. So I see you use the max aggregation within your diagram. That, your error description did not say.

The bug comes into effect if there is no single database record within the aggregation period, or one of the observation types is always None within that period.

I will fix it within the next few days.

GTS.py, line 921:

            ...
            elif aggregate_type in ('max','maxtime'):
                val = -1e10
            ...
            _x = (None,None,None)
            for _result in db_manager.genSql(
                ...
            ...
            return weewx.units.ValueTuple(val,_x[1],_x[2])

Excellent; thank you 🙂