MATLAB - Read GRIB Data

7 views (last 30 days)
Benjamin
Benjamin on 9 Feb 2013
Answered: Jacob Halbrooks on 25 Sep 2024
Background:
I want to import meteorological data (wind speed, temperature as a function of position and altitude) in the GRIB-format into Matlab.
Status:
While googling I found this Matlab-Grib-Reader: http://www.mathworks.com/matlabcentr...exchange/21579
The Matlab Grib-Reader requires CDI libraries from here: https://code.zmaw.de/projects/cdi/files
The libraries must be compiled with the own machine, i used this terminal commands:
./configure CFLAGS=-fPIC CPPFLAGS=-fPIC --enable-shared
make
I copied the resulting libcdi.a library into the lib64 folder, and executed compile.m which gave me the following:
COMPILING cdi_varlist...
cdi_mx.c: In function 'getLevel':
cdi_mx.c:431: warning: incompatible implicit declaration of built-in function 'modf'
Undefined symbols for architecture x86_64:
"_Warning", referenced from:
_getLevel in cdi_mx.o
(maybe you meant: _Warning_)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
mex: link of ' "cdi_varlist.mexmaci64"' failed.
Error using mex (line 206)
Unable to complete successfully.
Error in compile (line 15)
mex cdi_varlist.c cdi_mx.c -Iinclude -Llib64 -lcdi -lnetcdf
Who can help?
PS: Matlab 2012a, Mac OS X 10.8.2, Xcode 4.6

Accepted Answer

Jacob Halbrooks
Jacob Halbrooks on 25 Sep 2024
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.

More Answers (0)

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!