This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Adityarajsingh Santokhee wrote:
Hello, I am trying to read a variable's data from a GRIB file. The read(java.util.List section) function is giving an array out of bounds error message for any section apart from the whole range. Are there any workarounds to this problem or should I load whole data for that variable and then do subsetting. Thismight be a problem if I have to read hundred's of files.Error Message: java.lang.ArrayIndexOutOfBoundsException: 4 at ucar.ma2.ArrayFloat.setFloat(ArrayFloat.java:193) at ucar.ma2.IteratorFast.setFloatNext(IteratorFast.java:61) at ucar.nc2.iosp.grib.GribServiceProvider.readXY(GribServiceProvider.java:177) at ucar.nc2.iosp.grib.GribServiceProvider.readLevel(GribServiceProvider.java:150) at ucar.nc2.iosp.grib.GribServiceProvider.readData(GribServiceProvider.java:134) at ucar.nc2.NetcdfFile.readData(NetcdfFile.java:848) at ucar.nc2.Variable._read(Variable.java:737) at ucar.nc2.Variable.read(Variable.java:451) at ucar.nc2.dataset.VariableDS._read(VariableDS.java:206) at ucar.nc2.Variable.read(Variable.java:451) at ucar.nc2.dataset.VariableDS._read(VariableDS.java:206) at ucar.nc2.Variable.read(Variable.java:475) at Test2netcdf.readData(Test2netcdf.java:76) at Test2netcdf.main(Test2netcdf.java:128) Cheers, Adit. ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
Hi Adit:send us the file or URL to the file so we can try to reproduce the problem. also, what version of jar file are you using ? (see README inside it)