11

I'm trying to do a groundwater elevation map with an Ordinary Kriging on R, but always resulting on the lack of memory

cannot allocate vector of size 146.5 Mb

allocation (windows xp 32bit). Should I increase memory size and how, or should I reduce the grid size and how (kind of a newbie in R)?

following this example http://casoilresource.lawr.ucdavis.edu/drupal/node/438

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Ulmi
  • 501
  • 3
  • 5
  • what is your desired grid size? (how many rows/columns?) – Mike T Mar 28 '11 at 18:23
  • The grid size is 3202*2993. And I was doing the OK on a grd of 1's (I think!!) like the link but it always gaved that error. Then I changed 1 by 100 but it gaved the same error. – Ulmi Mar 28 '11 at 20:00
  • 2
    Consider migrating this question to SO: there are a lot of R experts there. – whuber Mar 28 '11 at 22:10
  • Something similar was discussed here: http://r.789695.n4.nabble.com/gstat-problem-with-lidar-data-td851290.html – markusN Mar 28 '11 at 22:52
  • will post at SO thx! but I think it's just too of big grid and with just 178 points, although tried the OK(global) on SAGA and it pulls it off with ease and after comparing with the RST interpolation on GRASS, the results don't difere that much...expected bigger diference! Thx for the tips!! – Ulmi Mar 28 '11 at 23:07
  • @whuber Or why not migrating to Cross-Validated under the tags: r, kriging, geo-statistics... There are plenty of good users of R and I'm certain they have knowledge in kriging. – deps_stats Apr 01 '11 at 18:44
  • @deps That's a good suggestion, but the question in its current form would be closed on Cross-Validated because it's not about statistics or data analysis; it's only about running the software. – whuber Apr 01 '11 at 18:53
  • @whuber You're absolutely right! My apologies... Maybe with a little make-up it will make it through. – deps_stats Apr 01 '11 at 19:51
  • Did you already have a look at the R FAQ. – johannes Mar 28 '11 at 18:36
  • Kriging requires inversion of the covariance matrix, which when done naively has a very large memory footprint and can easily exhaust memory, though it sounds like you've found another method. A few others are listed here: http://gis.stackexchange.com/questions/1041/open-source-methods-for-kriging – scw May 24 '11 at 08:08
  • i'm not very experienced with the R raster package but i know that this package was built to handle large raster file using small amount of RAM. – dickoa Apr 01 '11 at 13:39

1 Answers1

7

You do not provide us with the size of the data you want to krige, nor the size of the support on which you want to do that kriging, but I assume this would be pretty big.

The problem with R is that is loads everything into memory. In that case, you are simply running out of RAM.

Kriging is a very demanding process. The way you can manage that is to parrallelize it. See demo(snow) in the gstat package.

Alternatively, you can also use another interpolation method, more suitable to big data (eg the v.surf.* functions in GRASS).

Pierre
  • 308
  • 1
  • 7