[GRASSLIST:1615] Re: Problem reprojecting...
Morten Hulden
morten at ngb.se
Thu Mar 15 08:35:04 EST 2001
On Wed, 14 Mar 2001, Eric G. Miller wrote:
> So, if I'm projecting a very large raster, it reads the whole thing...
> ... 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();
The above used to be at the begining of main.c ( version <
grass5.0beta10), which was very annoying because r.proj always started by
allocating memory for the whole input map, and did so even if the map was
completely outside the output region. I inserted checks and map trimming
functions that abort the module (if there are no overlapping parts) or
change the incellhd before calling readcell() so only overlapping parts
are read.
> 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...
It depends on the size of the output region. But yes, if your output
region is as large as, or larger than your input map, the whole map will
be read into memory.
Of course you are right that this should be done dynamically, but that
means a major rewrite of r.proj, and creates other problems. E.g. it may
be necessary to read in the same part of the map several times due to
special shape and rotation relations between input and output maps, or
due to special interpolation methods.
But for now, if you are low on memory you can always do the projections in
parts, using the region sensitivity of r.proj. That is, define subregions
in the output location and project into each region separately. Only
the part of the input map corresponding to the current region will be
read into memory. Then use r.patch to get one single map.
regards
Morten
More information about the grass-user
mailing list