<div dir="ltr">Hi,<div><br></div><div>I am using the GRASS-numpy functionality [1] to read a python numpy.array</div><div>from a GRASS raster map (GRASS7):</div><div><br></div><div><pre class="" style="font-family:monospace,monospace;padding:0px;border:0px none white;color:rgb(0,0,0);line-height:1.2em;font-stretch:normal;font-size:12px;margin-top:0px;margin-bottom:0px;vertical-align:top;background:none rgb(249,249,249)"><span class="" style="color:rgb(255,119,0);font-weight:bold">import</span> grass.<span class="">script</span>.<span class="" style="color:rgb(220,20,60)">array</span> <span class="" style="color:rgb(255,119,0);font-weight:bold">as</span> garray</pre></div><div><pre class="" style="font-family:monospace,monospace;padding:0px;border:0px none white;color:rgb(0,0,0);line-height:1.2em;font-stretch:normal;font-size:12px;margin-top:0px;margin-bottom:0px;vertical-align:top;background:none rgb(249,249,249)">a <span class="" style="color:rgb(102,204,102)">=</span> garray.<span class="" style="color:rgb(220,20,60)">array</span><span class="">(</span><span class="">)</span></pre><pre class="" style="font-family:monospace,monospace;padding:0px;border:0px none white;color:rgb(0,0,0);line-height:1.2em;font-stretch:normal;font-size:12px;margin-top:0px;margin-bottom:0px;vertical-align:top;background:none rgb(249,249,249)">a.<span class="">read</span><span class="">(</span><span class="" style="color:rgb(0,128,0)">map</span><span class="">)</span>
</pre></div><div><br></div><div>Here [2] it says that also the null value can be specified. So what is the actual null value in GRASS so that the raster map is correctly saved as numpy.array with numpy.nan where appropriate?</div><div><br></div><div>And a second related question: Does grass.script.array.read() respect an existing</div><div>MASK so that areas that are masked will get numpy.nan? Of course this can also be done within numpy like map[numpy.isnan(mask)] but this again needs to properly define the nan value when reading the raster mask into an numpy.array.</div><div><br></div><div><br></div><div>Best regards,</div><div>Johannes</div><div><br></div><div>[1]<a href="http://grasswiki.osgeo.org/wiki/GRASS_Python_Scripting_Library#Interfacing_with_NumPy">http://grasswiki.osgeo.org/wiki/GRASS_Python_Scripting_Library#Interfacing_with_NumPy</a></div><div>[2]<a href="http://grass.osgeo.org/programming6/classpython_1_1array_1_1array.html#a493c541122108eca3fc4b441fe1a5487">http://grass.osgeo.org/programming6/classpython_1_1array_1_1array.html#a493c541122108eca3fc4b441fe1a5487</a><br></div></div>