具有多个栅格的求和函数中的Stackapply错误

时间:2019-07-13 06:31:08

标签: r

我创建了一个按月年份对栅格求和的函数,它很好用,但是当我在其他计算机上运行代码时,mes_sum堆栈的所有图像的值均为0。我无法理解该错误,因为在其他计算机上效果很好。我认为该错误可能是内存错误,但是R不会显示消息“在向量中分配错误...”

mes_año<- format(as.Date(dias, format = "%Y-%m-%d"), format = "%Y%m")
mes_año<- as.integer(mes_año);mes_año

mes_sum<-stackApply(stack(files), indices=mes_año, fun=sum, na.rm=T)

错误:

> mes_sum
class       : RasterBrick 
dimensions  : 63, 52, 3276, 58  (nrow, ncol, ncell, nlayers)
resolution  : 0.08983153, 0.08983153  (x, y)
extent      : -75.72798, -71.05674, -49.22768, -43.56829  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 
data source : C:\Users\TPPC\AppData\Local\Temp\RtmpKolenM\raster\r_tmp_2019-07-13_032823_15524_68776.grd 
names       : index_201403, index_201404, index_201405, index_201406, index_201407, index_201408, index_201409, index_201410, index_201411, index_201412, index_201501, index_201502, index_201503, index_201504, index_201505, ... 
min values  :            0,            0,            0,            0,            0,            0,            0,            0,            0,            0,            0,            0,            0,            0,            0, ... 
max values  :            0,            0,            0,            0,            0,            0,            0,            0,            0,            0,            0,            0,            0,            0,            0, ... 

良好的喷射力(相同的代码,不同的计算机:

> mes_sum
class       : RasterBrick 
dimensions  : 63, 52, 3276, 58  (nrow, ncol, ncell, nlayers)
resolution  : 0.08983153, 0.08983153  (x, y)
extent      : -75.72798, -71.05674, -49.22768, -43.56829  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 
data source : in memory
names       : index_201403, index_201404, index_201405, index_201406, index_201407, index_201408, index_201409, index_201410, index_201411, index_201412, index_201501, index_201502, index_201503, index_201504, index_201505, ... 
min values  :   0.60000002,   2.40125140,   7.95000005,  15.93932509,  13.05649427,   6.75000021,  10.20000026,   0.15000001,   3.30000007,  11.40000042,   0.90000001,   0.35000001,   8.85000017,  32.55000037,  19.86704370, ... 
max values  :     405.6248,     651.3500,    1057.0718,     732.1000,     998.9205,    1085.4109,     778.4997,     697.0117,    1108.9277,     521.9504,     555.6580,     312.7431,     934.3000,     602.0671,    1185.9418, ...

0 个答案:

没有答案