How to open GRIB2 file using ncgeodatset?

8 views (last 30 days)
Zhou Ci
Zhou Ci on 26 May 2022
Edited: jessupj on 26 May 2022
Hi everyone,
I am trying to open a 'GRIB2' file using ncgeodataset. But I am not able to do it.
fname = 'E:\NCEP\fnl_20170603_06_00.grib2'
ds = ncgeodataset(fname);
After I run above two lines, these are the results. Can somebody tell me what is the issue here. Thank you
fname =
2022-05-26 19:40:45,657 [main] WARN ucar.nc2.grib.grib2.Grib2CollectionBuilder - GribCollection fnl_20170603_06_00.grib2: invalid index
2022-05-26 19:40:45,657 [main] WARN ucar.nc2.grib.GribCollection - Failed to delete E:\NCEP\fnl_20170603_06_00.grib2.ncx
Warning: Escaped character '\N' is not valid. See 'doc sprintf' for supported special characters.
> In ncdataset (line 95)
In cfdataset (line 59)
In ncgeodataset (line 74)
Error using ncdataset (line 97)
Failed to open E:
Error in cfdataset (line 59)
obj = obj@ncdataset(url);
Error in ncgeodataset (line 74)
obj = obj@cfdataset(url);
Caused by:
Error using ncdataset (line 81)
Java exception occurred:
java.lang.UnsupportedOperationException: This is supposed to be overridden by subclasses.
at ucar.nc2.grib.GribCollectionProto$Record.getSerializedSize(
at ucar.nc2.grib.GribCollectionProto$VariableRecords.getSerializedSize(
at ucar.nc2.grib.grib2.Grib2CollectionBuilder.createIndex(
at ucar.nc2.grib.grib2.Grib2CollectionBuilder.createIndex(
at ucar.nc2.grib.grib2.Grib2CollectionBuilder.readOrCreateIndex(
at ucar.nc2.grib.GribIndex.makeGribCollectionFromSingleFile(
at ucar.nc2.NetcdfFile.<init>(
at ucar.nc2.dataset.NetcdfDataset.openOrAcquireFile(
at ucar.nc2.dataset.NetcdfDataset.openDataset(
at ucar.nc2.dataset.NetcdfDataset.openDataset(
at ucar.nc2.dataset.NetcdfDataset.openDataset(
at ucar.nc2.dataset.NetcdfDataset.openDataset(
  1 Comment
jessupj on 26 May 2022
I think this is an external tool ( You're better off asking around the developer instead of this community, as it's probbaly not a matlab-itself problem.
(My guess is opendap problems or an incompatible JVM version. if your gribfile is local, have you tried converting it to netcdf in ncl and loading it with the matlab function ncread? That way, it's at least in 'matlab' rather than a 3rd party tool and you're likely to get more help here.)

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by