Hi again,<div><br></div><div>In order not to confuse you, I'd like to inform that my last post was wrong, I have some mistakes in my script and came across wrong results.</div><div><br></div><div>Actually making group of chunks and exporting it making multiband image.</div>
<div>It is working slow, as it is filling nodata of each chunk with 0, and not concatenating them together.</div><div><br></div><div>So as I understand the only way to concatenate chunks of compressed image is r.patch....   <br>
<br><div class="gmail_quote">On Thu, Dec 6, 2012 at 12:48 PM, Andranik Hayrapetyan <span dir="ltr"><<a href="mailto:andranik.h89@gmail.com" target="_blank">andranik.h89@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Thank you for your response,</div><div><br></div><div>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.</div>


<div><br></div><div>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.</div>
<div><br></div><div>I think this is also not bad approach.</div><div><br></div><div>Regards,</div><div>Andranik   </div><div><div><br><br><div class="gmail_quote">On Wed, Dec 5, 2012 at 8:54 PM, Glynn Clements <span dir="ltr"><<a href="mailto:glynn@gclements.plus.com" target="_blank">glynn@gclements.plus.com</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br>
Andranik Hayrapetyan wrote:<br>
<br>
> I am trying to make a script which will split a raster map into chunks, do<br>
> the calculation on every chunk separately ( in parallel way ), and gather<br>
> together all the peaces.<br>
><br>
> So I am cutting the region into peaces, doing the calculation, restoring<br>
> region to default region and finally get small peaces of raster map in it's<br>
> default location and in default mapset.<br>
><br>
> Here is the problem of gathering the peaces together arises...<br>
><br>
> If I do it with r.patch, it is taking too long, and the whole meaning of<br>
> parallelism is disappearing.<br>
><br>
> So I thought about g.copy .<br>
><br>
> Is there a way to copy all the peaces into one layer without overwriting<br>
> the other peaces.<br>
<br>
</div>No.<br>
<div><br>
> For example I have chunk_1 and chunk_2, which are the parts of one map.<br>
>  How can I copy them into another map, so that they don't overwrite each<br>
> other ?<br>
<br>
</div>For an uncompressed map, you can simply concatenate the cell/fcell<br>
files (you still need to generate the metadata files, e.g. cellhd,<br>
range, etc).<br>
<br>
A compressed map starts with an array of row indices, and the rows<br>
typically won't all have the same length (or necessarily be in order<br>
and/or contiguous).<br>
<br>
If you know that the individual maps are disjoint, it would be<br>
possible to improve upon r.patch even while using the raster I/O API.<br>
<br>
In the case where the maps are disjoint vertical slices of the same<br>
region, it would be possible to improve significantly upon the raster<br>
I/O API by copying the compressed rows verbatim from the input<br>
cell/fcell files to the output file. That would avoid decompression,<br>
resampling and compression.<br>
<span><font color="#888888"><br>
--<br>
Glynn Clements <<a href="mailto:glynn@gclements.plus.com" target="_blank">glynn@gclements.plus.com</a>><br>
</font></span></blockquote></div><br>
</div></div></blockquote></div><br></div>