On Thu, Mar 15, 2001 at 12:46:10AM +0100, Morten Hulden wrote:
On Mon, 12 Mar 2001, Eric G. Miller wrote:
> Be careful of r.proj! I've filed a bug against it for reading the
> entire raster into memory before projecting it. It can cream your
> system. i.rectify is an alternative (and smarter about the memory),
> though you need tie points.
Not true any longer since grass5.0beta10 or so. r.proj now does not
allocate more memory than necessary and only reads in the overlapping
region of the input map.
So, if I'm projecting a very large raster, it reads the whole thing...
r.proj is also "region sensitive", i.e. you have to set your current
location to the 'default region' in order to get a map that covers the
whole location. if you have set your current region to a smaller area and
the input map does not cover all of the location you _may_ get an 'input
map is outside current region' error.
Well, trying to project a 78MB image, with 64MB RAM and 200 MB swap, and
I had to kill the process just before it killed my system.
... main.c ...
339 G_set_window(&incellhd);
340 fdi = G_open_cell_old(inmap->answer, setname);
341 ibuffer = (FCELL **) readcell(fdi);
342 G_close_cell(fdi);
343 G__switch_env();
... readcell.c ...
21 nrows = G_window_rows();
22
23 ibuffer = (FCELL **) G_malloc(sizeof(FCELL **) * nrows);
24
25 fprintf(stderr,"Allocating memory and reading input map... ");
26 G_percent(0, nrows, 5);
27 for (row = 0; row < nrows; row++){
28 ibuffer[row] = (FCELL *) G_allocate_raster_buf(FCELL_TYPE);
29 if(G_get_raster_row(fdi, ibuffer[row], row, FCELL_TYPE) < 0)
30 G_fatal_error("Error reading input");
31 G_percent(row, nrows - 1, 5);
32 }
33 return(ibuffer);
Looks like it reads the whole thing to me, barring region sensitive
clipping... IMHO, it should only read as many rows as it currently
needs (which would be a max of 3, no?). So the reads should be nested
in with the writes...
--
Eric G. Miller <egm2@jps.net>