从HDF转换为GeoTiff


11

从HDF转换为GeoTiff时遇到一些问题。

我正在按照此网页中描述的步骤进行操作。问题是我无法找到NDVI子数据集名称(XXXX)来运行gdaltranslate命令。

gdal_translate -of GTiff HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf"
 :MOD_Grid_monthly_CMG_VI:XXXX modis_ndvi01.tif

这是文件(MOD13C2.A2001001.005.2007078152825.hdf)之一的gdalinfo输出:

E:\GDAL>gdalinfo MOD13C2.A2001001.005.2007078152825.hdf
Driver: HDF4/Hierarchical Data Format Release 4
Files: MOD13C2.A2001001.005.2007078152825.hdf
Size is 512, 512
Coordinate System is `'
Metadata:
  HDFEOSVersion=HDFEOS_V2.9
  LOCALGRANULEID=MOD13C2.A2001001.005.2007078152825.hdf
  PRODUCTIONDATETIME=2007-03-19T19:28:25.000Z
  DAYNIGHTFLAG=Both
  REPROCESSINGACTUAL=reprocessed
  LOCALVERSIONID=5.2.1
  REPROCESSINGPLANNED=further update is anticipated
  SCIENCEQUALITYFLAG=Not Investigated
  AUTOMATICQUALITYFLAGEXPLANATION=No automatic quality assessment is performed in the PGE
  AUTOMATICQUALITYFLAG=Passed
  SCIENCEQUALITYFLAGEXPLANATION=See http://landweb.nascom.nasa.gov/cgi-bin/QA_WWW/qaFlagPage.cgi?sat=terra for the product Science Quality status.
  QAPERCENTMISSINGDATA=0
  QAPERCENTOUTOFBOUNDSDATA=0
  QAPERCENTCLOUDCOVER=0
  QAPERCENTINTERPOLATEDDATA=100
  PARAMETERNAME=CMG 0.05 Deg Monthly NDVI

(...)

Subdatasets:
  SUBDATASET_1_NAME=HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly NDVI
  SUBDATASET_1_DESC=[3600x7200] CMG 0.05 Deg Monthly NDVI MOD_Grid_monthly_CMG_VI (16-bit integer)
  SUBDATASET_2_NAME=HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly EVI
  SUBDATASET_2_DESC=[3600x7200] CMG 0.05 Deg Monthly EVI MOD_Grid_monthly_CMG_VI (16-bit integer)
  SUBDATASET_3_NAME=HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly VI Quality
  SUBDATASET_3_DESC=[3600x7200] CMG 0.05 Deg Monthly VI Quality MOD_Grid_monthly_CMG_VI (16-bit unsigned integer)
  SUBDATASET_4_NAME=HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly red reflectance
  SUBDATASET_4_DESC=[3600x7200] CMG 0.05 Deg Monthly red reflectance MOD_Grid_monthly_CMG_VI (16-bit integer)
  SUBDATASET_5_NAME=HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly NIR reflectance
  SUBDATASET_5_DESC=[3600x7200] CMG 0.05 Deg Monthly NIR reflectance MOD_Grid_monthly_CMG_VI (16-bit integer)
  SUBDATASET_6_NAME=HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly blue reflectance
  SUBDATASET_6_DESC=[3600x7200] CMG 0.05 Deg Monthly blue reflectance MOD_Grid_monthly_CMG_VI (16-bit integer)
  SUBDATASET_7_NAME=HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly MIR reflectance
  SUBDATASET_7_DESC=[3600x7200] CMG 0.05 Deg Monthly MIR reflectance MOD_Grid_monthly_CMG_VI (16-bit integer)
  SUBDATASET_8_NAME=HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly Avg sun zen angle
  SUBDATASET_8_DESC=[3600x7200] CMG 0.05 Deg Monthly Avg sun zen angle MOD_Grid_monthly_CMG_VI (16-bit integer)
  SUBDATASET_9_NAME=HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly NDVI std dev
  SUBDATASET_9_DESC=[3600x7200] CMG 0.05 Deg Monthly NDVI std dev MOD_Grid_monthly_CMG_VI (16-bit integer)
  SUBDATASET_10_NAME=HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly EVI std dev
  SUBDATASET_10_DESC=[3600x7200] CMG 0.05 Deg Monthly EVI std dev MOD_Grid_monthly_CMG_VI (16-bit integer)
  SUBDATASET_11_NAME=HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly #1km pix used
  SUBDATASET_11_DESC=[3600x7200] CMG 0.05 Deg Monthly #1km pix used MOD_Grid_monthly_CMG_VI (8-bit unsigned integer)
  SUBDATASET_12_NAME=HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly #1km pix +-30deg VZ
  SUBDATASET_12_DESC=[3600x7200] CMG 0.05 Deg Monthly #1km pix +-30deg VZ MOD_Grid_monthly_CMG_VI (8-bit unsigned integer)
  SUBDATASET_13_NAME=HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly pixel reliability
  SUBDATASET_13_DESC=[3600x7200] CMG 0.05 Deg Monthly pixel reliability MOD_Grid_monthly_CMG_VI (8-bit integer)

1
如果您尝试输入全名“ HDF4_EOS:EOS_GRID:“ MOD13C2.A2001001.005.2007078152825.hdf”:MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly NDVI,该怎么办?
Chethan S.

@Chethan S.我很抱歉,Chethan。发布答案时,我没有看到您的评论。如果您想发表评论作为答案,我会继续删除我的。
赛勒斯(Cyrus)2013年

不用担心,赛勒斯,我仍然不确定它是否有效。我喜欢您的答案,也对此表示赞同。因此,请不要删除它。:)
Chethan S.

2
谢谢你们!并非完全按照您的建议工作,但是已经接近了: gdal_translate -of GTiff HDF4_EOS:EOS_GRID:“ MOD13C2.A2001001.005.2007078152825.hdf”:MOD_Grid_monthly_CMG_VI:“ CMG 0.05 Deg Monthly NDVI” ndvi.tiff
Gago-Silva

1
@AR我再次查看了您在问题中发布的链接,并注意到其中提到了FWTools。我测试了Chethan和我在Ubuntu上建议的方法,它可以正常工作,但是我没有在Windows上使用FWTools测试它。也许使用FWTools解析输入名称有些不同?无论如何,我很高兴您找到了解决方案。有时我会在工作中使用FWTools,所以我相信迟早会再参考您的回答。谢谢。
赛勒斯(Cyrus)2013年

Answers:


7

我想你差不多了。确保在整个输入名称周围加上单引号,在hdf文件名称周围加上双引号。

gdal_translate -of GTiff 'HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG_VI:CMG 0.05 Deg Monthly NDVI'

希望能有所帮助

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.