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

Re: Data from Lat Lon in 4.3 (John Caron)

i think its a bug that i thought i fixed. try giving it an absolute path for the filename.

On 2/27/2012 7:59 AM, Cameron Fraser wrote:
Thanks for the response.
There must be something off with my setup, I cannot even open a grib file. The same file will open using the toolsui.
Version is 4.3.9rc1

Maybe you can make some sense of it.
Error ouput: (code follows)

26-Feb-2012 10:44:05 AM ucar.nc2.util.rc.RC loadDefaults
INFO: No .rc file found
java.io.IOException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at ucar.nc2.grib.grib2.Grib2CollectionBuilder.<init>(Grib2CollectionBuilder.java:123)
at ucar.nc2.grib.grib2.Grib2CollectionBuilder.readOrCreateIndexFromSingleFile(Grib2CollectionBuilder.java:75)
at ucar.nc2.grib.GribIndex.makeGribCollectionFromSingleFile(GribIndex.java:128)
at ucar.nc2.grib.grib2.Grib2Iosp.open(Grib2Iosp.java:295)
at ucar.nc2.NetcdfFile.<init>(NetcdfFile.java:1468)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:870)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:503)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:473)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:460)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:448)
at test2.GribReadTest.worker(GribReadTest.java:24)
at test2.GribReadTest.main(GribReadTest.java:15)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1949)
at thredds.inventory.CollectionManagerSingleFile.getRoot(CollectionManagerSingleFile.java:59)
at ucar.nc2.grib.grib2.Grib2CollectionBuilder.<init>(Grib2CollectionBuilder.java:117)
... 11 more
Exception in thread "main" java.lang.NullPointerException
at test2.GribReadTest.worker(GribReadTest.java:33)
at test2.GribReadTest.main(GribReadTest.java:15)

Code used: (tried couple of grib files and interfaces with same result)

import java.io.IOException;
import ucar.nc2.NetcdfFile;
import ucar.nc2.dataset.NetcdfDataset;

public class GribReadTest {

    public static void main(String[] args) {
        GribReadTest name = new GribReadTest();

private void worker() {
NetcdfDataset ncd = null;
NetcdfFile ncfile = null;
try {
// ncd = (NetcdfDataset) NetcdfDataset.openFile( "20120213.00.00.wind", null );
// ncfile = NetcdfFile.open("20120213.00.00.wind");
ncfile = NetcdfFile.open("ruc2.t00z.pgrb13anl.grib2");

        } catch (IOException e) {
        } finally {
               try {
//                ncd.close();
            } catch (IOException e) {

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.