Johannes Radinger wrote:

> I think r.mapcalc is probably the best solution, but as I don't know the 
> maximum
> value in every case (I've to process several maps), I wanted to automatize.
> Probably I've to write a script to read the max value and parse it to the 
> mapcalc function.
> My problem: First, I don't know how to do that, Second there is this 
> python-script issue
> on my mac (see other thread)...

"r.info -r ..." will output the minimum and maximum values.

For a shell script, you can use e.g.:

        eval `r.info -r $inmap`
        r.mapcalc "$outmap = float($inmap) / $max"

For a Python script, you can use grass.script.raster_info(), e.g.:

        import grass.script as grass

        max = grass.raster_info(inmap)['max']
        grass.mapcalc("$outmap = $inmap / $max",
                      inmap = inmap, outmap = outmap, max = max)

-- 
Glynn Clements <gl...@gclements.plus.com>
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to