Skip to content
Prev 25256 / 29559 Next

Error reading hdf files with rgdal

Hello all,
I'm working with some .hdf files containing MODIS satellite data, but I
have been unable to read them into R using rgdal and gdalUtils since the
last rgdal update. Has anyone else experienced these issues and does anyone
have a suggested fix? The code I'm attempting to use and error message are
as follows:

library(raster)
library(rgdal)
library(gdalUtils)
file<-"MODWCW_2017010_DAILY_AQUA_CHLORA_EC_1KM.hdf"
sds<-get_subdatasets(file)
Error in split1[[1]] : subscript out of bounds

I've tried this code with .hdf files from different sources, and they
return the same error. I've attempted to download and use an older version
of rgdal as a workaround, but I am having trouble obtaining its software
dependencies and would prefer a fix compatible with the current version of
the package.
Thanks!
Kelly