[Gdal-dev] gdal and hdf

C.Strobl at dlr.de C.Strobl at dlr.de
Mon Sep 4 11:12:44 EDT 2006


 
hello all,
 
i am working with den fwtools (GDAL 1.3.2.0, FWTools 1.0.5, released
2006/07/06) and i don't get it to convert hdf-files with gdal,
especially handling subsets didn't work. here is the description what i
tried. i tested aster- and modis-hdf4-files
 
Aster Level 1B
Data:
http://edcftp.cr.usgs.gov/pub/data/disaster/katrina/aster_L1B/AST_L1BE00
3090320051623270000000.tar.gz
<http://edcftp.cr.usgs.gov/pub/data/disaster/katrina/aster_L1B/AST_L1BE0
03090320051623270000000.tar.gz> 

 
gdalinfo -nogcp -nomd
"E:\usgs\aster\AST_L1BE003090320051623270000000.hdf"
 
Driver: HDF4/Hierarchical Data Format Release 4
Size is 512, 512
Coordinate System is `'
Subdatasets:
 
SUBDATASET_1_NAME=HDF4_EOS:EOS_SWATH:"E:\usgs\aster\AST_L1BE003090320051
623270
000000.hdf":VNIR_Swath:ImageData1
  SUBDATASET_1_DESC=[4200x4980] ImageData1 (8-bit unsigned integer)
 
SUBDATASET_2_NAME=HDF4_EOS:EOS_SWATH:"E:\usgs\aster\AST_L1BE003090320051
623270
000000.hdf":VNIR_Swath:ImageData2
  SUBDATASET_2_DESC=[4200x4980] ImageData2 (8-bit unsigned integer)
 
SUBDATASET_3_NAME=HDF4_EOS:EOS_SWATH:"E:\usgs\aster\AST_L1BE003090320051
623270
000000.hdf":VNIR_Swath:ImageData3N
  SUBDATASET_3_DESC=[4200x4980] ImageData3N (8-bit unsigned integer)
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  512.0)
Upper Right (  512.0,    0.0)
Lower Right (  512.0,  512.0)
Center      (  256.0,  256.0)
 
--------------------------------------------------
 
#gdal_translate
gdal_translate -of GTiff
"E:\usgs\aster\AST_L1BE003090320051623270000000.hdf"
e:\usgs\aster\AST_L1BE003090320051623270000000.tif
Input file contains subdatasets. Please, select one of them for reading.
 
--------------------------------------------------
 
analogue to the description given at
http://www.remotesensing.org/gdal/frmt_hdf4.html
<http://www.remotesensing.org/gdal/frmt_hdf4.html>  i tested gdalinfo
for subdatasets
 

gdalinfo
HDF4_EOS:EOS_SWATH:E:\usgs\aster\AST_L1BE003090320051623270000000.hdf:VN
IR_Swath:ImageData3N
 
and also some variations:
gdalinfo
HDF4_EOS:EOS_SWATH:"E:\usgs\aster\AST_L1BE003090320051623270000000.hdf":
VNIR_Swath:ImageData3N
gdalinfo
"HDF4_EOS:EOS_SWATH:E:\usgs\aster\AST_L1BE003090320051623270000000.hdf:V
NIR_Swath:ImageData3N"
gdalinfo
'HDF4_EOS:EOS_SWATH:E:\usgs\aster\AST_L1BE003090320051623270000000.hdf:V
NIR_Swath:ImageData3N'
 
--------------------------------------------------
 
nothing worked at all. so i tested a modis-file
 
 
MODIS Level 1B
 
Data:
http://outreach.eos.nasa.gov/Terra_CD-01/meta/modis/subset_MOD02_243.185
0.hdf
<http://outreach.eos.nasa.gov/Terra_CD-01/meta/modis/subset_MOD02_243.18
50.hdf> 
 
#without GCP(-nogcp) und metadata(-nomd)
gdalinfo -nogcp -nomd "E:\usgs\modis\subset_MOD02_243.1850.hdf"
 
Driver: HDF4/Hierarchical Data Format Release 4
Size is 512, 512
Coordinate System is `'
Subdatasets:
 
SUBDATASET_1_NAME=HDF4_EOS:EOS_SWATH:"E:\usgs\modis\subset_MOD02_243.185
0.hdf"
:MODIS_SWATH_Type_L1B:EV_250_Aggr1km_RefSB
  SUBDATASET_1_DESC=[2x2030x1354] EV_250_Aggr1km_RefSB (16-bit unsigned
integer)
 
 
SUBDATASET_2_NAME=HDF4_EOS:EOS_SWATH:"E:\usgs\modis\subset_MOD02_243.185
0.hdf"
:MODIS_SWATH_Type_L1B:EV_500_Aggr1km_RefSB
  SUBDATASET_2_DESC=[5x2030x1354] EV_500_Aggr1km_RefSB (16-bit unsigned
integer)
 
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  512.0)
Upper Right (  512.0,    0.0)
Lower Right (  512.0,  512.0)
Center      (  256.0,  256.0)
 
--------------------------------------------------
 
#gdal_translate
gdal_translate -of GTiff "E:\usgs\modis\subset_MOD02_243.1850.hdf"
e:\usgs\modis\subset_MOD02_243.1850.tif
Input file contains subdatasets. Please, select one of them for reading.
 
--------------------------------------------------
 
analogue to the description given at
http://www.remotesensing.org/gdal/frmt_hdf4.html
<http://www.remotesensing.org/gdal/frmt_hdf4.html>  i tested gdalinfo
for subdatasets
 

gdalinfo
HDF4_EOS:EOS_SWATH:E:\usgs\modis\subset_MOD02_243.1850.hdf:MODIS_SWATH_T
ype_L1B:EV_250_Aggr1km_RefSB
 
--------------------------------------------------
 
there were the same problems i had already with the aster-files
 
 
last i tried the sample files from
ftp://ftp.remotesensing.org/gdal/data/hdf4/
 
 
gdalinfo -nogcp -nomd
D:\user\OpenSource\Data\gdal\MO36MW14.chlor_MODIS.ADD2001089.004.2002186
190207.hdf
 
Driver: HDF4Image/HDF4 Dataset
Size is 1024, 512
Coordinate System is `'
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  512.0)
Upper Right ( 1024.0,    0.0)
Lower Right ( 1024.0,  512.0)
Center      (  512.0,  256.0)
Band 1 Block=1024x1 Type=UInt16, ColorInterp=Gray
 

gdalinfo -nogcp -nomd
D:\user\OpenSource\Data\gdal\S2002196124536.L1A_HDUN.BartonBendish.extra
ct.hdf
 
Driver: HDF4Image/HDF4 Dataset
Size is 320, 352
Coordinate System is `'
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  352.0)
Upper Right (  320.0,    0.0)
Lower Right (  320.0,  352.0)
Center      (  160.0,  176.0)
Band 1 Block=320x1 Type=Int16, ColorInterp=Gray
Band 2 Block=320x1 Type=Int16, ColorInterp=Gray
Band 3 Block=320x1 Type=Int16, ColorInterp=Gray
Band 4 Block=320x1 Type=Int16, ColorInterp=Gray
Band 5 Block=320x1 Type=Int16, ColorInterp=Gray
Band 6 Block=320x1 Type=Int16, ColorInterp=Gray
Band 7 Block=320x1 Type=Int16, ColorInterp=Gray
Band 8 Block=320x1 Type=Int16, ColorInterp=Gray
 

Both datasets have no subdatasets, so also the gdal_translate works
 
gdal_translate -of GTiff
D:\user\OpenSource\Data\gdal\MO36MW14.chlor_MODIS.ADD2001089.004.2002186
190207.hdf
D:\user\OpenSource\Data\gdal\MO36MW14.chlor_MODIS.ADD2001089.004.2002186
190207.tif
gdal_translate -of GTiff
D:\user\OpenSource\Data\gdal\S2002196124536.L1A_HDUN.BartonBendish.extra
ct.hdf
D:\user\OpenSource\Data\gdal\S2002196124536.L1A_HDUN.BartonBendish.extra
ct.tif
 
the problem: the second result-file i can't view with a normal image
software like irfanview or photoshop, but for example with erdas. ok,
thats not so important for me now. i think i make some mistake with the
syntax defining the datasubsets. maybe somebody can help me, maybe its a
windows special like ogr and vpf.
 
thanks and greetings from munich
christian
 
 
 
 
 
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20060904/e8467509/attachment.html


More information about the Gdal-dev mailing list