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.

Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738

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