Open TimWeatherman opened 8 years ago
It works if you use full path.
Yes, looks like it. It also works if the file is in a subdirectory, like this:
QC <- raster(get_subdatasets("data/MCD15A2H.A2002193.h19v03.006.2015149105839.hdf")[3])
In order to make it work correctly with files in the working directory, this seems to be the solution:
QCG <- raster(get_subdatasets(normalizePath("MCD15A2H.A2002193.h19v03.006.2015149105839.hdf"))[3])
So perhaps https://github.com/dutri001/bfastSpatial/blob/master/R/cleanMODIS.R#L54 should be changed to:
sds <- get_subdatasets(normalizePath(x))
In cleanMODIS.r line 56, the call to raster() is on the subset string rather than the filename that is returned from readGDAL(), like on line 55. This causes an error, file does not exist.
A reproducible case is:
The first line fails, the second line works correctly.