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

mattia mattia.parigiani at gmail.com
Thu Apr 19 12:42:20 EDT 2007


WHat I meant by strange is that I only get one band to have a significant
value... all other bands have 'Undefined value' ...

I tried renaming the file from AMOD021KM20061229043102.hdf to
MOD021KM20061229043102.hdf, ie : removing the A in front which, I guess, as
been used for convention to indicate an image from Terra satellite as
opposed to the Aqua satellite..

I also tried, some days ago with HEG tools but when I try to open the image
I get an error popup statin "cannot open load AMOD021KM20061229043102.hdf,
unknown error"

I'm having problem installing MRT in Linux (Ubuntu) .. I will keep trying :(

How do I know if I have a good image? gdalinfo??

This is what I get with gdalinfo -nomd

rasdaman at mattia-desktop:/opt/HEG/iHEG$ gdalinfo -nomd
MOD021KM20061229043102.hdf
Driver: HDF4/Hierarchical Data Format Release 4
Size is 512, 512
Coordinate System is `'
Subdatasets:
  SUBDATASET_1_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":0
  SUBDATASET_1_DESC=[15x3630x1354] EV_1KM_RefSB (16-bit unsigned integer)
  SUBDATASET_2_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":1
  SUBDATASET_2_DESC=[15x3630x1354] EV_1KM_RefSB_Uncert_Indexes (8-bit
unsigned integer)
  SUBDATASET_3_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":2
  SUBDATASET_3_DESC=[2x3630x1354] EV_250_Aggr1km_RefSB (16-bit unsigned
integer)
  SUBDATASET_4_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":3
  SUBDATASET_4_DESC=[2x3630x1354] EV_250_Aggr1km_RefSB_Uncert_Indexes (8-bit
unsigned integer)
  SUBDATASET_5_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":4
  SUBDATASET_5_DESC=[2x3630x1354] EV_250_Aggr1km_RefSB_Samples_Used (8-bit
unsigned integer)
  SUBDATASET_6_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":5
  SUBDATASET_6_DESC=[5x3630x1354] EV_500_Aggr1km_RefSB (16-bit unsigned
integer)
  SUBDATASET_7_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":6
  SUBDATASET_7_DESC=[5x3630x1354] EV_500_Aggr1km_RefSB_Uncert_Indexes (8-bit
unsigned integer)
  SUBDATASET_8_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":7
  SUBDATASET_8_DESC=[5x3630x1354] EV_500_Aggr1km_RefSB_Samples_Used (8-bit
unsigned integer)
  SUBDATASET_9_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":8
  SUBDATASET_9_DESC=[16x3630x1354] EV_1KM_Emissive (16-bit unsigned integer)
  SUBDATASET_10_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":9
  SUBDATASET_10_DESC=[16x3630x1354] EV_1KM_Emissive_Uncert_Indexes (8-bit
unsigned integer)
  SUBDATASET_11_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":10
  SUBDATASET_11_DESC=[726x271] Latitude (32-bit floating-point)
  SUBDATASET_12_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":11
  SUBDATASET_12_DESC=[726x271] Longitude (32-bit floating-point)
  SUBDATASET_13_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":12
  SUBDATASET_13_DESC=[726x271] Height (16-bit integer)
  SUBDATASET_14_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":13
  SUBDATASET_14_DESC=[726x271] SensorZenith (16-bit integer)
  SUBDATASET_15_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":14
  SUBDATASET_15_DESC=[726x271] SensorAzimuth (16-bit integer)
  SUBDATASET_16_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":15
  SUBDATASET_16_DESC=[726x271] Range (16-bit unsigned integer)
  SUBDATASET_17_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":16
  SUBDATASET_17_DESC=[726x271] SolarZenith (16-bit integer)
  SUBDATASET_18_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":17
  SUBDATASET_18_DESC=[726x271] SolarAzimuth (16-bit integer)
  SUBDATASET_19_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":18
  SUBDATASET_19_DESC=[726x271] gflags (8-bit unsigned integer)
  SUBDATASET_20_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":19
  SUBDATASET_20_DESC=[3630x1354] EV_Band26 (16-bit unsigned integer)
  SUBDATASET_21_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":20
  SUBDATASET_21_DESC=[3630x1354] EV_Band26_Uncert_Indexes (8-bit unsigned
integer)
  SUBDATASET_22_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":21
  SUBDATASET_22_DESC=[16x10] Noise in Thermal Detectors (8-bit unsigned
integer)
  SUBDATASET_23_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":22
  SUBDATASET_23_DESC=[16x10] Change in relative responses of thermal
detectors (8-bit unsigned integer)
  SUBDATASET_24_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":23
  SUBDATASET_24_DESC=[363x16x10] DC Restore Change for Thermal Bands (8-bit
integer)
  SUBDATASET_25_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":24
  SUBDATASET_25_DESC=[363x2x40] DC Restore Change for Reflective 250m Bands
(8-bit integer)
  SUBDATASET_26_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":25
  SUBDATASET_26_DESC=[363x5x20] DC Restore Change for Reflective 500m Bands
(8-bit integer)
  SUBDATASET_27_NAME=HDF4_SDS:UNKNOWN:"MOD021KM20061229043102.hdf":26
  SUBDATASET_27_DESC=[363x15x10] DC Restore Change for Reflective 1km Bands
(8-bit integer)
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  512.0)
Upper Right (  512.0,    0.0)
Lower Right (  512.0,  512.0)
Center      (  256.0,  256.0)
rasdaman at mattia-desktop:/opt/HEG/iHEG$


You had sent me the following command some days ago to convert to tiff using
gdal_translate
gdal_translate HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":9 test_b9.tif

WOuld I need to do the analogous thing with the gdalwarp utility?? So as to
consider GCP??

One last thing... At the end of day I will need to process all images in the
same way and to get out of them RGB images (The images cover the whole
national territory of China)... For this, I'm I looking at all the bands in
the HDF File?? Or does it only concern a certain number of them (in this
case all means the 26 bands displayed with gdalinfo)

Thanks for your patience and help, Its only that I have some deadlines
coming for a big project and really need to sort these data conversions
ASAP.

Thanks

Mattia



On 4/19/07, guillaume huby <guillaume.huby.lists at gmail.com> wrote:
>
>
>
> 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.
>
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev
>



-- 
Mattia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070419/c3377691/attachment.html


More information about the Gdal-dev mailing list