Dear anyone,
We seem to have a new problem that we can't figure out:
I keep getting this stack trace whenever I run my program:
java.lang.ArrayIndexOutOfBoundsException: 3
at visad.FlatField.resample(FlatField.java:3252)
at
au.gov.bom.aifs.autotaf.DataRepresentation.FieldManipulation.interpolateProjection(FieldManipulation.java:268)
at
au.gov.bom.aifs.autotaf.DataRepresentation.FieldManipulation.interpolateField(FieldManipulation.java:308)
at
au.gov.bom.aifs.autotaf.DataRepresentation.VisadForecastDataSet.resample(VisadForecastDataSet.java:663)
at progTest.main(progTest.java:13)
I've narrowed down the problem to the NetCDF file. The first file looks
like this (this one doesn't work!):
netcdf taf {
dimensions:
Time = unlimited;
variables:
double Time(Time);
Time:units = "seconds";
double MinTemp(Time);
MinTemp:long_name = "minimumTemperature";
MinTemp:units = "celsius";
double MaxTemp(Time);
MaxTemp:long_name = "maximumTemperature";
MaxTemp:units = "celsius";
double WindDirection(Time);
WindDirection:units = "degree_north";
data:
Time = 0, 10800, 21600, 32400, 43200, 54000,
64800, 75600, 86400, 97200, 108000,
118800, 129600, 140400, 151200, 162000;
MinTemp = 1,-14,NaN,23,18,20,23,30,31,31,31,21,18,21,NaN,NaN;
MaxTemp = 30,22,20,25,25,30,25,37,NaN,39,33,29,27,40,NaN,NaN;
WindDirection
NaN,20,NaN,NaN,NaN,20,NaN,NaN,NaN,NaN,NaN,20,NaN,NaN,NaN,NaN;
}
We modified the file to this by changing some of the values and
replacing the NaN in the middle of MaxTemp and now it works! Can anyone
spot what the problem is please?
netcdf taf {
dimensions:
Time = unlimited;
variables:
double Time(Time);
Time:units = "seconds";
double MinTemp(Time);
MinTemp:long_name = "minimumTemperature";
MinTemp:units = "celsius";
double MaxTemp(Time);
MaxTemp:long_name = "maximumTemperature";
MaxTemp:units = "celsius";
double WindDirection(Time);
WindDirection:units = "degree_north";
data:
Time = 0, 10800, 21600, 32400, 43200, 54000,
64800, 75600, 86400, 97200, 108000,
118800, 129600, 140400, 151200, 162000;
MinTemp
1,-14,NaN,23,18.5,20,23,30,31,31,31,21,18,21,NaN,NaN;
MaxTemp
30,22,20,25,25,30.12,25,37,38,39,33,29,27,40,NaN,NaN;
WindDirection
NaN,23,NaN,NaN,NaN,20,NaN,NaN,NaN,NaN,NaN,20,NaN,NaN,NaN,NaN;
}
At line 263 of FieldManipulation.java, the source looks like this:
//create an irregular set for prediction because the values may not be
//uniform
Irregular1DSet predictedSet = new Irregular1DSet(domainName, time);
//interpolation process start here
f = (FieldImpl)f.resample(predictedSet, mode, Data.INDEPENDENT);
//domainName = "Time"
//time = array of doubles
It crashes out when I do the resample but I don't know what the problem
is. It seems to happen only with the first file but not with any other
file I've tried today.
Thanks in advance.
Eug.
_--_|\ Eugene Tan <E.Tan@xxxxxxxxxx>
/ \ AutoTAF Project Developer
\_.--.*/ Bureau of Meteorology, Melbourne, VIC 3001, Australia
v Telephone: +613 9669 4652