1

I am trying to extract all layers of the MODIS LAI/FPAR imageries using gdalUTILs library, I am getting this error, could anyone help me out of this I am trying to use

Get a list of SDS names

sds <- get_subdatasets('MOD15A2H.A2016289.h28v08.006.2016302012314.hdf')

Isolate the name of the first SDS

name <- sds[1]`enter code here`
filename <- 'name/of/output/file.tif'
gdal_translate(sds[1], dst_dataset = filename)

Load the Geotiff created into R

r <- raster(filename)

and the error is

> sds <- get_subdatasets('MOD15A2H.A2016289.h28v08.006.2016302012314.hdf')

Error in split1[[1]] : subscript out of bounds In addition: Warning message: running command '"C:\Program Files (x86)\Boundless\OpenGeo\bin\gdalinfo.exe" "MOD15A2H.A2016289.h28v08.006.2016302012314.hdf"' had a status 1

Ratan Uday Kumar
  • 5,738
  • 6
  • 35
  • 54
amit haldar
  • 129
  • 1
  • 10
  • i think gdaltranslate wants a filename as input, while you are trying to pass "data" to it. You may also be interested in this package, which should allow to do what you need automatically : https://github.com/lbusett/MODIStsp – lbusett Nov 03 '16 at 07:37
  • Thanks Lorenzo. I am trying to install the package you suggested but this error is coming > install_github("Ibusett/MODIStsp") Error in curl::curl_fetch_disk(url, x$path, handle = handle) : Couldn't connect to server its may be because of restrictive internet connection, but if this is the case how do I resolve this!?? – amit haldar Nov 04 '16 at 02:06
  • Seems possible. Did you ever try to install a package from github before? – lbusett Nov 04 '16 at 07:16
  • I don't think so, I am not sure! when we install packages it access cran (R Archive) only right, in that case I haven't. So whats your suggestion? – amit haldar Nov 07 '16 at 07:07
  • Try installing a different package from github (E. G. install_github("hadley/devtools"). If that fails, then you can't install from github. In that case, you can tryi installing modistsp from source. (I. E. Download the zip and use R Cmd build). Or (maybe easier) clone the modistsp repo in your rstudio as a new git project (you will have to install git on your computer), and build it with ctrl-shift-b) – lbusett Nov 07 '16 at 07:19

1 Answers1

1

Check the hdf file size. If it's 1 or 2kb then its html error file. I had same issue for MOD15A2H product.

Dheeraj
  • 11
  • 1