Example #1
0
def setup():
    # Set/reset to the default values
    global accum_dict
    accum_dict = ListOfDicts(defaults_dict['Accumulator'].dict())
Example #2
0
        merger = avg
        extractor = noop
    [[windSpeed2]]
        extractor = last
    [[windSpeed10]]
        extractor = last
    [[yearET]]
        extractor = last
    [[yearRain]]
        extractor = last
    [[lightning_strike_count]]
        extractor = sum
"""
defaults_dict = configobj.ConfigObj(StringIO(DEFAULTS_INI), encoding='utf-8')

accum_dict = ListOfDicts(defaults_dict['Accumulator'].dict())


class OutOfSpan(ValueError):
    """Raised when attempting to add a record outside of the timespan held by an accumulator"""


# ===============================================================================
#                             ScalarStats
# ===============================================================================

class ScalarStats(object):
    """Accumulates statistics (min, max, average, etc.) for a scalar value.
    
    Property 'last' is the last non-None value seen. Property 'lasttime' is
    the time it was seen. """
Example #3
0
import time
import xml.etree.ElementTree as ET

import weecfg
import weeutil
import weewx
import weewx.drivers
import weewx.units
import weewx.wxformulas
from weeutil.weeutil import ListOfDicts

DRIVER_NAME = 'XmlParse'
DRIVER_VERSION = '0.1.0'
SUPPORTED_TIMEZONES = ('GMT', 'UTC')
CONV_FUNCS = ListOfDicts({'Degrees F': weewx.units.FtoC,
                          'km/h': weewx.units.conversionDict['km_per_hour']['meter_per_second'],
                          'hPa': weewx.units.conversionDict['hPa']['mbar']})

if weewx.__version__ < "3":
    raise weewx.UnsupportedFeature("WeeWX 3.x or greater is required, found %s" %
                                   weewx.__version__)


class MissingOption(StandardError):
    """Exception thrown when a mandatory option is invalid or otherwise has not
    been included in a config stanza."""


def logmsg(dst, msg):
    syslog.syslog(dst, 'xmlparse: %s' % msg)