[Gdal-dev] Read hdf band, inverse dimensions

Jan Cermak jcermak at atmos.washington.edu
Thu Oct 4 20:45:09 EDT 2007


Hi!

I am trying to read a band from a MODIS hdf file. This in itself does 
not seem to be a problematic thing to do; however, the dimensions of the 
array are inverse.

gdalinfo myfile.hdf (or gdal.Dataset.GetSubDatasets) yields:
[snip]
SUBDATASET_52_NAME=HDF4_EOS:EOS_SWATH:'myfile.hdf':mod06:Cloud_Mask_1km
SUBDATASET_52_DESC=[2040x1354x2] Cloud_Mask_1km mod06 (8-bit integer)
[snip]

So there are two bands of size 2040x1354 in my subdataset. However, in 
order for gdal to recognize them as two bands the dimensions would have 
to be [2x2040x1354].

Accordingly, when I do
gdalinfo HDF4_EOS:EOS_SWATH:'myfile.hdf':mod06:Cloud_Mask_1km
I get information on 2040 different bands, each of size 1354x2

What can I do to get my two bands? I know I could read 2040 datasets and 
then reassemble them. But that takes 2/3 eternity.

All help appreciated!

Jan


-- 
Jan Cermak
Visiting Scientist
Department of Atmospheric Sciences
University of Washington
Seattle WA 98195-1640

phone: +1 206 543 2044
fax:   +1 206 543 0308



More information about the Gdal-dev mailing list