Skip to content

Commit

Permalink
r.horizon: variable needs to be reset for point mode (#3441)
Browse files Browse the repository at this point in the history
The bug is that for part of the angles it results in zeros. It comes up when there are nulls at the edge of the raster, test was added.
  • Loading branch information
petrasovaa committed Feb 22, 2024
1 parent c00f531 commit 6a52add
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions raster/r.horizon/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ double horizon_height(void)

tanh0 = 0.;
length = 0;
zp = z_orig;

height = searching();

Expand Down
6 changes: 6 additions & 0 deletions raster/r.horizon/testsuite/test_r_horizon.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ def test_point_mode_multiple_direction(self):
stdout = module.outputs.stdout
self.assertMultiLineEqual(first=ref2, second=stdout)

# include nulls along the edge
self.runModule("g.region", raster="elevation", w="w-100")
self.assertModule(module)
stdout = module.outputs.stdout
self.assertMultiLineEqual(first=ref2, second=stdout)

def test_point_mode_multiple_direction_artificial(self):
"""Test mode with 1 point and multiple directions with artificial surface"""
module = SimpleModule(
Expand Down

0 comments on commit 6a52add

Please sign in to comment.