[GRASS-user] hdf import fails

Markus Neteler neteler at itc.it
Tue Jul 17 11:23:15 EDT 2007


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.2003171141042.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.2003171141042.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.

Hope this helps,
Markus


------------------
ITC -> dall'1 marzo 2007 Fondazione Bruno Kessler
ITC -> since 1 March 2007 Fondazione Bruno Kessler
------------------




More information about the grass-user mailing list