1

I am trying to extract a band from a MODIS hdf file on windows with gdal_translate.

Here's my prompt:

gdal_translate -of GTiff "HDF4_EOS:EOS_GRID:\"MOD13A2.A2009001.h17v08.005.2009020092120.hdf\":MODIS_Grid_16DAY_1km_VI:1km 16 days NDVI" NDVI.tif

However I get:

ERROR 4: `'HDF4_EOS:EOS_GRID:MOD11A2.A2009001.h17v07.005.2009014044746.hdf:MODIS
_Grid_8Day_1km_LST:LST_Day_1km'' does not exist in the file system,
and is not recognised as a supported dataset name.

GDALOpen failed - 4
`'HDF4_EOS:EOS_GRID:MOD11A2.A2009001.h17v07.005.2009014044746.hdf:MODIS_Grid_8Da
y_1km_LST:LST_Day_1km'' does not exist in the file system,
and is not recognised as a supported dataset name.

I imagine it's something to do with my syntax being a bit 'iffy' though it seems perfectly fine to me

Help much appreciated

  • Try using \\` for \` – Nathan W Aug 15 '13 at 10:39
  • As in: gdal_translate -of GTiff `HDF4_EOS:EOS_GRID:\\`MOD13A2.A2009001.h17v08.005.2009020092120.hdf\\`:MODIS_Grid_16DAY_1km_VI:1km 16 days NDVI` NDVI.tif. This doesn't work either :( – James Aug 15 '13 at 10:58
1

No need to escape the double quotes. The following works (in Win XP):

gdal_translate "HDF4_EOS:EOS_GRID:"MOD13A2.A2009001.h17v08.005.2009020092120.hdf":MODIS_Grid_16DAY_1km_VI:1km 16 days NDVI" NDVI.tif

Also note that GTiff is the default output format and doesn't need to be specified.

| improve this answer | |
0

Avoid the : in the files name. It may be treated by the Windows Operating system as drive delimiter.

| improve this answer | |
  • But those are in stored within the hdf file... eg MODIS_Grid_16DAY_1km_VI:1km 16 days NDVI is the subdataset name. Will \: work? – James Aug 15 '13 at 11:11
  • Have you tried only one quotation around all, and no backslashes? I'm not sure whether ecaping with backslashes works on the command line. – AndreJ Aug 15 '13 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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