StdWXCalculate no longer calculates anything by default.

Instead, types must be listed in weewx.conf.
Also, swallow any database exceptions.
This commit is contained in:
Tom Keffer
2020-03-15 08:08:43 -07:00
parent 17ebe0d3a3
commit b884c968a7
4 changed files with 40 additions and 31 deletions

View File

@@ -1,10 +1,5 @@
# To do
Remove default calculations from `[StdWXCalculate]`. Instead, they must be
listed in `weewx.conf`.
Swallow any exceptions that occur in `RainRater._setup()`
Right now, if a user is doing software record generation, record augmentation
from the accumulators gets done twice: once in the software catch up,
then again in `StdArchive.new_archive_record()`.

View File

@@ -45,21 +45,21 @@ DEFAULTS_INI = """
[[Calculations]]
# Order matters! Type 'pressure' must come before 'altimeter' and 'barometer'
pressure = prefer_hardware
altimeter = prefer_hardware
appTemp = prefer_hardware
barometer = prefer_hardware
beaufort = prefer_hardware
cloudbase = prefer_hardware
dewpoint = prefer_hardware
ET = prefer_hardware
heatindex = prefer_hardware
humidex = prefer_hardware
inDewpoint = prefer_hardware
maxSolarRad = prefer_hardware
rainRate = prefer_hardware
windchill = prefer_hardware
windrun = prefer_hardware
# pressure = prefer_hardware
# altimeter = prefer_hardware
# appTemp = prefer_hardware
# barometer = prefer_hardware
# beaufort = prefer_hardware
# cloudbase = prefer_hardware
# dewpoint = prefer_hardware
# ET = prefer_hardware
# heatindex = prefer_hardware
# humidex = prefer_hardware
# inDewpoint = prefer_hardware
# maxSolarRad = prefer_hardware
# rainRate = prefer_hardware
# windchill = prefer_hardware
# windrun = prefer_hardware
[[Algorithms]]
altimeter = aaASOS
maxSolarRad = RS
@@ -660,11 +660,15 @@ class RainRater(weewx.xtypes.XType):
if self.rain_events is None:
self.rain_events = []
start_ts = stop_ts - self.retain_period
# Get all rain events since the window start from the database
for row in db_manager.genSql("SELECT dateTime, usUnits, rain FROM %s "
"WHERE dateTime>? AND dateTime<=?;"
% db_manager.table_name, (start_ts, stop_ts)):
# Unpack the row:
time_ts, unit_system, rain = row
self.add_loop_packet({'dateTime': time_ts, 'usUnits': unit_system, 'rain': rain},
db_manager)
# Get all rain events since the window start from the database. Put it in
# a 'try' block because the database may not have a 'rain' field.
try:
for row in db_manager.genSql("SELECT dateTime, usUnits, rain FROM %s "
"WHERE dateTime>? AND dateTime<=?;"
% db_manager.table_name, (start_ts, stop_ts)):
# Unpack the row:
time_ts, unit_system, rain = row
self.add_loop_packet({'dateTime': time_ts, 'usUnits': unit_system, 'rain': rain},
db_manager)
except weedb.DatabaseError as e:
log.debug("Database error while initializing rainRate: '%s'" % e)

View File

@@ -133,6 +133,9 @@ line 'sudo weewxd'.
Use correct log path for netbsd and openbsd in logger setup.
StdWXCalculate no longer calculates anything by default. Instead, types
to be calculated must be listed in weewx.conf.
3.9.2 07/14/2019

View File

@@ -466,13 +466,20 @@ version = 4.0.0b16
# otherwise use value calculated by weewx
pressure = prefer_hardware
barometer = prefer_hardware
altimeter = prefer_hardware
windchill = prefer_hardware
heatindex = prefer_hardware
appTemp = prefer_hardware
barometer = prefer_hardware
beaufort = prefer_hardware
cloudbase = prefer_hardware
dewpoint = prefer_hardware
ET = prefer_hardware
heatindex = prefer_hardware
humidex = prefer_hardware
inDewpoint = prefer_hardware
maxSolarRad = prefer_hardware
rainRate = prefer_hardware
windchill = prefer_hardware
windrun = prefer_hardware
##############################################################################