0

我正在尝试使用 de raster 包来读取具有 160 个反射率值和 160 个每个像素波长值的多层(多波段)图像(ENVI 格式 [.hdr]),但是当我使用我开发的代码时,程序仅返回 1 个波段和相关的反射值。section1=raster("./x") getValuesBlock(section1, row=1, nrows=1, col=1, ncol=1 )

4

2 回答 2

0

要创建多层 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]
于 2018-09-10T18:09:05.033 回答
0

好吧,从它的外观来看,在我看来,您想将光栅文件的特定波段读取到 R 环境中,

require("raster")
dir.file<-"dir/file.hdf"
#Reading the first band of the raster image
band1<-raster(dir.file,band=1)

更改方法的band参数值raster()以控制栅格的波段 ID。希望这可以帮助

于 2018-09-10T14:43:20.000 回答