MATLAB - GRIB Daten einlesen

M

macinstyle

Mitglied
Thread Starter
Dabei seit
18.11.2005
Beiträge
46
Reaktionspunkte
0
Hintergrund:
Mir liegen Atmosphären-Daten (Windgeschwindigkeit, Temperatur als Funktion von Ort und Druckniveau) im GRIB-Format vor. Diese würde ich zur weiteren Verwendung gerne in Matlab einlesen.

Lösungsversuch:
Durch kurzes googlen fand ich einen Matlab-Grib-Reader: http://www.mathworks.com/matlabcentral/fileexchange/21579
Dieser benötigt allerdings die CDI libraries von hier: https://code.zmaw.de/projects/cdi/files

Die Libraries müssen auf meiner Maschine kompiliert werden, das habe ich über das Terminal mit den Befehlen:

./configure CFLAGS=-fPIC CPPFLAGS=-fPIC --enable-shared
make

erledigt. Gemäß einer Anmerkung in den Kommentaren zum Grid-Reader habe ich das fPIC-flag hinzugefügt (er schrieb bei 64 Bit Systemen solle man das machen)
Gemäß der PDF-Doku soll nach dem kompilieren eine library libcdi.a erstellt werden (das ist genau die, die ich im weiteren Verlauf benötige), es entsteht jedoch lediglich eine libcdi.la - kann mir hier mal jemand den Unterschied erläutern? Jedenfalls habe ich die libcdi.la dann in libcdi.a umbenannt und versucht die MATLAB-Routine compile.m aufzurufen - diese wird mit dem folgenden Fehler beendet:

COMPILING cdi_varlist...
cdi_mx.c: In function 'getLevel':
cdi_mx.c:431: warning: incompatible implicit declaration of built-in function 'modf'
ld: warning: ignoring file lib64/libcdi.a, file was built for unsupported file format ( 0x23 0x20 0x6c 0x69 0x62 0x63 0x64 0x69 0x2e 0x6c 0x61 0x20 0x2d 0x20 0x61 0x20 ) which is not the architecture being linked (x86_64): lib64/libcdi.a
Undefined symbols for architecture x86_64:
"_Warning", referenced from:
_getLevel in cdi_mx.o
"_cdiStringError", referenced from:
_OpenCDIStream in cdi_mx.o
"_gridInqSize", referenced from:
_readmeta in cdi_mx.o
"_gridInqType", referenced from:
_readmeta in cdi_mx.o
"_gridInqXpole", referenced from:
_readmeta in cdi_mx.o
"_gridInqXsize", referenced from:
_getSize in cdi_mx.o
_allocateField in cdi_mx.o
_readmeta in cdi_mx.o
"_gridInqXvals", referenced from:
_readmeta in cdi_mx.o
"_gridInqYpole", referenced from:
_readmeta in cdi_mx.o
"_gridInqYsize", referenced from:
_getSize in cdi_mx.o
_allocateField in cdi_mx.o
_readmeta in cdi_mx.o
"_gridInqYvals", referenced from:
_readmeta in cdi_mx.o
"_gridIsRotated", referenced from:
_readmeta in cdi_mx.o
"_streamClose", referenced from:
_mexFunction in cdi_varlist.o
"_streamInqFiletype", referenced from:
_mexFunction in cdi_varlist.o
_getNumberOfVariables in cdi_mx.o
_readLevels in cdi_mx.o
"_streamInqTimestep", referenced from:
_getTimeSize in cdi_mx.o
_readField in cdi_mx.o
_readmeta in cdi_mx.o
"_streamInqVlist", referenced from:
_mexFunction in cdi_varlist.o
_getNumberOfVariables in cdi_mx.o
"_streamOpenRead", referenced from:
_OpenCDIStream in cdi_mx.o
"_streamReadVar", referenced from:
_readVar in cdi_mx.o
"_streamReadVarSlice", referenced from:
_readVar in cdi_mx.o
"_taxisInqVdate", referenced from:
_getTime in cdi_mx.o
_readField in cdi_mx.o
_readmeta in cdi_mx.o
"_taxisInqVtime", referenced from:
_getTime in cdi_mx.o
_readField in cdi_mx.o
_readmeta in cdi_mx.o
"_vlistInqTaxis", referenced from:
_readField in cdi_mx.o
_readmeta in cdi_mx.o
"_vlistInqVarCode", referenced from:
_mexFunction in cdi_varlist.o
_getVarIDByGRIB in cdi_mx.o
"_vlistInqVarGrid", referenced from:
_getSize in cdi_mx.o
_allocateField in cdi_mx.o
_readmeta in cdi_mx.o
"_vlistInqVarLongname", referenced from:
_getInfoFromFile in cdi_mx.o
"_vlistInqVarName", referenced from:
_getInfoFromFile in cdi_mx.o
_getVarIDByName in cdi_mx.o
"_vlistInqVarUnits", referenced from:
_getInfoFromFile in cdi_mx.o
"_vlistInqVarZaxis", referenced from:
_mexFunction in cdi_varlist.o
_getNumberOfVariables in cdi_mx.o
_getSize in cdi_mx.o
_allocateField in cdi_mx.o
_readVar in cdi_mx.o
_readLevels in cdi_mx.o
_getVarIDByGRIB in cdi_mx.o
...
"_vlistNvars", referenced from:
_mexFunction in cdi_varlist.o
_getNumberOfVariables in cdi_mx.o
_getVarIDByName in cdi_mx.o
_getVarIDByGRIB in cdi_mx.o
"_zaxisInqLbound", referenced from:
_getLevel in cdi_mx.o
"_zaxisInqLbounds", referenced from:
_getLevel in cdi_mx.o
"_zaxisInqLevel", referenced from:
_getLevel in cdi_mx.o
"_zaxisInqLtype", referenced from:
_getLevel in cdi_mx.o
"_zaxisInqSize", referenced from:
_mexFunction in cdi_varlist.o
_getNumberOfVariables in cdi_mx.o
_getSize in cdi_mx.o
_allocateField in cdi_mx.o
_readVar in cdi_mx.o
_readLevels in cdi_mx.o
_getVarIDByGRIB in cdi_mx.o
...
"_zaxisInqType", referenced from:
_getLevel in cdi_mx.o
"_zaxisInqUbound", referenced from:
_getLevel in cdi_mx.o
"_zaxisInqUbounds", referenced from:
_getLevel in cdi_mx.o
"_zaxisInqUnits", referenced from:
_getLevel in cdi_mx.o
"_zaxisNamePtr", referenced from:
_getLevel in cdi_mx.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

mex: link of ' "cdi_varlist.mexmaci64"' failed.


Kann mir hier ggf. jemand behilflich sein? Nochmal eine Anmerkung - kompilieren von C-Code ist für mich völliges Neuland - alles was ich bisher benötigt habe, habe ich in MATLAB programmiert...

Vielen Dank, Ben
 
Kompilierst und benutzt du das ganze unter Linux oder MacOSX? Laut Autor wurde die Software nur unter Windows und Linux getestet. Versuch mal im src/.libs/ Verzeichnis die libcdi.a Datei. Bei mir schlägt zwar der libtool Aufruf fehl, aber vielleicht hat er ja deine Library sauber gelinkt.

Das .la File ist nur ein Library Info File für libtool, öffne es mal mit einem Texteditor, dann verstehst du, warum das nicht funktionieren kann.
 
Besten Dank schonmal.

Kompilieren möcht ichs gern für Mac OS X 10.8; das Verzeichnis src/.libs existiert bei mir nicht?!

:edit: nur übersehen, habe nun die libcdi.a; neue Fehlermeldung in MATLAB:


compile
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.
 
Ohne jetzt alles im Detail überprüft zu haben, müsstest du die Lib wohl zunächst auf OSX portieren. Die kompiliert offenbar nicht ohne weiteres.
 
Zurück
Oben Unten