Problem with reading Cosmo-Skymed data using Gamma

I am working on some data from Cosmo Skymed and noticed the following problems with par_CS_SLC command in Gamma binary distribution.

For the solution scroll down, the steps below are only details of troubleshooting...

The first error message is about the hdf5 libraries not being where Gamma would like them to be:

$ par_CS_SLC
par_CS_SLC: error while loading shared libraries: libhdf5-1.6.6.so.0: cannot open shared object file: No such file or directory

I tried to locate the hdf5 library on my computer (Ubuntu Oneiric AMD64):

$ locate libhdf5.so.
/usr/lib/libhdf5.so.6
/usr/lib/libhdf5.so.6.0.3
Creating a link from the libhdf5.so.6 to libhdf5-1.6.6.so should solve the problem I thought...
$ sudo ln -s /usr/lib/libhdf5.so.6 /usr/lib/libhdf5-1.6.6.so.0
$ par_CS_SLC
*** Generate ISP SLC parameter and image files for Cosmo Skymed SCS data  ***
*** Copyright 2008, Gamma Remote Sensing, v1.0 29-May-2008 awi            ***
usage: par_CS_SLC <HDF5> <SLC_par> <SLC>
input parameters:
HDF5     (input) SCS data file in HDF5 format
SLC_par  (output) SLC ISP image parameter file (example: yyyymmdd.slc.par)
SLC      (output) SLC data file (example: yyyymmdd.slc)
Looks promising but when I run the command I got this error message:
$ par_CS_SLC CSKS4_SCS_B_HI_03_HH_RD_SF_20111010151258_20111010151305.h5  20111010.slc.par 20111010.slc
*** Generate ISP SLC parameter and image files for Cosmo Skymed SCS data  ***
*** Copyright 2008, Gamma Remote Sensing, v1.0 29-May-2008 awi            ***
Warning! ***HDF5 library version mismatched error***
The HDF5 header files used to compile this application do not match
the version used by the HDF5 library to which this application is linked.
Data corruption or segmentation faults may occur if the application continues.
This can happen when an application was compiled by one version of HDF5 but
linked with a different version of static or shared HDF5 library.
You should recompile the application or check your shared library related
settings such as 'LD_LIBRARY_PATH'.
You can, at your own risk, disable this warning by setting the environment
variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.
Setting it to 2 or higher will suppress the warning messages totally.
Headers are 1.6.6, library is 1.8.4
...
Ignoring the library conflict and possible errors I went ahead with setting the environment parameter to 2, but it failed again.
$ export HDF5_DISABLE_VERSION_CHECK=2
$ par_CS_SLC CSKS4_SCS_B_HI_03_HH_RD_SF_20111010151258_20111010151305.h5  20111010.slc.par 20111010.slc
*** Generate ISP SLC parameter and image files for Cosmo Skymed SCS data  ***
*** Copyright 2008, Gamma Remote Sensing, v1.0 29-May-2008 awi            ***
par_CS_SLC: symbol lookup error: par_CS_SLC: undefined symbol: H5Gopen
Which tells us that the hdf5 version 1.8.4 somehow is not compatible with the version 1.6.6. There is some information on the hdf5 website about this. However we can still get the ubuntu debian packages for Hardy Heron which has the libhdf5 version 1.6.5... Not exactly 1.6.6 but should be close enough. So I downloaded the libhdf5-serial-1.6.5-0 from ubuntu package repository (see references below).
Solution
  • Download the libhdf5-serial-1.6.5 package for your architecture (I used amd64).
  • Unzip the usr folder inside the package to somewhere you like. I used $GAMMA_HOME/libs.
  • set the LD_LIBRARY_PATH to $GAMMA_HOME/libs (export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GAMMA_HOME/libs/usr/lib)
  • create a link from libhdf5-1.6.6.so.0 to libhdf5-1.6.5.so.0.0.0: cd $GAMMA_HOME/libs/usr/lib; ln -s  libhdf5-1.6.5.so.0.0.0 libhdf5-1.6.6.so.0
  • Set the HDF5_DISABLE_VERSION_CHECK if not already done: export HDF5_DISABLE_VERSION_CHECK=2
That should be it. Now I can run the par_CS_SLC without problems.

References