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