mtalpe / nctoolbox

Automatically exported from code.google.com/p/nctoolbox
0 stars 0 forks source link

When I use nctoolbox to read grib files #63

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Dear Mr./Ms.

I want to use nctoolbox to read grib files but some problem came across as 
fellows:

nc=ncgeodataset('/home/lvshaoning/Downloads/multi_1.at_4m.dp.200607.grb2');
Error using ncdataset (line 91)
Failed to open /home/lvshaoning/Downloads/multi_1.at_4m.dp.200607.grb2

Error in cfdataset (line 59)
            obj = obj@ncdataset(url);

Error in ncgeodataset (line 74)
            obj = obj@cfdataset(url);

Caused by:
    Error using ncdataset (line 75)
    Java exception occurred:
    java.lang.RuntimeException: java.lang.NoSuchFieldError:
    alwaysUseFieldBuilders
    at ucar.nc2.NetcdfFile.<init>(NetcdfFile.java:1535)
    at ucar.nc2.NetcdfFile.open(NetcdfFile.java:887)
    at ucar.nc2.NetcdfFile.open(NetcdfFile.java:496)
    at
        ucar.nc2.dataset.NetcdfDataset.openOrAcquireFile(NetcdfDataset.java:693)
    at ucar.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:424)
    at ucar.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:407)
    at ucar.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:392)
    at ucar.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:379)
    Caused by: java.lang.NoSuchFieldError: alwaysUseFieldBuilders
    at
        ucar.nc2.grib.grib2.Grib2IndexProto$Grib2Index.access$5400(Grib2IndexProto.java:2635)
            at
        ucar.nc2.grib.grib2.Grib2IndexProto$Grib2Index$Builder.maybeForceBuilderInitialization(Grib2IndexProto.java:2914)
            at
        ucar.nc2.grib.grib2.Grib2IndexProto$Grib2Index$Builder.<init>(Grib2IndexProto.java:2906)
            at
        ucar.nc2.grib.grib2.Grib2IndexProto$Grib2Index$Builder.create(Grib2IndexProto.java:2920)
            at
        ucar.nc2.grib.grib2.Grib2IndexProto$Grib2Index$Builder.access$5200(Grib2IndexProto.java:2891)
            at
        ucar.nc2.grib.grib2.Grib2IndexProto$Grib2Index.newBuilder(Grib2IndexProto.java:2878)
            at ucar.nc2.grib.grib2.Grib2Index.makeIndex(Grib2Index.java:231)
    at
        ucar.nc2.grib.GribIndex.makeGribCollectionFromSingleFile(GribIndex.java:112)
            at ucar.nc2.grib.grib2.Grib2Iosp.open(Grib2Iosp.java:310)
    at ucar.nc2.NetcdfFile.<init>(NetcdfFile.java:1499)
    ... 7 more

I'm sure I have installed the nctoolbox successfully since I ran the following 
codes and get the correct output: 

ds = 
ncgeodataset('http://geoport.whoi.edu/thredds/dodsC/coawst_2_2/fmrc/coawst_2_2_b
est.ncd')

ds = 

  ncgeodataset with properties:

     location: [1x73 char]
       netcdf: [1x1 ucar.nc2.dataset.NetcdfDataset]
    variables: {180x1 cell}

​Could you help me to figure out what is going on? Thanks a lot and I put my 
input in the attachment as well.

Regards

            Shaoning

Original issue reported on code.google.com by LvShaoN...@gmail.com on 10 Sep 2014 at 3:32

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Shaoning,

The solution to this issue is posted at the bottom of 
https://github.com/nctoolbox/nctoolbox/issues/28

Cheers
Brian

Original comment by bschlin...@gmail.com on 10 Sep 2014 at 3:44

GoogleCodeExporter commented 8 years ago
Thank you for your help but the problem has not been solved by the advice on 
the bottom of the webpage. According to the advice, I updated the java files 
under \nctoolbox\. Even the code which worked before is now breaking down like:

d = 
ncgeodataset('http://geoport.whoi.edu/thredds/dodsC/examples/OS_M1_20081008_TS.n
c');
Error using ncdataset (line 91)
Failed to open
http://geoport.whoi.edu/thredds/dodsC/examples/OS_M1_20081008_TS.nc

Error in cfdataset (line 59)
            obj = obj@ncdataset(url);

Error in ncgeodataset (line 74)
            obj = obj@cfdataset(url);

Caused by:
    Undefined variable "ucar" or class
    "ucar.nc2.dataset.NetcdfDataset.openDataset".

Is there any suggestion? 

Original comment by LvShaoN...@gmail.com on 11 Sep 2014 at 8:14