Skip to content

`history` observation type

roe-dl edited this page Jun 7, 2023 · 7 revisions

What it is

The observation type history (with prefix typically ottHistory or thiesHistory) provides a list of the weather conditions reported within the last hour. This list is internally used to determine derived weather codes like 20 to 29 (means: some weather condition within the last hour but not now). It is provided as an observation type for debugging purposes especially. But you can display it, too.

Data structure

Each element of the list is also a list, which contains of the following elements:

Element Description
[0] start timestamp of the weather condition
[1] end timestamp of the weather condition (updated each time, the same weather condition is reported as before)
[2] ww value of the weather condition
[3] wawa value of the weather condition
[4] If this weather condition is precipitation this is the start timestamp of the precipitation. If the weather condition changes during precipitation in intensity or kind, this value is not the same as [0]. If this weather condition is no precipitation the value is None.
[5] w'w' METAR value of the weather condition
[6] intsum, an internal value to calculate average intensity of precipitation during the precipitation period
[7] dursum, an internal value to calculate average intensity of precipitation during the precipitation period
[8] sum of rain rate readings during this weather condition
[9] count of rain rate readings during this weather condition
[10] last value of accumulated or absolute rain of this weather condition

How to display the history table?

If you want to display this list within a skin, you can use the following WeeWX template snippet:

#from weewx.units import ValueTuple, ValueHelper
...
    #if $len($current.ottHistory.raw)>1
    <p>Wetterzustände der letzten Stunde:</p>
    <table class="table-striped">
      <tr>
        <th>Beginn</th>
        <th>Ende</th>
        <th>Dauer</th>
        <th>ww</th>
        <th>w<sub>a</sub>w<sub>a</sub></th>
        <th>w'w'</th>
        <th>Niederschlagsbeginn</th>
      </tr>
      #for $ii in reversed($current.ottHistory.raw)
      #set $start=ValueHelper(ValueTuple($ii[0],'unix_epoch','group_time'),formatter=$station.formatter)
      #set $stop=ValueHelper(ValueTuple($ii[1],'unix_epoch','group_time'),formatter=$station.formatter)
      #set $precipstart=ValueHelper(ValueTuple($ii[4],'unix_epoch','group_time'),formatter=$station.formatter)
      #set $duration=ValueHelper(ValueTuple($ii[1]-$ii[0],'second','group_deltatime'),formatter=$station.formatter)
      <tr>
        <td>$start</td>
        <td>$stop</td>
        <td>
          #if $duration.raw>3600
          $duration.hour
          #else
          $duration.minute
          #end if
        </td>
        <td>
          $('%02d' % ii[2])
          <span style="position:relative;top:4px">$presentweather(ww=$ii[2]).wmo_symbol(width=22)</span>
        </td>
        <td>
          $('%02d' % ii[3])
          <span style="position:relative;top:4px">$presentweather(wawa=$ii[3]).wmo_symbol(width=22)</span>
        </td>
        <td>$ii[5]</td>
        <td>$precipstart</td>
      </tr>
      #end for
    </table>
    <p></p>
    #end if

Example history table: image