Re: [idvusers] Changing unit of FlatField from celsius to meter using Jython

Hi Patrick-

Patrick Koethur wrote:
thanks a lot for the really quick help. newUnit works just fine. I'm scripting some computations with celsius data and want to display the results in a topography display, therefore the unit change.

Okay.  Somewhere on our long TODO list is an item to allow users to
display a field as a topography in the main display without having
to do what you do now.  But that's low on the list at the moment.

One more quick question: I have a FieldImpl containing the data of one variable. How do I get the name of that variable? I've tried rangeType(data.getSample(0)).prettyString(), but that also gives me some additional information about the unit (e.g. 'tho[unit:Celsius]'), which I don't need (I only want to get the 'tho').

You can use ucar.visad.Util.cleanTypeName on the 'tho[unit:Celsius]'
string, which will remove the [unit:Celsius].  tho[unit:Celsius]
is actually the RealType name that we use.

Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307