Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在一个循环中堆叠一些栅格,例如:
for(month in 1:12){ . . . "some algorithm spiting out a raster called 'sm_esa'" sm_esa_stack<-stack(sm_esa) }
最后,我想创建一个有 12 层(每个月)的堆栈。但是我的最后一行显然会被每个新栅格覆盖而不是堆叠。有什么提示吗?
在循环外部实例化一个空堆栈,在循环的每次迭代之后,通过堆叠当前堆栈和新 Rasterlayer 将新 rasterLayer 添加到堆栈中。
x <- stack() for(month in 1:12){ . . . "some algorithm spiting out a raster called 'sm_esa'" x <- stack( x , sm_esa ) }