[Gdal-dev] Read hdf band, inverse dimensions

Lucena, Ivan ivan.lucena at pmldnet.com
Thu Oct 4 23:28:22 EDT 2007


Jan,

I once had a problem just like that and the solution was to 
translate/project the data to geotiffs using "Modis Swath Reprojection 
Tool" and then go back to GDAL to work with the tifs.

Ref.: [http://edcdaac.usgs.gov/landdaac/tools/mrtswath/]

Good luck,

Ivan

Jan Cermak wrote:
> 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
> 
> 



More information about the Gdal-dev mailing list