3

I am getting the following, while extracting all values with:

rs<-getValues(rster)

Error in getRasterData(con, offset = offs, region.dim = reg, band = object at data@band): long vectors not supported yet: memory.c:3308

rster
class       : RasterLayer 
dimensions  : 76740, 80200, 6154548000  (nrow, ncol, ncell)
resolution  : 50, 50  (x, y)
extent      : -1888000, 2122000, -4847000, -1010000  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=aea +lat_1=-18 +lat_2=-36 +lat_0=0 +lon_0=132 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs 
data source : /data/her134/BA/GDA94albers/clum50m0314 
names       : clum50m0314 
values      : 100, 663  (min, max)
attributes  :
    ID  COUNT LU_CODEV7 LU_CODEV7N TERTIARY_V7
from: 100 540931     1.0.0        100  1.0.0 Conservation and natural environments
to  : 663   1755     6.6.3        663 6.6.3 Estuary/coastal waters - intensive use
                          SECONDARY_V7 PRIMARY_V7 CLASSES_18
1.0 Conservation and natural environments 1 Conservation and natural environments          1
            6.6 Estuary/coastal waters                                 6 Water         17
       C18_DESCRIPTION
Nature conservation (1.1)
           Water (6.0)

Using: platform x86_64-unknown-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 1.0
year 2014
month 04
day 10
svn rev 65387
language R
version.string R version 3.1.0 (2014-04-10) nickname Spring Dance

raster version 2.2.31

Linux: LSB Version: core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64:desktop-4.0-amd64:desktop-4.0-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.2-amd64:graphics-3.2-noarch:graphics-4.0-amd64:graphics-4.0-noarch Distributor ID: SUSE LINUX Description: SUSE Linux Enterprise Server 11 (x86_64) Release: 11 Codename: n/a

I used to be able to handle this sized raster in earlier versions.

Any ideas of a workaround?

2

Just looks like memory issues, try getting blocks of rows instead, process them and replace the values.

require(foreach,doParallel,raster,rgdal)

    #Determine optimal block size for loading in MODIS stack data
    block_width = 15
    nrows = dim(stack_in)[1]
    nblocks <- nrows%/%block_width
    bs_rows <- seq(1,nblocks*block_width+1,block_width)
    bs_nrows <- rbind(matrix(block_width,length(bs_rows)-1,1),nrows-bs_rows[length(bs_rows)]+1)
    print('Working on the following rows')
    print(paste(bs_rows))

    #Register the parallel backend
    registerDoParallel(workers)

    result <- foreach(i = 1:length(bs_rows), .combine = rbind) %dopar% {
      print(paste("Working on row",i))
      stack_values = getValues(stack_in, bs_rows[i], bs_nrows[i])
      return(FUN(stack_values))
     }

  stopImplicitCluster()

Hope this helps you get started.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.