running processLandsatBatch
harisonkipkulei opened this issue · comments
I have an issue when running the processLandsatBatch. How can I solve the error. I have attached part of the code
Error in lfn[f]:2 : NA/NaN argument
Loading packages
library(raster)
library(devtools)
library(bfastSpatial)
library(readxl)
Set the working directory
projectPath <- "D:/baringo/data/"
inputdata <- "D:/baringo/data/"
setwd(projectPath)
srdir <- dirout <- file.path(dirname(rasterTmpFile()), 'bfmspatial')
dir.create(dirout, showWarning=FALSE)
Create an extent variable
newExtent <- extent(c(122659, 219716, 77689, 185491))
List the Landsat scenes
inputList <- list.files(inputdata, full.names=TRUE)
inputList
Process new landsat scenes
processLandsatBatch(x = inputList, outdir = dirout, srdir = srdir, delete = TRUE, vi = 'ndvi', mask = 'cfmask', keep = 0, e = newExtent, overwrite = TRUE)
@harisonkipkulei as a general comment, the bfastSpatial
project is old and unmaintained; I would therefore recommend not to use it. In particular these pre-processing functions you're trying to use are tailored to old Landsat collections that no longer exist; they probably have no chance of working at all. I don't really have a replacement in mind for that, but the geospatial data delivery ecosystem has evolved a lot and it is now a lot easier to access and assemble time-series stacks than it was 9 years ago when we created the bfastSpatial project.
Regarding the actual monitoring, I'd suggest you have a look at the nrt python package. The bfastmonitor algorithm is fully implemented there (see MoSum and CuSum) and it is more stable and much faster than bfastSpatial ever was.