Hi
My weather station just had a rain overflow event which was logged however the rainfall that caused the overflow was not recorded in the hourly data (its in the raw). The relevant code is shown below
def add_raw(self, data):
idx = data['idx']
self.wind_fil.add(data)
wind_gust = data['wind_gust']
if wind_gust is not None and wind_gust > self.wind_gust[0]:
self.wind_gust = (wind_gust, idx)
rain = data['rain']
if rain is not None:
if self.last_rain is not None:
diff = rain - self.last_rain
if diff < -0.001:
logger.warning(
'%s rain reset %.1f -> %.1f', str(idx), self.last_rain, rain)
At this point the rainfall causing the overflow is not recorded as the self.rain variable is only updated by the else clause which doesn't get executed in this scenario
Something like self.rain += self.last_rain - abs(diff) maybe required here
elif diff > float(data['delay'] * 5):
# rain exceeds 5mm / minute, assume corrupt data and ignore it
logger.warning(
'%s rain jump %.1f -> %.1f', str(idx), self.last_rain, rain)
else:
self.rain += max(0.0, diff)
self.last_rain = rain
# copy some current readings
if 'illuminance' in data and not 'illuminance' in self.copy_keys:
self.copy_keys.append('illuminance')
self.copy_keys.append('uv')
# if already have data to return, ignore 'lost contact' readings
if data['temp_out'] is not None or not self.retval:
for key in self.copy_keys:
self.retval[key] = data[key]
Cheers
Paul