[FWTools] using gdalwarp for converting hdf5 to geotiff

Frank Warmerdam warmerdam at pobox.com
Mon Aug 18 10:12:06 EDT 2008


On Fri, Aug 15, 2008 at 1:32 PM,  <stephane.poirier at usherbrooke.ca> wrote:
> Hi all,
>
> Using gdalinfo on the hdf5 data I created, I get the following:
>
> SUBDATASET_0_NAME=HDF5:"g:\tsat_hdf5\tsat_2007.h5"://lat
> SUBDATASET_0_DESC=[160x240] //lat (64-bit floating-point)
> SUBDATASET_1_NAME=HDF5:"g:\tsat_hdf5\tsat_2007.h5"://lon
> SUBDATASET_1_DESC=[160x240] //lon (64-bit floating-point)
> SUBDATASET_2_NAME=HDF5:"g:\tsat_hdf5\tsat_2007.h5"://tsat/01/01
> SUBDATASET_2_DESC=[160x240] //tsat/01/01 (64-bit floating-point)
> ...
> SUBDATASET_366_NAME=HDF5:"g:\tsat_hdf5\tsat_2007.h5"://tsat/12/31
> SUBDATASET_366_DESC=[160x240] //tsat/12/31 (64-bit floating-point)
> The first two datasets represents the latitude and longitude for each
> subsequent datasets in my hdf5.
>
> Attempting to convert one dataset to geotiff using gdalwarp as: gdalwarp
> HDF5:"g:\tsat_hdf5\tsat_2007.h5"://tsat/01/01 tsat_20070101.tif
>
> I got the following error message "ERROR 1: Unable to compute a
> transformation between pixel/line and georeferenced coordinates for
> HDF5:g:\tsat_hdf5\tsat_2007.h5://tsat/01/01. There is no affine
> transformation and no GCPs.".
>
> How must I prepare my hdf5 file for the gdalwarp to geotiff conversion
> works?

Stephane,

You can translate the lat, lon and tsat/01/01 arrays into geotiff files,
and then try to bind them together as a dataset with geolocation arrays
using a "VRT" file.   But this is a pretty complicated operation.  The
applicable docs are:

  http://www.gdal.org/gdal_vrttut.html
  http://trac.osgeo.org/gdal/wiki/rfc4_geolocate

Ideally the HDF5 driver would recognise common cases where there are
geolocation arrays, and create the binding metadata automatically - as
the HDF4 driver does in some cases.  But that isn't implemented now, so
you are stuck setting up the geolocation relationships (aka RFC4) manually.

I'm sorry this is so complicated.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent


More information about the FWTools mailing list