[GRASS-user] hdf import fails

Martin Wegmann wegmann at biozentrum.uni-wuerzburg.de
Mon Jul 23 12:13:28 EDT 2007


On Tuesday 17 July 2007 17:23:15 Markus Neteler wrote:
> Martin Wegmann wrote on 07/17/2007 03:51 PM:
> > Hello,
> >
> > I found a lot of discussion/question concerning hdf import but none which
> > might relate to the error prompt I received.
> >
> > I just want to import a MODIS hdf file with 46 bands which fails with:
> >
> > r.in.gdal -o -e -k
> > input=/media/NO1/Tiseg_Analyse_1707/Harmonische_Analyse_1707/2001/MOD09A1
> >_1707_2001_b01/harmonic_analysis.hdf output=test location=modistest2
> > ERROR 5: GDALDataset::GetRasterBand(1) - Illegal band #
> >
> > ERROR: Selected band (1) does not exist.
> >
> > It would be great if somebody can point me to any link with related
> > problems or solutions.
> >
> > Using GRASS 6.3.cvs (cvs update yesterday) and 6.0.
>
> The import of HDF bands requires the specification of the individual
> bands as seen by GDAL:
>
> # Example MODIS FPAR
> gdalinfo MOD15A2.A2003153.h18v04.004.2003171141042.hdf
> ...
> Subdatasets:
>  
> SUBDATASET_1_NAME=HDF4_EOS:EOS_GRID:"MOD15A2.A2003153.h18v04.004.2003171141
>042.hdf":MOD_Grid_MOD15A2:Fpar_1km SUBDATASET_1_DESC=[1200x1200] Fpar_1km
> MOD_Grid_MOD15A2 (8-bit unsigned integer)
> SUBDATASET_2_NAME=HDF4_EOS:EOS_GRID:"MOD15A2.A2003153.h18v04.004.2003171141
>042.hdf":MOD_Grid_MOD15A2:Lai_1km SUBDATASET_2_DESC=[1200x1200] Lai_1km
> MOD_Grid_MOD15A2 (8-bit unsigned integer) ...
>
> # import of first band, here FPAR 1km:
> r.in.gdal
> HDF4_EOS:EOS_GRID:"MOD15A2.A2003153.h18v04.004.2003171141042.hdf":MOD_Grid_
>MOD15A2:Fpar_1km \ out=fpar_1km_2003_06_02
> # ... likewise for other HDF bands in the file.
>
> I have added this to the module documentation.

thanks!

> Hope this helps,

yes, it solved this problem, but it is quit tedious to import each layer 
separately - but it is probably possible to write a script.

One big problem occurs after the import when patching the imported hdfs which 
does not work properly (see attached image) - but using ERDAS 9.1 patching 
works fine. 

Any idea how this error might be fixed?

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grass_HDF_1707_1807.jpg
Type: image/jpeg
Size: 50230 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20070723/c9bed9f1/grass_HDF_1707_1807.jpg


More information about the grass-user mailing list