[Gdal-dev] gdal_translate of HDF : resulting GeoTiff file strange

guillaume huby guillaume.huby.lists at gmail.com
Thu Apr 19 12:00:02 EDT 2007


On 4/19/07, Guillaume HUBY <ghuby at geosys.com> wrote:
>
> Hey all,
>
> I ran the following command on an HDF format:
>
> $ gdal_translate HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":9
> test_b9.tif


First of all, your modis file does not look like like the HDF-EOS MOD21KM
file I know (but I downloaded subseted data). Are you sure you get a good
one ?
Second point, each dataset of MOD21KM hdf is made of raw data with GCP
within meta data. So, AFAIK, if you use gdal_translate you do not apply GCP
to image. You should use gdalwarp instead.


I hence get a geotiff file called test_b9.tif
> I actually ran the command on all my 26 channels and got 26 different
> TIF files.
> I think that this should be the most important channel though, namely,
> it is the :
>
>    SUBDATASET_9_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":8
>    SUBDATASET_9_DESC=[16x3630x1354] EV_1KM_Emissive (16-bit unsigned
> integer)
>
>
> If I now run gdalinfo I get:
>
> rasdaman at mattia-desktop:~/FTPCHINA$ gdalinfo -nomd test_b8.tif
> Driver: GTiff/GeoTIFF
> Size is 1354, 3630
> Coordinate System is `'
> Corner Coordinates:
> Upper Left  (    0.0,    0.0)
> Lower Left  (    0.0, 3630.0)
> Upper Right ( 1354.0,    0.0)
> Lower Right ( 1354.0, 3630.0)
> Center      (  677.0, 1815.0)
> Band 1 Block=1354x3 Type=UInt16, ColorInterp=Gray
> Band 2 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> Band 3 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> Band 4 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> Band 5 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> Band 6 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> Band 7 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> Band 8 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> Band 9 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> Band 10 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> Band 11 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> Band 12 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> Band 13 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> Band 14 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> Band 15 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> Band 16 Block=1354x3 Type=UInt16, ColorInterp=Undefined
> rasdaman at mattia-desktop:~/FTPCHINA$



Isnt this a strange result?


No, a hdf file is made of datasets. Each dataset can contain rasters (or
other data). In your case, the ninth dataset of your hdf file contains a
raster with 16 bands (see the 16 of SUBDATASET_9_DESC=[16x3630x1354]). So
when you extract the ninth dataset, you get a raster with 16 bands.


What about the coordinate system?


see before.

I tried to merge all the tifs with gdalwarp, but had no success so far..
>
> I'm pretty new to this field and in very high waters..
>
> Any suggestions?


If you don't want to use batch mode or have a uniform process for all
images, you should use HEG-Tools or MRT which EOS made tools with simple GUI
very easy to use to extract data from HDF-EOS files.

Good luck,
Guillaume.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070419/6434501e/attachment.html


More information about the Gdal-dev mailing list