[GRASS-user] How to find the second largest value in a series of rasters.

Moritz Lennert mlennert at club.worldonline.be
Thu Dec 8 17:06:59 EST 2011


On 08/12/11 21:30, Marcello Gorini wrote:
> Dear all,
>
> I have to find the maximum value for each cell in a series of rasters and
> generate both a maximum value map and a categorical map with the raster
> number which contains the maximum value.
>
> R.series is, therefore, perfect to accomplish that using
> method=maximum,max_raster.
>
> My problem is that I also need to find the *second largest* value and the
> corresponding raster number which contains the second largest value.
>
> I am doing that by iterating over all classes through a shell script, but it
> obviously takes much more time than using a simple r.series command.
>
> Can anyone share any idea on how to accomplish that using r.series or
> something similar?
>
> Thanks in advance for your thoughts.

Since you have the max_raster value, can't you just take that map out of 
the list you submit to r.series and find the new max_raster and value ?

Moritz


More information about the grass-user mailing list