Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Re: units conversion

Hi Cameron,

> I have created a function that converts the units in a flatfield from
> unit x to unit y (for those components that match unit x). This seems to work
> quite well as I can print out the field and verify the new units and the
> converted data.  (My primary use of this is to convert celcius to kelvin)
> 
> In a number of situations I am making a new flatfield using the same
> function type as the old one (using originalField.getType()) but with a new
> range set.
> 
> However when I do this I find that the new field has reset its units to
> celcius (without converting the data I might add).
> 
> Is this behaviour intended? How can I get around it?

A number of the FlatField constructors take a Unit[] argument
which is used to set the Units for field values.  Specify your
new Units in this argument and it should work.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html

 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690