Opened 3 years ago

Last modified 7 months ago

#3269 new defect

r.roughness.vector: bug in rescale formula

Reported by: sbl Owned by: grass-dev@…
Priority: normal Milestone: 7.8.3
Component: Addons Version:
Keywords: r.roughness.vector Cc:
CPU: Unspecified Platform: All

Description

There is a little bug in the formula that produces the "Fischers K" output (line 317). "- 1" should not be in there.

Attachments (1)

rescale_formula.diff (590 bytes) - added by sbl 3 years ago.

Download all attachments as: .zip

Change History (12)

Changed 3 years ago by sbl

Attachment: rescale_formula.diff added

comment:1 in reply to:  description Changed 3 years ago by hellik

Replying to sbl:

There is a little bug in the formula that produces the "Fischers K" output (line 317). "- 1" should not be in there.

It's a port of g6 addon: https://grass.osgeo.org/grass64/manuals/addons/r.roughness.window.vector.html

Could you have a look how the calculation is there?

comment:2 Changed 3 years ago by sbl

Yes, same issue there. For what I can see, line 265 in https://trac.osgeo.org/grass/browser/grass-addons/grass6/raster/r.roughness/r.roughness.window.vector.sh should be changed equally like this:

- r.mapcalc $FISHER = "($window * $window - $STRENGTH) / ($window * $window - 1)"
+ r.mapcalc $FISHER = "($window * $window - $STRENGTH) / ($window * $window)"

Result should be scaled from 0 to 1. Thus formula should be:

V' = (max(V[i-j]) - V) / max(V[i-j]

comment:3 in reply to:  2 Changed 3 years ago by hellik

Replying to sbl:

Yes, same issue there. For what I can see, line 265 in https://trac.osgeo.org/grass/browser/grass-addons/grass6/raster/r.roughness/r.roughness.window.vector.sh should be changed equally like this:

- r.mapcalc $FISHER = "($window * $window - $STRENGTH) / ($window * $window - 1)"
+ r.mapcalc $FISHER = "($window * $window - $STRENGTH) / ($window * $window)"

Result should be scaled from 0 to 1. Thus formula should be:

V' = (max(V[i-j]) - V) / max(V[i-j]

Could you ping Carlos, the author of both addons, regarding this issue?

comment:4 Changed 3 years ago by guano

Hi there, sorry for the late reply.

I went looking in the paper by Hobson (1972), and the original formula for Fischer K is: (N-1)/(N-R), but in the module (and in my paper) I used the *inverse* of it (so smooth areas would end up with a low value). Inverting the formula gives (N-R)/(N-1).

comment:5 Changed 3 years ago by martinl

Milestone: 7.2.17.2.2

comment:6 Changed 3 years ago by neteler

Milestone: 7.2.27.2.3

Ticket retargeted after milestone closed

comment:7 Changed 2 years ago by martinl

Milestone: 7.2.3

Ticket retargeted after milestone closed

comment:8 Changed 2 years ago by martinl

Milestone: 7.2.4

comment:9 Changed 15 months ago by neteler

@guano: what's to be done here?

comment:10 Changed 15 months ago by neteler

Component: DefaultAddons
Keywords: AddOn removed
Milestone: 7.2.4
Version: unspecified

comment:11 Changed 7 months ago by neteler

Milestone: 7.8.3
Note: See TracTickets for help on using tickets.