If you are using weewx tags it would be something like
$current.outTemp.format("%.1f") for one decimal place

On Sunday, 26 April 2020 07:54:54 UTC+3, gjr80 wrote:
>
> Rich,
>
> How you format data in a Cheetah generated report really depends on the 
> source of the data. If you are using a WeeWX generated tag, eg 
> $current.outTemp, then you have all the formatting and unit conversion 
> options of a WeeWX tag available to you (as linked by Tom). If the data 
> comes from some inline python in your Cheetah template then you are 
> responsible for formatting the data, for example, if your template had the 
> following:
>
> #set $pie_temperature = 22/7
>
> and you wanted to use $pie_temperature in your template then you would be 
> responsible for formatting the output, you might do something like:
>
> #set $pie_temperature_2d = round($pie_temperature, 2)
>
> and then use $pie_temperature_2d to display $pie_temperature to two 
> decimal places (or you might just have used #set $pie_temperature = 
> round(22/7, 2) up front). Bottom line is, formatting/unit conversion etc 
> is your problem, not WeeWX'
>
> If your data comes from a Search List Extension (SLE) then it depends on 
> what the SLE provides. Let's say the SLE provides a tag $pie_temp that is 
> a temperature. If $pie_temp is just a number then just like 
> $pie_temperature you need to format it yourself. However, is the SLE is a 
> little more sophisticated and provides $pie_temp as a special WeeWX 
> object known as a ValueHelper, then $pie_temp has all of the formatting 
> and unit conversion abilities of a WeeWX tag such as $current.outTemp. 
> Generally speaking it is quite easy to have a SLE return a ValueHelper(), 
> whilst it does make the SLE code a little more complex it provides for a 
> much more flexible output. 
>
> At the end of the day a SLE does not allow formatting per se, rather it is 
> the type of output from a SLE that determines what formatting/unit 
> conversion is available. Have a read of the section Defining new tags 
> <http://weewx.com/docs/customizing.htm#defining_new_tags> in the 
> Customization Guide, it covers ValueHelpers and SLEs with examples.
>
> Gary
>
> On Sunday, 26 April 2020 14:29:11 UTC+10, rich T wrote:
>>
>> Thanks I tried your suggestions, but still does not round to the decimal 
>> point. I did create a new tag. Do I need to create a new search list 
>> extension to allow formatting?
>>
>> Thanks 
>> Rich
>>
>>
>>

-- 
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/d198e5e0-dca1-4c2b-b5eb-eda02b5316e9%40googlegroups.com.

Reply via email to