Dear all, I am new to R and coding in general, I have a time series (5 years daily data) data set from MODIS LST images with missing values due to cloud cover. I want to interpolate these missing values using IDW but I keep getting highly absurd results if I do not delete the missing values.On deleting the locations containing NaN, it returns an error on missing values.
I can't use the spacetime package as I am not able to comprehend how my input.csv would look like since the grids are the rows and the days are the columns in my dataset. pls find the code below. Desperately looking for a solution. Many thanks in advance Code: LST_IDW<- read.csv("sampledata.csv", header= TRUE) LST_IDW$x<- LST_IDW$X LST_IDW$y<- LST_IDW$Y coordinates(LST_IDW) = ~x + y plot(LST_IDW) x.range <- as.numeric(c(2510750, 2583950)) y.range <- as.numeric(c(216186, 289389)) grd <- expand.grid(x = seq(from = x.range[1], to = x.range[2], by = 1000), y = seq(from = y.range[1], to = y.range[2], by = 1000)) coordinates(grd) <- ~x + y gridded(grd) <- TRUE plot(grd, cex = 1.5, col = "grey") points(LST_IDW, pch = 1, col = "red", cex = 1) idw <- idw(formula = day1 ~ 1, locations = LST_IDW, newdata = grd) idw.output = as.data.frame(idw) names(idw.output)[1:3] <- c("long", "lat", "var1.pred") write.csv(results.csv", x=idw.output) [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo