r语言 - 如何在马赛克功能期间修复"Failure During Raster IO"?



我有一个35年的光栅时间序列。每年有两个光栅。它们是从谷歌地球引擎下载的,这迫使我将光栅分割成30多个瓦片进行下载。我用下面的代码把它们拼接在R中。

library(readxl)
library(tidyverse)
library(raster)
library(rgdal)
max13files <- list.files('./max13', pattern="*.tif$", full.names = T) 
a <- lapply(max13files, stack)
max13<-do.call(mosaic, c(a, fun=max))
namesa<-c("NDVI_13max"," NBR_13max", "Bright_13max", "Green_13max", "Wet_13max")
s13max<- unstack(max13)
for(i in seq_along(s13max)){writeRaster(s13max[[i]], file=namesa[i], format="GTiff")}

这在90%的时间里都很有效,只是有一些光栅一直会出现以下错误。

> max13<-do.call(mosaic, c(a, fun=max))
Error in rgdal::getRasterData(con, offset = offs, region.dim = reg, band = object@data@band) : 
Failure during raster IO
In addition: There were 50 or more warnings (use warnings() to see the first 50)
In addition: There were 50 or more warnings (use warnings() to see the first 50)
Warning messages:
1: In writeBin(as.vector(v[start:end, ]), x@file@con, size = x@file@dsize) :
problem writing to connection

相同的警告信息重复50次。

在时间序列中的70个光栅中,有三个始终存在此错误。其余的都很好。范围、投影和带与工作良好的光栅相同。我尝试过删除并重新下载其中一个错误年份。它并没有解决问题。从GEE下载每个光栅也需要大约一天的时间,因为它们在空间上很大,所以如果可能的话,我想尽量减少需要这样做的次数。

可能是什么问题?

发现了这个问题-它是来自谷歌地球引擎的一个损坏的瓦片。我将每个磁贴单独加载到ArcMap中,发现了损坏的磁贴。没有那块瓷砖就很好用。

此消息显示

Error in rgdal::getRasterData(con, offset = offs, region.dim = reg, band = object@data@band) : 
Failure during raster IO

表明存在错误的输入光栅。

鉴于此消息

Warning messages:
1: In writeBin(as.vector(v[start:end, ]), x@file@con, size = x@file@dsize) :
problem writing to connection

提示您的磁盘空间不足,可能是临时文件夹中的磁盘空间。

最新更新