[R-sig-Geo] reading ascii grid memory issues

Ashton Shortridge ashton at msu.edu
Fri Dec 5 15:22:31 CET 2008


Alex,

On Thursday 04 December 2008 05:48:59 pm Alexander.Herr at csiro.au wrote:
> > I am wondering if anyone has alternative options (preferably with
> > example) that enable to read in large grids, do some calculations and
> > save a new grid?

You may need a hammer, and R is the screwdriver. But it's a useful 
screwdriver, so maybe you can make it work here. AsciiGrid files are very 
simple. They are text obviously, with a 5 or 6 line header and then rows of 
grid cell values. This means that fairly generic R I/O commands can work with 
them. scan() is where I'd start if I were you. 

Actually I'd start with another thing Barry brought up - make yourself a 
really small asciigrid file, like 4x3, and practice on that while you figure 
out your processing. 

Here's one I have used: modify the values as you see fit.

nrows 4
ncols 5
xllcorner 0.000000
yllcorner 0.000000
cellsize 10.000000
NODATA_value -9999
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0


yours,

Ashton
-- 
Ashton Shortridge
Associate Professor			ashton at msu.edu
Dept of Geography			http://www.msu.edu/~ashton
235 Geography Building		ph (517) 432-3561
Michigan State University		fx (517) 432-1671




More information about the R-sig-Geo mailing list