landam / grass-gis-git-migration-test

0 stars 0 forks source link

r.neighbours should offer to ignore centre value #161

Open landam opened 5 years ago

landam commented 5 years ago

Reported by marisn on 13 Mar 2015 17:30 UTC 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.

GRASS GIS version and provenance

7.0.0

Migrated-From: https://trac.osgeo.org/grass/ticket/2620

landam commented 5 years ago

Comment by wenzeslaus on 13 Mar 2015 20:56 UTC 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.

landam commented 5 years ago

Comment by glynn on 14 Mar 2015 11:17 UTC Replying to [ticket:2620 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.

landam commented 5 years ago

Comment by marisn on 15 Mar 2015 09:27 UTC Replying to [comment:2 glynn]:

Replying to [ticket:2620 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 https://trac.osgeo.org/grass/changeset/64860 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)"

landam commented 5 years ago

Comment by glynn on 16 Mar 2015 14:21 UTC Replying to [comment:3 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.

landam commented 5 years ago

Comment by marisn on 17 Mar 2015 07:32 UTC Replying to [comment:4 glynn]:

Replying to [comment:3 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 https://trac.osgeo.org/grass/changeset/64860 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.

landam commented 5 years ago

Comment by pvanbosgeo on 17 Mar 2015 08:21 UTC Me too (would like such a short-cut)

landam commented 5 years ago

Comment by neteler on 30 Jul 2015 21:19 UTC Ticket retargeted after 7.0.1 milestone closed

landam commented 5 years ago

Comment by neteler on 20 Nov 2015 17:08 UTC Ticket retargeted after milestone closed

landam commented 5 years ago

Comment by neteler on 28 Jan 2016 08:02 UTC Ticket retargeted after milestone closed

landam commented 5 years ago

Comment by neteler on 28 Jan 2016 08:06 UTC Ticket retargeted after 7.0.3 milestone closed

landam commented 5 years ago

Modified by @landam on 12 May 2016 06:37 UTC

landam commented 5 years ago

Modified by @landam on 25 Aug 2016 15:51 UTC

landam commented 5 years ago

Comment by @landam on 27 Aug 2016 13:42 UTC Milestone renamed

landam commented 5 years ago

Comment by neteler on 26 Jan 2018 11:40 UTC Ticket retargeted after milestone closed

landam commented 5 years ago

Modified by neteler on 12 Jun 2018 20:48 UTC

landam commented 5 years ago

Comment by @landam on 25 Sep 2018 16:53 UTC All enhancement tickets should be assigned to 7.6 milestone.

landam commented 5 years ago

Comment by @landam on 25 Jan 2019 21:08 UTC Ticket retargeted after milestone closed