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?

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/59d5b12b-9083-4cb3-8270-b5d99c337245n%40googlegroups.com.

Reply via email to