Proprietary hdf file structure

spatial
hdf

#1

I am attempting to use a shapefile to classify a NEON data hdf raster file in RStudio. The problem is with accessing the reflectance data in the proprietary hdf file. Here is the code I have so far:

#source("http://bioconductor.org/biocLite.R")
#biocLite("rhdf5")
library(rhdf5)
    R_code=
f <- "<filename>"
b <- "<bandnumber">
wl <- h5read(f, "/KONZ/Reflectance/Metadata/Spectral_Data")$Wavelength
refl <- t(h5read(f, "/KONZ/Reflectance/Reflectance_Data", index = list(b,NULL,NULL))[1,,])
proj.neon <- sub(pattern = "UTM", replacement = "utm", x = h5read(f, "/KONZ/Reflectance/Metadata/Coordinate_System")$Proj4)
ext <- h5read(f, "/KONZ/Reflectance/Metadata/Coordinate_System")$Map_Info

The last line results in the following error:

Error in if (any(index[[i]] > dim[i])) { : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
NAs introduced by coercion 
Error in H5Dread(h5dataset = h5dataset, h5spaceFile = h5spaceFile, h5spaceMem = h5spaceMem,  : 
  HDF5. Dataset. Read failed.
Error in t.default(h5read(f, "/NOGP/Reflectance/Reflectance_Data", index = list(b,  : 
  argument is not a matrix

#2

Beyond encouraging you to run

 h5version()
This is Bioconductor rhdf5 2.26.1 linking to C-library HDF5 1.10.3

There's not a whole lot most of us can help you with without example data to go with the code. I can speculate that the first error arises from passing the NULLs in the assignment of refl the second of course wants a matrix, which it didn't get.


#3

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.