You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can set a tempdir in terraOptions that contains a "~" and it is considered valid (and is valid for other functions such as writeRaster); however this will lead to an error later on when the computer attempts to write temp files there. To avoid confusion perhaps have a call to path.expand internally as this solves the issue or throw an error saying the path cannot be used.
library(terra)
#> Warning: package 'terra' was built under R version 4.3.1#> terra 1.7.38if(!dir.exists("~/temp")){
dir.create("~/temp")
}
terraOptions(tempdir=("~/temp"))
r<- rast(matrix(nrow=10000, ncol=10000))
set.seed(5)
values(r)<- rnorm(ncell(r))
terrain(r)
#> Error: [terrain] path does not exist
terraOptions(tempdir=(path.expand("~/temp")))
terrain(r)
#> |---------|---------|---------|---------|========================================= #> class : SpatRaster #> dimensions : 10000, 10000, 1 (nrow, ncol, nlyr)#> resolution : 1, 1 (x, y)#> extent : 0, 10000, 0, 10000 (xmin, xmax, ymin, ymax)#> coord. ref. : #> source : spat_4DTcZdBbRm1vP2J_24864.tif #> name : slope #> min value : 0.003808846 #> max value : 69.063812256
You can set a
tempdir
interraOptions
that contains a "~" and it is considered valid (and is valid for other functions such aswriteRaster
); however this will lead to an error later on when the computer attempts to write temp files there. To avoid confusion perhaps have a call topath.expand
internally as this solves the issue or throw an error saying the path cannot be used.Created on 2023-06-21 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: