Unable to read grib2 data with nctoolbox

22 views (last 30 days)
John Cruce
John Cruce on 14 Sep 2021
Answered: Feixiong Huang on 18 Oct 2021
I'm attempting to read MRMS radar data from here:
I grabbed a sample grib2 file. I've used nctoolbox for several years and this is the first time I've run into an issue reading data. The variable I'm having issues with is the reflectivity data (VAR209-3-57_FROM_161-0-0_altitude_above_msl).
Here is the simple read code:
nc=ncgeodataset('MRMS_ReflectivityAtLowestAltitude_00.50_20210913-194039.grib2');
time=nc.geovariable('time');
time=time.data(:);
altitude=nc.geovariable('altitude_above_msl');
altitude=altitude.data(:);
lat=nc.geovariable('lat');
lat=lat.data(:);
lon=nc.geovariable('lon');
lon=lon.data(:);
lowestalt=nc.geovariable('VAR209-3-57_FROM_161-0-0_altitude_above_msl');
lowestalt=squeeze(lowestalt.data(:,:,:,:));
I encouter the following error upon running:
Error using ncdataset/readdata (line 494)
Java exception occurred:
java.lang.UnsupportedOperationException: Unsupported DRS type = 41
at ucar.nc2.grib.grib2.Grib2Drs.factory(Grib2Drs.java:59)
at
ucar.nc2.grib.grib2.Grib2SectionDataRepresentation.getDrs(Grib2SectionDataRepresentation.java:73)
at ucar.nc2.grib.grib2.Grib2Record.readData(Grib2Record.java:271)
at ucar.nc2.grib.grib2.Grib2Iosp$DataReader.read(Grib2Iosp.java:983)
at ucar.nc2.grib.grib2.Grib2Iosp.readDataFromCollection(Grib2Iosp.java:912)
at ucar.nc2.grib.grib2.Grib2Iosp.readData(Grib2Iosp.java:722)
at ucar.nc2.NetcdfFile.readData(NetcdfFile.java:1941)
at ucar.nc2.Variable.reallyRead(Variable.java:859)
at ucar.nc2.Variable._read(Variable.java:831)
at ucar.nc2.Variable.read(Variable.java:709)
at ucar.nc2.dataset.VariableDS.reallyRead(VariableDS.java:518)
at ucar.nc2.dataset.VariableDS._read(VariableDS.java:502)
at ucar.nc2.dataset.VariableDS._read(VariableDS.java:526)
at ucar.nc2.Variable.read(Variable.java:695)
at ucar.nc2.Variable.read(Variable.java:669)
Error in ncdataset/data (line 171)
d = obj.readdata(variable, first, last, stride);
Error in ncgeodataset/subsref (line 630)
B = builtin('subsref',obj,g);
Error in ncvariable/somedata (line 406)
data = obj.dataset.data(name, first, last, stride);
Error in ncvariable/data (line 189)
d = somedata(obj, 1, first, last, stride);
Error in ncgeovariable/subsref (line 1116)
sref = obj.data(first, last, stride);
Error in ncgeodataset/subsref (line 660)
B = v.data(s(2).subs{:});
Any thoughts on what might be the issue here?

Answers (1)

Feixiong Huang
Feixiong Huang on 18 Oct 2021
You have to use MATLAB2017 or lower version

Community Treasure Hunt

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

Start Hunting!