Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am having some problems with the conversion from HDF to GeoTiff.

I am following the steps described in this webpage. The problem is that I can't find what is the NDVI subdataset name (XXXX) in order to run the gdaltranslate command.

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

This is the gdalinfo output for one of the files(MOD13C2.A2001001.005.2007078152825.hdf):

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)
share|improve this question
1  
What happens if you try the full name 'HDF4_EOS:EOS_GRID:"MOD13C2.A2001001.005.2007078152825.hdf":MOD_Grid_monthly_CMG‌​_VI:CMG 0.05 Deg Monthly NDVI' as input? –  Chethan S. Apr 21 '13 at 13:29
    
@Chethan S. My apologies Chethan. I didn't see your comment when I posted my answer. If you would like to post your comment as an answer, I will go ahead and delete mine. –  Cyrus Apr 21 '13 at 13:41
    
No worries Cyrus, I am still not sure if it works. I liked your answer and upvoted it too. So please do not delete it. :) –  Chethan S. Apr 21 '13 at 13:48
    
Thanks guys! Didn't work exactly how you suggested but it was close: 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 –  A.R Apr 21 '13 at 13:54
1  
@A.R I took another look at the link that you posted in your question and noticed that it mentions FWTools. I tested the method that Chethan and I suggested on Ubuntu and it worked okay, but I didn't test it with FWTools on Windows. Maybe the input name gets parsed a bit differently using FWTools? In any case, I'm glad you found a solution. I use FWTools at work sometimes and I'm sure I will refer back to your answer sooner or later. Thanks. –  Cyrus Apr 21 '13 at 15:57
show 2 more comments

1 Answer

up vote 2 down vote accepted

I think you almost have it. Be sure to add single quotes around the entire input name with double quotes around the hdf file name.

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

Hope that helps

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.