[GRASS-dev] quickest way to test whether a raster contains any non-null values in the current computational region ?

Markus Metz markus.metz.giswork at gmail.com
Fri Oct 19 14:21:00 PDT 2018


On Fri, Oct 19, 2018 at 4:04 PM Moritz Lennert <mlennert at club.worldonline.be>
wrote:
>
> On 19/10/18 15:48, Michel Wortmann wrote:
> > Hi Moritz,
> > How about this:
> >
> > info = grass.parse_command('r.univar', map='raster_xyz', flags='g')
> > print(int(info['n']), int(info['null_cells']))
>
> Thanks !
>
> Yes, this is one option. I was wondering if there was any faster option
> than actually having to read the map in the whole region with r.univar,
> but probably there isn't.

You need a module that reads the whole map, and the fastest way to get the
number of non-null values is most probably r.univar -g, as mentioned by
Michel Wortmann.

Markus M

>
> Moritz
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20181019/4a63cfef/attachment.html>


More information about the grass-dev mailing list