<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 25-03-17 23:11, Laurent C. wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CABmXgEFD9s+5Ter0nNo27tOqjESrh75GbTjeY5D9FYHuxs0y6g@mail.gmail.com">
<div dir="auto">Hello,
<div dir="auto"><br>
</div>
<div dir="auto">If you need a fixed number of points, you might
do a while loop that randomly generate coordinates then add
the point only if the array is not null at those coordinates.</div>
</div>
</blockquote>
<br>
Thanks, I'll give that a try. Will also see how this compares with
using r.random/r.what in terms of speed.<br>
<br>
<blockquote type="cite"
cite="mid:CABmXgEFD9s+5Ter0nNo27tOqjESrh75GbTjeY5D9FYHuxs0y6g@mail.gmail.com">
<div dir="auto">
<div dir="auto"><br>
</div>
<div dir="auto">Laurent</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 25 Mar 2017 13:55, "Paulo van
Breugel" <<a href="mailto:p.vanbreugel@gmail.com"
moz-do-not-send="true">p.vanbreugel@gmail.com</a>> wrote:<br
type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="color:black">
<p style="margin:0 0 1em
0;color:black;font-family:sans-serif">On 25
March 2017 20:21:18 Luca Delucchi <<a
href="mailto:lucadeluge@gmail.com" target="_blank"
moz-do-not-send="true">lucadeluge@gmail.com</a>>
wrote:</p>
<p style="margin:0 0 1em
0;color:black;font-family:sans-serif">>
Il 25/mar/2017 20:07, "Paulo van Breugel" <<a
href="mailto:p.vanbreugel@gmail.com" target="_blank"
moz-do-not-send="true">p.vanbreugel@gmail.com</a>>
ha<br>
> scritto:<br>
><br>
> Hi,<br>
><br>
><br>
> Hi,<br>
><br>
><br>
> For a script I am working on, I am looking for a
way to select a X
number<br>
> of raster cells and their values into a numpy
array. I can create a
layer<br>
> with r.random, and read in that layer into a
numpy array, but I rather<br>
> avoid having to read in the whole raster layer. I
can also from within
the<br>
> script run r.randomĀ to generate a raster layer,
r.stats to
export the<br>
> resulting raster layer as a text file (with n
flag), and than read in
the<br>
> text file in Python. But I wonder if there is not
a more direct way to<br>
> accomplish this..<br>
><br>
><br>
> You can read col and row from GRASS Region and
use random python
function<br>
> to calculate random x and y and later query a
pygrass raster object<br>
></p>
<p style="margin:0 0 1em 0;color:black"><br>
Thanks. And what if I have a mask or null values in
the target raster.<br>
</p>
<p style="margin:0 0 1em
0;color:black;font-family:sans-serif"><br>
><br>
> Cheers,<br>
><br>
> Paulo<br>
><br>
><br>
> Cheers<br>
> Luca<br>
</p>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
grass-dev mailing list<br>
<a href="mailto:grass-dev@lists.osgeo.org"
moz-do-not-send="true">grass-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-dev"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.osgeo.org/<wbr>mailman/listinfo/grass-dev</a><br>
</blockquote>
</div>
</div>
</blockquote>
<br>
</body>
</html>