删除“;时间“;光栅砖R的尺寸

删除“;时间“;光栅砖R的尺寸,r,time-series,raster,R,Time Series,Raster,鉴于以下情况: library(raster) r <- raster(ncol=10, nrow=10) s <- stack(lapply(1:3, function(x) setValues(r, runif(ncell(r))))) s <- setZ(s, as.Date('2000-1-1') + 0:2,name="time") s getZ(s) 如果“time”维度不是问题,那么该错误的解决方案是什么 谢谢你的想法。奇怪!我发现将rasterstack写入.

鉴于以下情况:

library(raster)
r <- raster(ncol=10, nrow=10)
s <- stack(lapply(1:3, function(x) setValues(r, runif(ncell(r)))))
s <- setZ(s, as.Date('2000-1-1') + 0:2,name="time")
s
getZ(s)
如果“
time
”维度不是问题,那么该错误的解决方案是什么


谢谢你的想法。

奇怪!我发现将
rasterstack
写入
.nc
,然后使用
brick
导入可以抑制错误。这是一个痛苦的过程,因为我必须将所有文件写入
.nc
。希望有一种简单的方法将
光栅堆栈
转换为
光栅砖
cr <- crop(P, extent(Germany),snap="out")

NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files

Error in R_nc4_def_var_float: NetCDF: String match to name in use
Name of variable that the error occurred on: "time"
I.e., you are trying to add a variable with that name to the file, but it ALREADY has a variable with that name!
  [1] "----------------------"
[1] "Var:  time"
[1] "Ndims:  3"
[1] "Dimids: "
[1] 2 1 0
Error in ncvar_add(nc, vars[[ivar]], verbose = verbose, indefine = TRUE) :
  Error in ncvar_add, defining var time