[GRASS-user] Python - GRASS module output, r.univar

Johannes Radinger JRadinger at gmx.at
Mon Feb 6 09:30:17 EST 2012


Hi,

I try to write a python script for GRASS6.5 including a
WHILE loop. A certain calculation step (iterative) should
be performed until there are only NULL values in a raster.

I am not sure what is the best way to find out if there are
only NULL cells. I tried it with r.univar which gives no result
when there are only NULL cells in a raster (and no result is acutally
also a result :)). But how can I get that value to variable
in the python script? In the wiki there is something stated about
the grass.script.raster_info (e.g. for the max value):
max = grass.raster_info(inmap)['max']

Is there a special function also for the counts of cells? Or how
can I parse the result of r.univar to a python variable?

My loop:

while (count > 0):
    ...
    ...
    count = number of !isnull of raster A

What would you do? Suggestions are mostly welcome :)

cheers,
Johannes


-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                                  
Jetzt informieren: http://www.gmx.net/de/go/freephone/


More information about the grass-user mailing list