[R-sig-Geo] problem reading hdf image

Agustin Lobo alobolistas at gmail.com
Mon Oct 7 17:41:14 CEST 2013


Hi!

I get the following error when try to read an hdf image (release 4):

> modisima <- stack(file.path(modisdir,"MOD09A1.A2011289.h11v11.005.2011298101214.hdf"))
rgdal: version: 0.8-11, (SVN revision 479M)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.10.0, released 2013/04/24
Path to GDAL shared files: /usr/share/gdal/1.10
Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
Path to PROJ.4 shared files: (autodetected)
Error in GDALinfo(filename, silent = silent, returnRAT = RAT,
returnCategoryNames = RAT) :
  object 'RATlist' not found
Error in .rasterObjectFromFile(x, objecttype = "RasterBrick", ...) :
  Cannot create a RasterLayer object from this file.
In addition: Warning message:
In dim(x) : no bands in dataset

Also:

> GDALinfo(file.path(modisdir,"MOD09A1.A2011289.h11v11.005.2011298101214.hdf"))
Error in GDALinfo(file.path(modisdir,
"MOD09A1.A2011289.h11v11.005.2011298101214.hdf")) :
  object 'scaleOffset' not found
In addition: Warning messages:
1: In dim(x) : no bands in dataset
2: In GDALinfo(file.path(modisdir,
"MOD09A1.A2011289.h11v11.005.2011298101214.hdf")) :
  GeoTransform values not available

Nevertheless, hdf4 and 5 are listed by gdalDrivers() and, on the linux
terminal, I do get
output from gdalinfo (quite long, let me know if I should send it).
Also, I can display the
image in Qgis with no problem.

Any idea on where the problem could be?
Thanks,
Agus

> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
LC_TIME=es_ES.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=en_US.UTF-8
LC_PAPER=es_ES.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] rgdal_0.8-11  MODIS_0.10-8  raster_2.1-49 sp_1.0-13

loaded via a namespace (and not attached):
[1] grid_3.0.2      lattice_0.20-23 tools_3.0.2



More information about the R-sig-Geo mailing list