Hallo 

Ich habe eine Frage. wie kann ich den Code aus WeewxWD für die Ermittlung 
der "dry" und "wet" Tage für Frost (outTemp.min <0) bzw Eistage 
(outTemp.max<0)  verwenden?

weewx-wd 
<https://bitbucket.org/ozgreg/weewx-wd/src/110688ada0c6?at=v1.2.0_development> 
/ bin 
<https://bitbucket.org/ozgreg/weewx-wd/src/110688ada0c6/bin/?at=v1.2.0_development>
 
/ user 
<https://bitbucket.org/ozgreg/weewx-wd/src/110688ada0c6/bin/user/?at=v1.2.0_development>
 
/ wdSearchX3.py

        # Get our year stats vectors
        _rain_vector = []
        _time_vector = []
        for tspan in weeutil.weeutil.genDaySpans(_mn_first_of_year_ts, 
timespan.stop):
            _row = db_lookup().getSql("SELECT dateTime, sum FROM 
archive_day_rain WHERE dateTime >= ? AND dateTime < ? ORDER BY dateTime", 
(tspan.start, tspan.stop))
            if _row is not None:
                _time_vector.append(_row[0])
                _rain_vector.append(_row[1])
        # Get our run of year dry days
        _interim = []   # List to hold details of any runs we might find
        _index = 0      # Placeholder so we can track the start dateTime of any 
runs
        # Use itertools groupby method to make our search for a run easier
        # Step through each of the groups itertools has found
        for k,g in itertools.groupby(_rain_vector):
            _length = len(list(g))
            if k == 0:  # If we have a run of 0s (ie no rain) add it to our
                        # list of runs
                _interim.append((k, _length, _index))
            _index += _length
        if _interim != []:
            # If we found a run (we want the longest one) then get our results
            (_temp, _year_dry_run, _position) = max(_interim, key=lambda a:a[1])
            # Our 'time' is the day the run ends so we need to add on run-1 days
            _year_dry_time_ts = _time_vector[_position] + (_year_dry_run - 1) * 
86400
        else:
            # If we did not find a run then set our results accordingly
            _year_dry_run = 0
            _year_dry_time_ts = None


das unter Verwendung von archive_day_rain die Tabelle archive_day_outTemp 
verwendet wird um die Anzahl der Tage outTemp < 0.0 °C zu bestimmen

mein Versuch:
        # Get our year stats vectors
        _outTemp_vector = []
        _time_vector = []
        for tspan in weeutil.weeutil.genDaySpans(_mn_first_of_year_ts, 
timespan.stop):
            _row = db_lookup().getSql("SELECT dateTime, min FROM 
archive_day_outTemp WHERE dateTime >= ? AND dateTime < ? ORDER BY dateTime", 
(tspan.start, tspan.stop))
            if _row is not None:
                _time_vector.append(_row[0])
                _outTemp_vector.append(_row[1])
        # Get our run of year min0 days
        _interim = []   # List to hold details of any runs we might find
        _index = 0      # Placeholder so we can track the start dateTime of 
any runs
        # Use itertools groupby method to make our search for a run easier
        # Step through each of the groups itertools has found
        for k,g in itertools.groupby(_outTemp_vector):
            _length = len(list(g))
            if k < 0:   # If we have a run of les then 0 degree C (ie no 
outTemp) add it to our
                        # list of runs
                _interim.append((k, _length, _index))
            _index += _length
        if _interim != []:
            # If we found a run (we want the longest one) then get our 
results
            (_temp, _year_minE_run, _position) = max(_interim, key=lambda a:
a[1])
            # Our 'time' is the day the run ends so we need to add on run-1 
days
            _year_minE_time_ts = _time_vector[_position] + (_year_minE_run - 
1) * 86400
            _year_minS_time_ts = _year_minE_time_ts - (86400 * 
_year_minE_run)
        else:
            # If we did not find a run then set our results accordingly
            _year_minE_run = 0
            _year_minE_time_ts = None
            _year_minS_time_ts = None


unter https://github.com/hes19073/hesweewx/blob/master/bin/user/xfrostday.py

mein Versuch. Es werden jedoch nicht alle Frost bzw. Eistage richtig 
ermittelt.
Gruss und Danke
Hartmut

Reply via email to