I have 3 rasters and I want to use them in a expression, but I can find different na values in the 3 rasters. For example: I can have a value in 2 rasters but in the 3 i have na,then in this case I cannot apply my expression.
Follow my code:
for(i in 1:length(name_BSA)){
i <- 1
if(days_BSA[i] == days_WSA[i] & days_WSA[i] == days_FDS[i]){
BSA <- raster(list_BSA[i])
WSA <- raster(list_WSA[i])
FDS <- raster(list_FDS[i])
brick <- brick(BSA, WSA, FDS)
if(!is.na(BSA[,]) & !is.na(WSA[,]) & !is.na(FDS[,])){
BLSA <- ((1-FDS[i])*BSA[i]) + (FDS[i] * WSA[i])
}
name_BLSA <- paste0("BLSA_",days_BSA[i])
writeRaster(BLSA, file.path(main,output_folder, name_BLSA), format = "GTiff", overwrite = T)
}
}
My problem is this part:!is.na(BSA[,]) & !is.na(WSA[,]) & !is.na(FDS[,])
This part does not work.
Someone can help me?