Opened 8 years ago

Last modified 5 years 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 8 years ago.

Download all attachments as: .zip

Change History (12)

by sbl, 8 years ago

Attachment: rescale_formula.diff added

in reply to:  description comment:1 by hellik, 8 years ago

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 by sbl, 8 years ago

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]

in reply to:  2 comment:3 by hellik, 8 years ago

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 by guano, 8 years ago

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 by martinl, 8 years ago

Milestone: 7.2.17.2.2

comment:6 by neteler, 7 years ago

Milestone: 7.2.27.2.3

Ticket retargeted after milestone closed

comment:7 by martinl, 7 years ago

Milestone: 7.2.3

Ticket retargeted after milestone closed

comment:8 by martinl, 7 years ago

Milestone: 7.2.4

comment:9 by neteler, 6 years ago

@guano: what's to be done here?

comment:10 by neteler, 6 years ago

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

comment:11 by neteler, 5 years ago

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