Skip to content

Commit

Permalink
r.valley.bottom compatibility with r.neighbors for grass8
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenpawley committed Sep 19, 2021
1 parent 31cd7ae commit bff63a4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/raster/r.valley.bottom/r.valley.bottom.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@
from grass.pygrass.gis.region import Region
from grass.pygrass.modules.shortcuts import general as g
from grass.pygrass.modules.shortcuts import raster as r
from grass.exceptions import ParameterError


if "GISBASE" not in os.environ:
print("You must be in GRASS GIS to run this program.")
Expand Down Expand Up @@ -492,7 +494,12 @@ def smooth_dem(DEM):

smoothed = rand_id("smoothed{}".format(L + 1))
TMP_RAST[L].append(smoothed)
r.neighbors(input=DEM, output=smoothed, size=11, gauss=3)

try:
r.neighbors(input=DEM, output=smoothed, size=11, gauss=3)
except ParameterError:
r.neighbors(input=DEM, output=smoothed, size=11, weighting_function="gaussian",
weighting_factor=3)

return smoothed

Expand Down

0 comments on commit bff63a4

Please sign in to comment.