<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">Il 25/mar/2017 20:07, "Paulo van Breugel" <<a href="mailto:p.vanbreugel@gmail.com">p.vanbreugel@gmail.com</a>> ha scritto:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Hi,</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
For a script I am working on, I am looking for a way to select a X number of raster cells and their values into a numpy array. I can create a layer with r.random, and read in that layer into a numpy array, but I rather avoid having to read in the whole raster layer. I can also from within the script run r.randomĀ  to generate a raster layer, r.stats to export the resulting raster layer as a text file (with n flag), and than read in the text file in Python. But I wonder if there is not a more direct way to accomplish this..<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">You can read col and row from GRASS Region and use random python function to calculate random x and y and later query a pygrass raster object</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Cheers,<br>
<br>
Paulo<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Cheers</div><div dir="auto">Luca</div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div></div></div></div>