[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDFJava #MJV-516900]: StringIndexOutOfBoundsException when converting Grib2 to NetCDF



Hi Edward:

Thanks, Ill get a fix for this. A workaround for now is to give the input file 
a absolute path.

John

> Full Name: Edward Glen
> Email Address: address@hidden
> Organization: MetService New Zealand
> Package Version: 4.3
> Operating System: Ubuntu 10.04
> Hardware:
> Description of problem: Hi,
> 
> I was testing the pre-alpha 4.3 (22/11/2011) release of netCDF and
> tried converting the attached grib2 file (from Environment Canada:
> http://www.weatheroffice.gc.ca/grib/grib2_glb_HR_e.html) using the
> following command:
> 
> java -classpath ~/netcdfAll-4.3.jar ucar.nc2.dataset.NetcdfDataset -in 
> CMC_glb_VGRD_TGL_10_latlon.6x.6_2011120400_P051.grib2 -out test.nc
> 
> And encountered the following stack trace:
> 
> Exception in thread "main" java.io.IOException:
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> 
> at 
> ucar.nc2.grib.grib2.Grib2CollectionBuilder.<init>(Grib2CollectionBuilder.java:107)
> at 
> ucar.nc2.grib.grib2.Grib2CollectionBuilder.createFromSingleFile(Grib2CollectionBuilder.java:64)
> at ucar.nc2.grib.GribIndex.makeCollection(GribIndex.java:77)
> at ucar.nc2.grib.grib2.Grib2Iosp.open(Grib2Iosp.java:225)
> at ucar.nc2.NetcdfFile.<init>(NetcdfFile.java:1458)
> at ucar.nc2.NetcdfFile.open(NetcdfFile.java:860)
> at ucar.nc2.NetcdfFile.open(NetcdfFile.java:497)
> at ucar.nc2.dataset.NetcdfDataset.openOrAcquireFile(NetcdfDataset.java:694)
> at ucar.nc2.dataset.NetcdfDataset.openFile(NetcdfDataset.java:566)
> at ucar.nc2.dataset.NetcdfDataset.main(NetcdfDataset.java:1678)
> Caused by: java.lang.StringIndexOutOfBoundsException: String index out of 
> range: -1
> at java.lang.String.substring(String.java:1949)
> at thredds.inventory.CollectionSpecParser.<init>(CollectionSpecParser.java:93)
> at 
> thredds.inventory.DatasetCollectionMFiles.<init>(DatasetCollectionMFiles.java:112)
> at 
> thredds.inventory.DatasetCollectionMFiles.open(DatasetCollectionMFiles.java:85)
> at 
> ucar.nc2.grib.grib2.Grib2CollectionBuilder.<init>(Grib2CollectionBuilder.java:99)
> ... 9 more
> 
> The same file can be handled without problems by the 4.2 version of 
> netCDF-Java.
> 
> Cheers,
> -Edward
> 
> 


Ticket Details
===================
Ticket ID: MJV-516900
Department: Support netCDF Java
Priority: Normal
Status: Open