Re: unit conversion in VisAD


Stuart Wier wrote:
> Making some computations in VisAD, for example in part
> dtdp = (FlatField) (dtdp.multiply( ((FlatField)absvor.getSample(i))) );
> The results have values such as .002 and "units" 0.001 K m2 s-1 kg-1.
> How can I get the results to have value 2 and "units" 0.000001 K m^2 s-1 kg-1?
> Or values 2E-6 and units K m^2 s-1 kg-1?

You could create a new ScaledUnit:

  ScaledUnit su = new ScaledUnit(1000, oldUnit)

where oldUnit is the unit you had.  If you just want the
displayed data to show that, then call 
ScalarMap.setOverrideUnit(su).  That will not change the
data, just the display.  The labelling using 2E-6 would
probably have to be done manually.

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

  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: