1

I am trying the following command to get info on the NDVI MODIS layer stored in HDF file. I always receive an error. the command and error as below: gdalinfo HDF4_EOS:EOS_GRID:MYD13A2.A2015297.h16v05.005.2015314081208.hdf:MODIS_Grid_16DAY_1km_VI:1 km 16 days NDV

error: FAILURE: Too many command options.

  • I don't believe you are using the correct command (or the correct input). See gdal.org/gdalinfo.html gdalinfo is looking for a file – MaryBeth Jan 21 '16 at 16:22
  • 1
    @MaryBeth in the case of HDF containers you can adress the subdatasets directly by using their full name (of which the filename of the parent file is just a part). – Kersten Jan 22 '16 at 7:49
  • Thanks! I see now that wrapping in quotes would be fine--the parameters just didn't look right to me :) – MaryBeth Jan 22 '16 at 15:21
1

You are trying to adress a subdataset inside a HDF container directly. There are two ways you can do that with gdalinfo:

  1. Put the complete name of the subdataset in parantheses gdalinfo " HDF4_EOS:EOS_GRID:MYD13A2.A2015297.h16v05.005.2015314081208.hdf:MODIS_Grid_16DAY_1km_VI:1 km 16 days NDVI"

  2. Use the subdataset option gdalinfo -sd 1 MYD13A2.A2015297.h16v05.005.2015314081208.hdf

  • I am still new, Would you please add more clarification on -sd 2. I need to understand the meaning – Omar Ali Jan 21 '16 at 16:21
  • See @Daniels s answer for further clarification. -sd stands for subdataset and tells gdal which subdataset to select when more than 1 is present. – Kersten Jan 22 '16 at 7:48
0

The sd flag will retrieve a subdataset that's inside the file (if present). It's explained in gdalinfo man page.

The number after the sd flag will be the subdataset number. But be carefull. For MOD13Q1, NDVI is subdataset 1. Subdataset 2 is EVI. And I believe the same order applies to MYD13A2

You can see the subdataset numbers by issuing gdalinfo on the hdf file, without the sd flag.

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.