我正在尝试使用de raster包来读取多层(多频带)图像(ENVI格式[.hdr]),它具有160个refletance值和160个每像素波长值,但是当我使用我开发的代码时,程序只返回1个波段,refletance值与.section1=raster("./x")
getValuesBlock(section1, row=1, nrows=1, col=1, ncol=1 )
相关
好吧,从它的外观来看,在我看来,你想要将一个特定的光栅文件带读入R环境,
require("raster")
dir.file<-"dir/file.hdf"
#Reading the first band of the raster image
band1<-raster(dir.file,band=1)
更改band
方法的raster()
参数的值以控制栅格的band id。希望这可以帮助
要创建多层Raster对象,如果它们在一个文件中,则应使用brick
函数;如果它们在多个文件中,则应使用stack
函数。
library(raster)
# example file name
f <- system.file("external/rlogo.grd", package="raster")
b <- brick(f)
b
# a single cell value
b[1]