Skip to content

Commit

Permalink
fix addons broken due to GRASS 8 modules API
Browse files Browse the repository at this point in the history
fix #616
  • Loading branch information
pesekon2 committed Dec 6, 2021
1 parent 6f7667e commit c1d027f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
Expand Up @@ -200,7 +200,7 @@ def get_size(vector):
quiet=True,
overwrite=True,
)
sizeselected = grass.parse_command("v.db.select", map=tmpvector, flags="v")
sizeselected = grass.parse_command("v.db.select", map=tmpvector, format="vertical")
sizesstr = [x.split("|")[1:] for x in sizeselected if x.startswith("tmparea|")][0]
sizes = [float(x) for x in sizesstr]
return sum(sizes)
Expand Down
17 changes: 7 additions & 10 deletions src/raster/r.valley.bottom/r.valley.bottom.py
Expand Up @@ -495,16 +495,13 @@ def smooth_dem(DEM):
smoothed = rand_id("smoothed{}".format(L + 1))
TMP_RAST[L].append(smoothed)

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,
)
r.neighbors(
input=DEM,
output=smoothed,
size=11,
weighting_function="gaussian",
weighting_factor=3,
)

return smoothed

Expand Down
14 changes: 3 additions & 11 deletions src/vector/v.habitat.dem/v.habitat.dem.py
Expand Up @@ -157,15 +157,7 @@ def main():
PixelArea = Xres * Yres
global tmp

## check if r.geomorphon addon is installed
if not grass.find_program("r.geomorphon", "--help"):
grass.fatal(
_("The 'r.geomorphon' addon was not found, install it first:")
+ "\n"
+ "g.extension r.geomorphon"
)

## check if r.geomorphon addon is installed
## check if r.sun.hourly addon is installed
if not grass.find_program("r.sun.hourly", "--help"):
grass.fatal(
_("The 'r.sun.hourly' addon was not found, install it first:")
Expand Down Expand Up @@ -285,7 +277,7 @@ def main():
grass.run_command(
"v.db.select",
map=v_habitat,
flags="v",
format="vertical",
layer=1,
columns=v_column,
where="habarea < %s" % (PixelArea),
Expand All @@ -296,7 +288,7 @@ def main():
grass.run_command(
"v.db.select",
map=v_habitat,
flags="v",
format="vertical",
layer=1,
columns=v_column,
file=smallareacsv,
Expand Down

0 comments on commit c1d027f

Please sign in to comment.