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.
TIA, Martin
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
------------------
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
(attachments)

On Monday 23 July 2007 18:13:28 Martin Wegmann wrote:
[....]
> 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?
it was a (re-)projection problem - the problem also occurs in ERDAS but wasn't
visible at the first sight.
Solved it by patching it using MRT and doing the processing afterwards.
Martin