[ncl-install] gdal and grib2 issue

Daniel Reinert Daniel.Reinert at dwd.de
Mon Mar 12 06:59:38 MDT 2012

Hi Mary,

Thanks for the compile line! Now it works :-)


> Hi Daniel,
> This is a really good point. I didn't realize GDAL had its own g2clib library.
> Internally, we actually are building GDAL with the "--without-grib" option, but I failed to include this tidbit on our build page.  I'll correct this right away. You also need to do this for HDF4 and HDF5.
> Here's the compile line we use for GDAL:
>    ./configure --with-static-proj4=/usr/local --prefix=/usr/local --without-pam
>        --with-png=/usr/local --with-gif=internal --with-libtiff=internal
>        --with-geotiff=internal --with-jpeg=/usr/local --with-libz=/usr/local
>        --with-sqlite3=no --with-expat=no --with-curl=no --without-ld-shared
>        --with-hdf4=no --with-hdf5=no --with-pg=no --without-grib --disable-shared
>        --with-freexl=no --with-geos=no
> There's no way to point NCL specifically to the "correct" g2clib library, other than making sure that you have the correct -L path for the correct one before the path for the GDAL one.
> Thanks so much for bringing this to our attention.
> --Mary
> On Mar 9, 2012, at 6:06 AM, Daniel Reinert wrote:
>> Dear Mary,
>> I just wanted to report a subtle issue that we ran into with ncl 6.0. Since here at DWD we are running a SuSe system with gcc 4.1.2, we had to compile ncl 6.0 from source. Everything went more or less smoothly, except for the following subtle GRIB2 problem that we encountered:
>> The compilation was performed WITH GDAL(v1.9.0) and WITH GRIB2 (g2clib v1.2.1) support.
>> When trying to read a Grib2 file containing Sattelite data, I got the following error from ncl_filedump:
>> getpdstemplate: PDS Template 4.31 not defined.
>> warning:Error unpacking GRIB record section 4.
>> fatal:Could not open(CTH_DE_201111070600.grb2)
>> However, the current g2clib (both, the original one from NCEP (v1.2.3) and the modified one you provide (v1.2.1)) do contain the required template 4.31. The problem seems to be related to the fact, that GDAL also includes g2clib, but in a somewhat outdated version (gdal-1.9.0/frmts/grib/degrib18/g2clib-1.0.4), which does not contain Template 4.31. It seems that ncl is linked against the "wrong" g2clib, if GDAL is compiled in.
>> If ncl is compiled without GDAL support, then the GRIB2 file containing the satellite data can be read without problems.
>> Since we wanted to have GDAL compiled in, we looked for an alternative solution. The following worked for us:
>> When compiling GDAL, one can switch off the GRIB driver by using the configure flag "--without-grib". Then, ncl is linked against the correct g2clib. However, I'm not sure, whether this has any unwanted side-effects.
>> Is there a more 'elegant' way of telling ncl which g2clib library to use?
>> Cheers,
>> Daniel
>> -- 
>> ---------------------------
>> Dr. Daniel Reinert
>> Deutscher Wetterdienst
>> Research and Development
>> 63067 Offenbach am Main
>> Germany
>> Phone: +49 69 8062 2060
>> --------------------------
>> _______________________________________________
>> ncl-install mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-install

Dr. Daniel Reinert
Deutscher Wetterdienst
Research and Development
63067 Offenbach am Main

Phone: +49 69 8062 2060

More information about the ncl-install mailing list