[GRASS-user] r.rescale - float instead of integer?

Johannes Radinger JRadinger at gmx.at
Thu Mar 24 03:31:56 EDT 2011


Am 24.03.2011 um 07:34 schrieb Hamish:

> Johannes 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.
>
> g.mlist + 'r.info -r' in a loop.

I thought more about the pipe command in python like:

p = grass.pipe_command('r.stats',flags='c',input='map')
        result = {}
        for line in p.stdout:
            val,count = line.strip().split()
            result[int(val)] = int(count)
        p.wait()

  but in combination with r.info to read the max value, but I don't  
know yet how
to realize it (the code in the for loop of p.stdout).

maybe someone has an idea...

cheers
/johannes


>
>
> Hamish
>
>
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20110324/ef3ec25d/attachment.html


More information about the grass-user mailing list