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

Re: Why?

Can anyone please explain why the resample method in FieldImpl keeps
trying to convert the units for our variables? This is what the CDL file
looks like before it's converted into netCDF:

netcdf taf {
  dimensions:
    Time = unlimited;
  variables:
    double Time(Time);
    double MinTemp(Time);
      MinTemp:long_name = "minimumTemperature";
      MinTemp:units = "celsius";
    double MaxTemp(Time);
      MaxTemp:long_name = "maximumTemperature";
      MaxTemp:units = "celsius";
  data:
      Time = 0, 10800, 21600, 32400, 43200, 54000, 64800, 75600, 86400,
             97200, 108000, 118800, 129600, 140400, 151200, 162000;
      MinTemp = NaN,NaN,37,23,30,32,NaN,30,31,31,31,31,18.2,21.1,NaN,NaN;
      MaxTemp = NaN,20,25,29,29,26,22,20,18,18,21,25,24,NaN,NaN,NaN;
}

The program throws an exception at this line:

predictedField = (FieldImpl)f.resample(validSet, Data.NEAREST_NEIGHBOR,
                                       Data.INDEPENDENT);

This is what we get from printStackTrace(): 

visad.UnitException: Attempt to convert from unit "K" to unit "s"
        at visad.DerivedUnit.toThis(DerivedUnit.java:653)
        at visad.ScaledUnit.toThis(ScaledUnit.java:445)
        at visad.OffsetUnit.toThis(OffsetUnit.java:338)
        at visad.OffsetUnit.toThis(OffsetUnit.java:375)
        at visad.Unit.toThis(Unit.java:437)
        at visad.Unit.transformUnits(Unit.java:142)
        at
visad.CoordinateSystem.transformCoordinates(CoordinateSystem.java:334)
        at visad.FlatField.resample(FlatField.java:3198)
        at
au.gov.bom.aifs.autotaf.DataRepresentation.FieldManipulation.interpolateProjection(FieldManipulation.java:206)
        at
au.gov.bom.aifs.autotaf.DataRepresentation.FieldManipulation.interpolateField(FieldManipulation.java:252)
        at progTest.main(progTest.java:35)

If we remove all the units from our CDL file, it works fine. We've also
tried using "kelvin" instead of "celsius" but ended up with the same
results. We've been trying to find a way to fix this up but have come to a
dead end. Can someone please help?

Thanks.

Eug.

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






 
 
  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