在 中R Raster package
,当我将netCDF
文件加载到 araster
并尝试使用 amask
或crop
光栅时shapefile
,我收到错误:
"*Error in `colnames<-`(`*tmp*`, value = names(object)) :
attempt to set 'colnames' on an object with less than two dimensions*"
这是示例代码
library(ncdf4)
library(raster)
nc <- brick("in.netcdf.nc", varname = "diff", values=TRUE )
crs(nc) <- "+proj=utm +zone=17 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
everShp <- shapefile("EVERareas")
nc.sub <- mask(nc, everShp)
绘图显示nc
和everShp
是 2D 和空间重叠。感谢您对此错误的任何建议。