[GRASS-user] r.clump with diagonal cells

Dear all,

I just tried r.clump on a rastarized river with alternating patches of good
and bad habitat (values 1 and 2). However, due to its linear structure, many
cells of the same habitat patch are often only diagonally connected. So this
is a case where r.clump does not work (as stated in its manual).

So, as a suggestion, it’d be nice if also diagonal cells could be considered by r.clump (e.g. by setting a flag).

…or maybe someone of you has another idea to how to get unique values for each discrete patch (also diagonally connected cells of homogeneous habitat quality).

FYI r.clump has been tested on GRASS7.

best regards,
Johannes

Hi Johannes,

There is an add on module called r.clump4p available at at http://sil.uc.edu/downloads.html#software

It has an option to clump diagonal cells. It is also parallelized and completes much faster than r.clump.

Eric

On Jan 13, 2014 5:39 AM, “Johannes Radinger” <johannesradinger@gmail.com> wrote:

Dear all,

I just tried r.clump on a rastarized river with alternating patches of good
and bad habitat (values 1 and 2). However, due to its linear structure, many
cells of the same habitat patch are often only diagonally connected. So this
is a case where r.clump does not work (as stated in its manual).

So, as a suggestion, it’d be nice if also diagonal cells could be considered by r.clump (e.g. by setting a flag).

…or maybe someone of you has another idea to how to get unique values for each discrete patch (also diagonally connected cells of homogeneous habitat quality).

FYI r.clump has been tested on GRASS7.

best regards,
Johannes


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On Mon, Jan 13, 2014 at 12:39 PM, Johannes Radinger
<johannesradinger@gmail.com> wrote:

Dear all,

I just tried r.clump on a rastarized river with alternating patches of good
and bad habitat (values 1 and 2). However, due to its linear structure, many
cells of the same habitat patch are often only diagonally connected. So this
is a case where r.clump does not work (as stated in its manual).

So, as a suggestion, it'd be nice if also diagonal cells could be considered
by r.clump (e.g. by setting a flag).

Note that there is a more modern version here:

http://grasswiki.osgeo.org/wiki/AddOns/GRASS_6#r.clump2

http://grasswiki.osgeo.org/wiki/AddOns/GRASS7/raster#r.clump2

Markus

Thanks for the hint about r.clump2.

I just tried to apply it to my data. While this tool works with diagonally connected cells (in contrast to r.clump) it does not preserve the distinct category values of adjacent cells. Furthermore, as also mentioned in the manual: Linear elements are always clumped together, unless the e-flag is set (which basically ignores diagonally connected cells and thus is comparable to r.clump result). So as I’d like to have unique category values for the single (adjacent) patches this tool does not necessarily help me. However, good to know that there is such a tool available. For the moment, I’ll try an approach to buffer (r.grow) my raster lines before applying r.clump which could work.

best,
Johannes

···

On Mon, Jan 13, 2014 at 3:30 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Mon, Jan 13, 2014 at 12:39 PM, Johannes Radinger
<johannesradinger@gmail.com> wrote:

Dear all,

I just tried r.clump on a rastarized river with alternating patches of good
and bad habitat (values 1 and 2). However, due to its linear structure, many
cells of the same habitat patch are often only diagonally connected. So this
is a case where r.clump does not work (as stated in its manual).

So, as a suggestion, it’d be nice if also diagonal cells could be considered
by r.clump (e.g. by setting a flag).

Note that there is a more modern version here:

http://grasswiki.osgeo.org/wiki/AddOns/GRASS_6#r.clump2

http://grasswiki.osgeo.org/wiki/AddOns/GRASS7/raster#r.clump2

Markus

On Mon, Jan 13, 2014 at 3:30 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Mon, Jan 13, 2014 at 12:39 PM, Johannes Radinger
<johannesradinger@gmail.com> wrote:

Dear all,

I just tried r.clump on a rastarized river with alternating patches of good
and bad habitat (values 1 and 2). However, due to its linear structure, many
cells of the same habitat patch are often only diagonally connected. So this
is a case where r.clump does not work (as stated in its manual).

So, as a suggestion, it'd be nice if also diagonal cells could be considered
by r.clump (e.g. by setting a flag).

Note that there is a more modern version here:

http://grasswiki.osgeo.org/wiki/AddOns/GRASS_6#r.clump2

http://grasswiki.osgeo.org/wiki/AddOns/GRASS7/raster#r.clump2

I would recommend r.clump4p over r.clump2. r.clump4p is the fastest of
the three, even without parallelisation. Note that r.clump4p, like
r.clump, also clumps NULL cells, whereas only r.clump2 ignores NULL
cells.

Markus
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On Mon, Jan 13, 2014 at 12:39 PM, Johannes Radinger
<johannesradinger@gmail.com> wrote:

Dear all,

I just tried r.clump on a rastarized river with alternating patches of good
and bad habitat (values 1 and 2). However, due to its linear structure, many
cells of the same habitat patch are often only diagonally connected. So this
is a case where r.clump does not work (as stated in its manual).

So, as a suggestion, it'd be nice if also diagonal cells could be considered
by r.clump (e.g. by setting a flag).

Done in r59122. Diagonal cells are also considered with the new -d
flag. BTW, r.clump seems pretty fast to me, 200 million cells are
clumped in 10 seconds.

Markus M

...or maybe someone of you has another idea to how to get unique values for
each discrete patch (also diagonally connected cells of homogeneous habitat
quality).

FYI r.clump has been tested on GRASS7.

best regards,
Johannes

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user