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
When converting a subset of a multilayer SpatRaster that is out of memory to a RasterStack an error message appears but returns a RasterStack with the incorrect number of layers.
library(terra)
#> Warning: package 'terra' was built under R version 4.3.3#> terra 1.7.76
packageVersion("raster")
#> [1] '3.6.27'r<- rast(volcano)
r<- c(r, r*2,r*3,r*4)
names(r)<- paste0("lyr.", 1:nlyr(r))
inMemory(r)
#> [1] TRUE TRUE TRUE TRUEraster::stack(r[[1:2]]) |>raster::nlayers() #If in memory it works#> [1] 2
writeRaster(r,"test.tif", overwrite=TRUE)
r<- rast("test.tif")
inMemory(r)
#> [1] FALSEraster::stack(r[[1:2]]) |>raster::nlayers() #If out of memory an error message is shown but, a RasterStack of the wrong size is returned#> Error in `names<-`(`*tmp*`, value = names(from)) : #> incorrect number of layer names#> [1] 4raster::stack(r)[[1:2]] |>raster::nlayers() #However, the whole SpatRaster can be converted and then the RasterStack subset#> [1] 2
When converting a subset of a multilayer SpatRaster that is out of memory to a RasterStack an error message appears but returns a RasterStack with the incorrect number of layers.
Created on 2024-05-06 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: