[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IDV #FEO-270734]: Units when using an expression in a LayoutModel parameter



> Hi Jeff....
> 
> So, if he has a formula that depends on the units, I will recommend
> that he make a formula, and then he could use an expression like:
> 
> def conv(t):
> k = 2. * t.getValue(makeUnit("degF"))
> 
> The only problem with this is that when I invoke the formula in the
> Layout Model, the display seems to ignore the "Format" -- I used
> "###0.0" but the values displayed are things like
> 48.15199999999999....
> 
> Perhaps there is a better way to approach this?
> 

We create a format jython procedure that formats the value using the format 
field
from the layout model glyph.

In the user guide:
http://www.unidata.ucar.edu/software/idv/docs/userguide/tools/StationModelEditor.html
Look for:
>This will result in the calculation of T-TD, a conversion of that result to a 
>string which is >then concatenated to the string 'TD:'. If you want to format 
>the result of the numeric >calculation using the format specifier from the 
>properties dialog simply enter:
>
>='TD:'+format(T-TD)

-Jeff




Ticket Details
===================
Ticket ID: FEO-270734
Department: Support IDV
Priority: Normal
Status: Closed