[GRASS-user] Null-value in grass python array

Johannes Radinger johannesradinger at gmail.com
Fri Oct 10 04:32:17 PDT 2014


Hi,

I am using the GRASS-numpy functionality [1] to read a python numpy.array
from a GRASS raster map (GRASS7):

import grass.script.array as garray

a = garray.array()

a.read(map)



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?

And a second related question: Does grass.script.array.read() respect an
existing
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.


Best regards,
Johannes

[1]
http://grasswiki.osgeo.org/wiki/GRASS_Python_Scripting_Library#Interfacing_with_NumPy
[2]
http://grass.osgeo.org/programming6/classpython_1_1array_1_1array.html#a493c541122108eca3fc4b441fe1a5487
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20141010/de805154/attachment.html>


More information about the grass-user mailing list