Opened 10 years ago
Last modified 6 years ago
#2620 new enhancement
r.neighbours should offer to ignore centre value
Reported by: | marisn | Owned by: | |
---|---|---|---|
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 , 10 years ago
follow-up: 3 comment:2 by , 10 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.
follow-up: 4 comment:3 by , 10 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)"
follow-up: 5 comment:4 by , 10 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.
comment:5 by , 10 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:11 by , 9 years ago
Milestone: | 7.0.4 → 7.0.5 |
---|
comment:12 by , 8 years ago
Milestone: | 7.0.5 → 7.3.0 |
---|
comment:15 by , 6 years ago
Milestone: | 7.4.1 → 7.4.2 |
---|
comment:16 by , 6 years ago
Milestone: | 7.4.2 → 7.6.0 |
---|
All enhancement tickets should be assigned to 7.6 milestone.
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.