We can't seem to convert some units properly. This is what we have:
(in a for loop to print out the original units)
Units:
oldUnits: Cel
oldUnits: Cel
oldUnits: degrees_north
We then change all the Cel (celsius) units to Kelvin by doing this:
Unit[] newUnits = Unit.copyUnitsArray(oldUnits);
Unit toUnit = SI.kelvin;
for (int i=0; i < oldUnits.length; i++) {
if (newUnits[i].toString().equals("Cel")) {
newUnits[i]=toUnit;
}
}
Printing out the new units array:
(in a for loop to print out the new units)
Units:
newUnits: K
newUnits: K
newUnits: degrees_north
We then create a FlatField ie.
FlatField newField
new FlatField((FunctionType) field.getType(),
field.getDomainSet(),
null,
null,
field.getRangeSets(),
newUnits);
When I printed out the contents of newField, this is the output I get:
Component: 0 Type: MinTemp Value: NaN Units: Cel
Component: 1 Type: MaxTemp Value: NaN Units: Cel
Component: 2 Type: WindDir Value: NaN Units: degrees_north
which is wrong. We want to convert the units for Component 0 & 1 to
Kelvin but it keeps returning "Cel". Can anyone identify what we're doing
wrong please?
Eug.
_--_|\ Eugene Tan <E.Tan@xxxxxxxxxx>
/ \ AutoTAF Project Developer
\_.--.*/ Bureau of Meteorology, Melbourne, VIC 3001, Australia
v Telephone: +613 9669 4652