Opened 9 years ago

Last modified 5 years ago

#2620 new enhancement

r.neighbours should offer to ignore centre value

Reported by: marisn Owned by: grass-dev@…
Priority: minor Milestone: 7.6.2
Component: Raster Version: 7.0.0
Keywords: r.neighbours Cc:
CPU: Unspecified Platform: Unspecified

Description

Currently there is not possible to ignore the centre cell when performing calculation in r.neighbours. There should be a flag to ignore centre cell value in calculation. It should be implemented as a flag as it should be available to all calculation methods.

Change History (18)

comment:1 by wenzeslaus, 9 years ago

For now, in case you don't know, you can use r.mapcalc with [m, n] operator to achieve the same results in less convenient way.

in reply to:  description ; comment:2 by glynn, 9 years ago

Replying to marisn:

Currently there is not possible to ignore the centre cell when performing calculation in r.neighbours.

You can use the weight= option to supply a kernel in which the centre cell has zero weight.

A flag may still be worth having if this is a sufficiently common case.

in reply to:  2 ; comment:3 by marisn, 9 years ago

Replying to glynn:

Replying to marisn:

Currently there is not possible to ignore the centre cell when performing calculation in r.neighbours.

You can use the weight= option to supply a kernel in which the centre cell has zero weight.

A flag may still be worth having if this is a sufficiently common case.

First - it is a documentation problem as module description is "Makes each cell category value a function of the category values assigned to the cells around it" - the problem with word "around" - I read it as "nearby cells excluding the centre cell". I took liberty to add a notice in r64860 that "around" means - "all surrounding cells + centre cell".

Second - it is not possible to use weights and circular neighbourhood at the same time (documentation states: "The -c flag and the weights parameter are mutually exclusive.")

wenzeslaus - thanks for hint. As I needed a count of neighbour cells, I ended with mapcalc expression "if(isnull(original), count, count-1)"

in reply to:  3 ; comment:4 by glynn, 9 years ago

Replying to marisn:

Second - it is not possible to use weights and circular neighbourhood at the same time (documentation states: "The -c flag and the weights parameter are mutually exclusive.")

More accurately, it is not possible to use weight= and an automatically-generated mask (either the circular mask generated by -c or the Gaussian mask generated by gauss= or the square mask generated in the absence of any other applicable option). Nothing prevents weight= from being used to supply a circular mask.

However, any automatically-generated mask (whether square, circular or Gaussian) is simply a short-cut whose behaviour could also be obtained by passing the appropriate mask via weight=. So the question isn't about what's possible, but what's possible without providing an explicit weights file.

There's no end to the set of masks which could be generated internally; the only question is which ones are common enough to warrant a short-cut.

in reply to:  4 comment:5 by marisn, 9 years ago

Replying to glynn:

Replying to marisn:

Second - it is not possible to use weights and circular neighbourhood at the same time (documentation states: "The -c flag and the weights parameter are mutually exclusive.")

There's no end to the set of masks which could be generated internally; the only question is which ones are common enough to warrant a short-cut.

Should there be a vote for and against providing a short-cut for "ignore centre cell"?

As r64860 now has a documentation enhancement to clarify current behaviour, this bug also can stay open for longer time and anyone can just then add "me too" comment.

comment:6 by pvanbosgeo, 9 years ago

Me too (would like such a short-cut)

comment:7 by neteler, 9 years ago

Milestone: 7.0.17.0.2

Ticket retargeted after 7.0.1 milestone closed

comment:8 by neteler, 8 years ago

Milestone: 7.0.27.0.3

Ticket retargeted after milestone closed

comment:9 by neteler, 8 years ago

Milestone: 7.0.3

Ticket retargeted after milestone closed

comment:10 by neteler, 8 years ago

Milestone: 7.0.4

Ticket retargeted after 7.0.3 milestone closed

comment:11 by martinl, 8 years ago

Milestone: 7.0.47.0.5

comment:12 by martinl, 8 years ago

Milestone: 7.0.57.3.0

comment:13 by martinl, 8 years ago

Milestone: 7.3.07.4.0

Milestone renamed

comment:14 by neteler, 6 years ago

Milestone: 7.4.07.4.1

Ticket retargeted after milestone closed

comment:15 by neteler, 6 years ago

Milestone: 7.4.17.4.2

comment:16 by martinl, 6 years ago

Milestone: 7.4.27.6.0

All enhancement tickets should be assigned to 7.6 milestone.

comment:17 by martinl, 5 years ago

Milestone: 7.6.07.6.1

Ticket retargeted after milestone closed

comment:18 by martinl, 5 years ago

Milestone: 7.6.17.6.2

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.