Guest User

Untitled

a guest
Jan 23rd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. Error in .local(x, values, ...) :
  2. values must be numeric, integer or logical.
  3.  
  4. inR <- 'D://test/TS_combined_clipped.tif'
  5. outR <- 'D://test/R_test3.tif'
  6.  
  7. rasterB <- brick(inR)
  8. fun1 <-function(x){
  9. years = c(1972,1973,1974,1975,1984,1984)
  10. na_idx = which(is.na(x))
  11. years = years[-na_idx]
  12. x <- na.omit(x)
  13. idx = detectChangePoint(x, cpmType='Student', ARL0=500)$changePoint
  14. return(years[idx]) # this raises error
  15. # print(years[idx]) # This does *not* raises any error
  16. }
  17.  
  18. r <- calc(rasterB, fun=fun1, filename=outR, overwrite=TRUE)
Add Comment
Please, Sign In to add comment