[gdal-dev] error parsing metadata from HDF5 dataset

Rashad M mohammedrashadkm at gmail.com
Thu Sep 3 08:33:03 PDT 2015


Hello Even,

On Thu, Sep 3, 2015 at 5:13 PM, Even Rouault <even.rouault at spatialys.com>
wrote:

> Le jeudi 03 septembre 2015 16:58:34, Rashad M a écrit :
> > Hello all,
> >
> > I have an problem when reading metadata information of HDF5 dataset. some
> > of the values are not parsed properly by GDAL. Below is the relevant part
> > of output from gdalinfo
> >
> >
> > ....
> >   Azimuth_Processing_Number_of_Looks=
> >   Bits_per_Sample=
> > ....
> >
> > S01_B001_Azimuth_Ramp_Code=
> >
> > <garbage values and newline chars>
> >
> > ....
> > ....
> >  Sample_Format=INT
> >   Samples_per_Pixel=
> >   Satellite_Height=628440.5
> >   Satellite_ID=CSKS3
> > ....
> >
> >
> > I had looked into frmts/hdf5/hdf5dataset.cpp and all of these metadata
> are
> > of type H5T_NATIVE_UCHAR.
> >
> >
> https://trac.osgeo.org/gdal/browser/branches/1.11/gdal/frmts/hdf5/hdf5datas
> > et.cpp#L728
> >
> > changing format specifier from char( %c) to int(%d) solves the issue for
> > me. But is there a better fix for this?
>
> That looks like a reasonable fix. And the cast should be a (unsigned
> char*).
>
> %c should be used only for characters part of a string, but the string
> case is
> dealt before, so that must mean that those should be dealt as integer
> values.
> The _CHAR and _SCHAR above are also likely wrong.
>
> Could you raise a ticket about that in Trac ?
>

Sure. The patch is for 1.11 branch. Should I generate the same for trunk
also?

As we are on the subject of metadata in hdf5 dataset,  there is  Header too
long. .. Truncated warning appearing when type is double which now has
format specifier as %.16g

using simply %g or %lg fixed the issue on my side. If okay, I will include
that too in the patch.

Thanks.

>
> >
> >
> > OS: Fedora 20 x86_64
> > gdal branch: 1.11
> >
> > svn info
> >
> > Path: .
> > Working Copy Root Path: /home/mkanavat/sources/gdal_branch_1.11
> > URL: http://svn.osgeo.org/gdal/branches/1.11/gdal
> > Relative URL: ^/branches/1.11/gdal
> > Repository Root: http://svn.osgeo.org/gdal
> > Repository UUID: f0d54148-0727-0410-94bb-9a71ac55c965
> > Revision: 30007
> > Node Kind: directory
> > Schedule: normal
> > Last Changed Author: rouault
> > Last Changed Rev: 30005
> > Last Changed Date: 2015-09-01 10:17:50 +0200 (Tue, 01 Sep 2015)
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev




-- 
Regards,
   Rashad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150903/63a367f8/attachment.html>


More information about the gdal-dev mailing list