Hi,

Sorry for questions but .Im a newbie

 
Don't worry, we all started like that, somewhere.

As you just want to display Apparent Temperature on a weewx generated page 
that means we have a few options. You could write a Search List Extension 
that calculates Apparent Temperature and would ultimately let you just use 
something like $appTemp in you template to display Apparent Temperature 
with all the unit conversion and formatting capabilities that weewx 
provides. Secondly, you could embed some python in your template to do the 
calculations through a few calls to the weewx 'API'. This means we can 
still make use of the weewx unit conversion and formatting capabilities. 
The third approach is to calculate out the Apparent Temperature formula in 
some python code in the template but you would then need to manually format 
your results. I will cover the second approach as it is probably the 
simplest in to implement and still provides us with unit 
conversion/formatting.

You could place the following code in your template somewhere before you 
want to use the Apparent temperature tag:

#import math
#from weewx.wxformulas import apptempC
#from weewx.units import ValueHelper
#if $varExists('current.outTemp') and $current.outTemp.raw is not None and 
$varExists('current.outHumidity') and $current.outHumidity.raw is not None 
and $varExists('current.windSpeed') and $current.windSpeed.raw is not None
    #set $Ta = $current.outTemp.degree_C.raw
    #set $rh = $current.outHumidity.raw
    #set $ws = $current.windSpeed.meter_per_second.raw
    #set $appTemp_C = apptempC($Ta, $rh, $ws)
    #set $appTemp = ValueHelper(($appTemp_C, "degree_C", 
"group_temperature"))
#else
    #set $appTemp = ValueHelper((None, "degree_C", "group_temperature"))
#end if    

you could then use $appTemp to display Apparent Temperature with a units 
label converted to the units you specified in your skin.conf. 
$appTemp.degree_F would always display in F, $appTemp.formatted would 
display the value without a label. You essentially have the freedom to use 
all of the weewx unit conversion and formatting capabilities.

Gary




-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to