필터 지우기
필터 지우기

How to open GRIB2 file using ncgeodatset?

조회 수: 17 (최근 30일)
Zhou Ci
Zhou Ci 2022년 5월 26일
답변: Jacob Halbrooks 2024년 9월 25일 13:35
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 =
'E:\NCEP\fnl_20170603_06_00.grib2'
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 com.google.protobuf.GeneratedMessage.getUnknownFields(GeneratedMessage.java:262)
at ucar.nc2.grib.GribCollectionProto$Record.getSerializedSize(GribCollectionProto.java:162)
at com.google.protobuf.CodedOutputStream.computeMessageSizeNoTag(CodedOutputStream.java:916)
at com.google.protobuf.CodedOutputStream.computeMessageSize(CodedOutputStream.java:668)
at ucar.nc2.grib.GribCollectionProto$VariableRecords.getSerializedSize(GribCollectionProto.java:657)
at com.google.protobuf.AbstractMessageLite.toByteArray(AbstractMessageLite.java:70)
at ucar.nc2.grib.grib2.Grib2CollectionBuilder.createIndex(Grib2CollectionBuilder.java:558)
at ucar.nc2.grib.grib2.Grib2CollectionBuilder.createIndex(Grib2CollectionBuilder.java:415)
at ucar.nc2.grib.grib2.Grib2CollectionBuilder.readOrCreateIndex(Grib2CollectionBuilder.java:157)
at
ucar.nc2.grib.grib2.Grib2CollectionBuilder.readOrCreateIndexFromSingleFile(Grib2CollectionBuilder.java:77)
at ucar.nc2.grib.GribIndex.makeGribCollectionFromSingleFile(GribIndex.java:123)
at ucar.nc2.grib.grib2.Grib2Iosp.open(Grib2Iosp.java:310)
at ucar.nc2.NetcdfFile.<init>(NetcdfFile.java:1499)
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)
  댓글 수: 1
jessupj
jessupj 2022년 5월 26일
편집: jessupj 2022년 5월 26일
I think this is an external tool (https://github.com/nctoolbox). 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.)

댓글을 달려면 로그인하십시오.

채택된 답변

Jacob Halbrooks
Jacob Halbrooks 2024년 9월 25일 13:35
As of R2023b, you can read data from a GRIB file (.grb, .grib, .grib2) using the Mapping Toolbox readgeoraster function. You can also get information about a GRIB file by using the georasterinfo function. These functions were enhanced in R2024b to support GRIB files that use CCSDS compression.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Call Web Services from MATLAB Using HTTP에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by