You can calculate values using the
#set directive in Cheetah. I wondered how to format those values for output, and after some testing I found the following solution. As an example the daylight duration is calculated from sunrise and sunset times:
#from weewx.units import ValueTuple,ValueHelper #set $rising=$almanac.sun.rise.raw
#set $setting=$almanac.sun.set.raw
#set $daylight=$setting-$rising#set $daylight_vh=ValueHelper(ValueTuple($daylight,'second','group_deltatime'),formatter=$station.formatter)
$daylight_vh.format("%(hour)d%(hour_label) %(minute)d%(minute_label)s %(second)d%(second_label)s","").
Is there a better solution?
In skins I see this calculated "by hand" in a series of #set statements.
Is it explained somewhere in the manuals?