[GRASS-dev] [GRASS GIS] #3415: Mark raster NULL values as None in PyGRASS

GRASS GIS trac at osgeo.org
Mon Sep 11 06:07:01 PDT 2017


#3415: Mark raster NULL values as None in PyGRASS
--------------------------+-------------------------
  Reporter:  marisn       |      Owner:  grass-dev@…
      Type:  defect       |     Status:  new
  Priority:  normal       |  Milestone:  7.4.0
 Component:  PyGRASS      |    Version:  unspecified
Resolution:               |   Keywords:
       CPU:  Unspecified  |   Platform:  Unspecified
--------------------------+-------------------------

Comment (by glynn):

 Replying to [comment:1 zarch]:

 > Well, but then for CELL raster instead to have an array of integer you
 will have an array of objects, I did not perform any benchmark but it
 seems not very intuitive as well.

 For FP data, NaN should be used for nulls. This avoids the need for
 explicit null handling in most cases.

 For integer data, consider either (or both of):
 1. converting to a
 [https://docs.scipy.org/doc/numpy/reference/maskedarray.html masked
 array]. This isn't quite as transparent as NaN, but is typically easier
 than using a separate mask array.
 2. converting to double (np.float64), with NaN as null. But this isn't
 suitable if the data is to be used with e.g. bitwise operations, or used
 as indices.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3415#comment:3>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list