[GRASS-user] g.copy several map layers into one layer without overwriting .....

Andranik Hayrapetyan andranik.h89 at gmail.com
Thu Dec 6 00:48:20 PST 2012

Thank you for your response,

I found an alternative way to avoid r.patch. But it is only for special
cases when you need to output image after calculation at once.

I put all chunks into a group with i.group and after it export the group
with r.out.gdal .  It is much more faster then when I r.patch chunks and
export after it.

I think this is also not bad approach.


On Wed, Dec 5, 2012 at 8:54 PM, Glynn Clements <glynn at gclements.plus.com>wrote:

> Andranik Hayrapetyan wrote:
> > I am trying to make a script which will split a raster map into chunks,
> do
> > the calculation on every chunk separately ( in parallel way ), and gather
> > together all the peaces.
> >
> > So I am cutting the region into peaces, doing the calculation, restoring
> > region to default region and finally get small peaces of raster map in
> it's
> > default location and in default mapset.
> >
> > Here is the problem of gathering the peaces together arises...
> >
> > If I do it with r.patch, it is taking too long, and the whole meaning of
> > parallelism is disappearing.
> >
> > So I thought about g.copy .
> >
> > Is there a way to copy all the peaces into one layer without overwriting
> > the other peaces.
> No.
> > For example I have chunk_1 and chunk_2, which are the parts of one map.
> >  How can I copy them into another map, so that they don't overwrite each
> > other ?
> For an uncompressed map, you can simply concatenate the cell/fcell
> files (you still need to generate the metadata files, e.g. cellhd,
> range, etc).
> A compressed map starts with an array of row indices, and the rows
> typically won't all have the same length (or necessarily be in order
> and/or contiguous).
> If you know that the individual maps are disjoint, it would be
> possible to improve upon r.patch even while using the raster I/O API.
> In the case where the maps are disjoint vertical slices of the same
> region, it would be possible to improve significantly upon the raster
> I/O API by copying the compressed rows verbatim from the input
> cell/fcell files to the output file. That would avoid decompression,
> resampling and compression.
> --
> Glynn Clements <glynn at gclements.plus.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20121206/7b4dce06/attachment.html>

More information about the grass-user mailing list