mirror of
https://github.com/weewx/weewx.git
synced 2026-04-18 16:46:56 -04:00
commit 5023ea5acdee7b7698d3f9e59118711503bbb2ab Author: Tom Keffer <tkeffer@gmail.com> Date: Sun Oct 18 04:38:05 2020 -0700 Suggest more xtypes examples. commit 3c8b0e77c4a0c5163bde5df513f5eda37eac9853 Author: Tom Keffer <tkeffer@gmail.com> Date: Sat Oct 17 08:07:31 2020 -0700 Added sample image of vapor_p. Added comment about ordering matters. commit 9ebc989d702f66249f6caafbd9ba1e9739eb42d4 Author: Tom Keffer <tkeffer@gmail.com> Date: Sat Oct 17 06:15:18 2020 -0700 XType class Delta can now use the same cumulative type more than once. Added tests. commit 47857d83817a4fb32ab645245239cf5a56c65b19 Author: Tom Keffer <tkeffer@gmail.com> Date: Fri Oct 16 16:29:18 2020 -0700 Added XType 'Delta', for calculating differences from cumulative totals. commit bb8a07bd3e828f7cd7f20660c8702370151bbb96 Author: Tom Keffer <tkeffer@gmail.com> Date: Fri Oct 16 12:11:01 2020 -0700 Reformat xtypes documentation. Finishes fix for issue #491. commit a27d6e1dbdee272c2a2b22bb58d162cbb7472049 Author: Tom Keffer <tkeffer@gmail.com> Date: Fri Oct 16 12:09:33 2020 -0700 Upgrade now adds new service group xtypes_services. Update tests to follow. commit 611dbc60d0908294ae268019c48f2ca7693f0615 Author: Tom Keffer <tkeffer@gmail.com> Date: Fri Oct 16 09:11:47 2020 -0700 No heat index for temperatures under 40F. commit fe9e60818295fcc8386501425b259ea2111005d7 Author: Tom Keffer <tkeffer@gmail.com> Date: Fri Oct 16 08:22:37 2020 -0700 Update comments on get_series() commit 14f3a15cd7df2e64674d794fb375cc7e807ad91a Author: Tom Keffer <tkeffer@gmail.com> Date: Fri Oct 16 08:12:03 2020 -0700 Add a version of get_series() that works for xtypes. Document it. Include vaporpressure.py in the examples subdirectory. commit 0995f772e6b204b13c60af42681fdb2e54ab200b Author: Tom Keffer <tkeffer@gmail.com> Date: Thu Oct 15 17:07:52 2020 -0700 More details about how to write an xtypes extension. commit 1e1dce3a29f211944230119078e0108502f8f706 Author: Tom Keffer <tkeffer@gmail.com> Date: Thu Oct 15 17:07:10 2020 -0700 Add threading lock to RainRater. commit bed387de5913e42291045b4780e8110c15229b73 Author: Tom Keffer <tkeffer@gmail.com> Date: Thu Oct 15 04:49:59 2020 -0700 Update and improve the xtypes documentation. commit dc4f488d17a4aeaa9b9d604c500f7063c044a0af Author: Tom Keffer <tkeffer@gmail.com> Date: Thu Oct 15 04:49:31 2020 -0700 Add service group xtype_services to weewx.conf. commit 6f29b1a23d60189b07efae4d4ea160079eb973e8 Author: Tom Keffer <tkeffer@gmail.com> Date: Wed Oct 14 13:31:43 2020 -0700 It's OK for direction to be none, provided speed is zero commit 034be1c968dd0bc33791d4f6559c15c7e28b6364 Author: Tom Keffer <tkeffer@gmail.com> Date: Wed Oct 14 13:31:21 2020 -0700 Check to make sure the section [Engine][[Services]] exists commit 8cf2b3e372d1b9da948ef6caa27aadb721308850 Author: Tom Keffer <tkeffer@gmail.com> Date: Wed Oct 14 08:24:13 2020 -0700 Separate StdService from XType functionality. Makes XType functionality useful outside the context of WeeWX services. Simplifies test suites. commit 9325e792cafa0a885f529ac15636202d518a9c61 Author: Tom Keffer <tkeffer@gmail.com> Date: Wed Oct 14 08:23:07 2020 -0700 Class DummyEngine derives from Engine. commit 7ac31f7bd2b80c61792e0f3a5f0293ec1eb0666b Author: Tom Keffer <tkeffer@gmail.com> Date: Sat Oct 10 16:26:19 2020 -0700 Made it easier to add new, derived types via StdWXCalculate. See issue #491.
104 lines
3.3 KiB
Python
Executable File
104 lines
3.3 KiB
Python
Executable File
#!/usr/bin/env python
|
|
#
|
|
# Copyright (c) 2009-2020 Tom Keffer <tkeffer@gmail.com>
|
|
#
|
|
# See the file LICENSE.txt for your rights.
|
|
#
|
|
"""Executable that can run all reports."""
|
|
|
|
from __future__ import absolute_import
|
|
from __future__ import print_function
|
|
|
|
import optparse
|
|
import socket
|
|
|
|
# Although this import is not used, it's important to execute any user extensions before starting.
|
|
import user.extensions
|
|
import weecfg
|
|
import weeutil.logger
|
|
import weewx.engine
|
|
import weewx.manager
|
|
import weewx.reportengine
|
|
import weewx.station
|
|
from weeutil.weeutil import timestamp_to_string
|
|
|
|
description = """Run all reports defined in the specified configuration file.
|
|
Use this utility to run reports immediately instead of waiting for the end of
|
|
an archive interval."""
|
|
|
|
usage = """%prog: [config_file] [timestamp] [--config=CONFIG_FILE] [--help]"""
|
|
|
|
|
|
def disable_timing(section, key):
|
|
"""Function to effectively disable report_timing option"""
|
|
if key == 'report_timing':
|
|
section['report_timing'] = "* * * * *"
|
|
|
|
|
|
def main():
|
|
# Set defaults for logging:
|
|
weeutil.logger.setup('wee_reports', {})
|
|
|
|
# Create a command line parser:
|
|
parser = optparse.OptionParser(description=description, usage=usage)
|
|
|
|
# Add the various options:
|
|
parser.add_option("--config", dest="config_path", type=str, metavar="CONFIG_FILE",
|
|
help="Use the configuration file CONFIG_FILE")
|
|
|
|
# Now we are ready to parse the command line:
|
|
options, args = parser.parse_args()
|
|
config_path, config_dict = weecfg.read_config(options.config_path, args)
|
|
print("Using configuration file %s" % config_path)
|
|
|
|
# For wee_reports we want to generate all reports irrespective of any
|
|
# report_timing settings that may exist. The easiest way to do this is walk
|
|
# the config dict resetting any report_timing settings found.
|
|
config_dict.walk(disable_timing)
|
|
|
|
# Look for the debug flag. If set, ask for extra logging
|
|
weewx.debug = int(config_dict.get('debug', 0))
|
|
|
|
# Set final configuration for logging:
|
|
weeutil.logger.setup('wee_reports', config_dict)
|
|
|
|
socket.setdefaulttimeout(10)
|
|
|
|
# Instantiate the dummy engine. This will cause services to get loaded, which will make
|
|
# the type extensions (xtypes) system available.
|
|
engine = weewx.engine.DummyEngine(config_dict)
|
|
|
|
stn_info = weewx.station.StationInfo(**config_dict['Station'])
|
|
|
|
# If the user specified a time, retrieve it. Otherwise, set to None
|
|
gen_ts = int(args[0]) if args else None
|
|
|
|
if gen_ts is None:
|
|
print("Generating for all time")
|
|
else:
|
|
print("Generating for requested time %s" % timestamp_to_string(gen_ts))
|
|
|
|
try:
|
|
binding = config_dict['StdArchive']['data_binding']
|
|
except KeyError:
|
|
binding = 'wx_binding'
|
|
|
|
# Retrieve the appropriate record from the database
|
|
with weewx.manager.DBBinder(config_dict) as db_binder:
|
|
db_manager = db_binder.get_manager(binding)
|
|
if gen_ts:
|
|
ts = gen_ts
|
|
else:
|
|
ts = db_manager.lastGoodStamp()
|
|
|
|
record = db_manager.getRecord(ts)
|
|
|
|
t = weewx.reportengine.StdReportEngine(config_dict, stn_info, record=record, gen_ts=gen_ts)
|
|
|
|
# Although the report engine inherits from Thread, we can just run it in the main thread:
|
|
t.run()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|