Re: Why?

OK...we're trying to create a Gridded1DSet with the units "seconds" for
time. I don't know why it keeps creating units of Kelvin for the set.
Below is the line we use to create validSet:

Gridded1DSet validSet = new Gridded1DSet(wantedMathType, validTimeSet,

wantedMathType is a MathType of the data we want ie. MaxTemp whose units
are Celsius. Am I right in this respect? Do we want wantedMathType to be
"Time" instead of "MaxTemp"? When I did a getSetUnits(), we got "Cel"
which I assume is short for Celsius.

The question is whether the wantedMathType should be the "time" or the
wanted type of the range tuple ie. MaxTemp or MinTemp.

I tried using the other Gridded1DSet constructor like this:

//trying to use the same units as existing field
Unit[] unitArray = flatField.getDomainSet().getSetUnits();
Gridded1DSet validSet = new Gridded1DSet(wantedMathType, validTimeSet,
                                         validTimeSet[0].length, null,
                                         unitArray, null);

This in turn gave me the following exception:

visad.UnitException: Set: Units must be convertable with DomainType
default Units
        at visad.Set.<init>(
        at visad.SimpleSet.<init>(
        at visad.SampledSet.<init>(
        at visad.GriddedSet.<init>(
        at visad.Gridded1DSet.<init>(
        at visad.Gridded1DSet.<init>(
        at progTest.main(

I don't quite understand what this message means. Can someone please
explain? I need to know how to create a set with the right MathType/Units
and then be able to resample it so that MinTemp and MaxTemp use Celsius.

Thanks in advance.


   _--_|\     Eugene Tan <E.Tan@xxxxxxxxxx>
  /      \    AutoTAF Project Developer 
  \_.--.*/    Bureau of Meteorology, Melbourne, VIC 3001, Australia
        v     Telephone: +613 9669 4652

On Mon, 13 Dec 1999, Bill Hibbard wrote:

> This Exception is being thrown when it tries to convert Units
> from 'validSet' to the domain Set of FlatField 'f'.  I am not
> an expert on CDL, but it looks like the domain of 'f' is
> Time with Units 's' (for seconds).  From the UnitException
> message I'd guess that 'validSet' must have Units 'K' (for
> Kelvin).  That is, you are trying to resample a field over
> a time domain to a set of temperature values.  Make sure that
> 'validSet' is a set of times with 's' Units.  You could do
> a print of 'validSet' at this point to see if its Units are
> 'K'.
> Please let me know if still have problems.
> Cheers,
> Bill
> ----------------------------------------------------------
> Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
> hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738

  • Follow-Ups:
  • References: