Skip to content

Commit

Permalink
v.surf.icw: minimal change bugfix to get the module working again in G7
Browse files Browse the repository at this point in the history
(see also PR OSGeo#1200)
  • Loading branch information
HamishB committed Sep 16, 2024
1 parent 9a77166 commit 6c13210
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/vector/v.surf.icw/v.surf.icw.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#############################################################################
#
# MODULE: v.surf.icw
Expand Down Expand Up @@ -415,7 +415,7 @@ def main():

#######################################################
#### Step 3) find sum(cost^2)
grass.verbose("")
grass.verbose(" ")
grass.verbose(_("Finding sum of squares ..."))

# todo: test if MASK exists already, fatal exit if it does?
Expand All @@ -425,12 +425,10 @@ def main():

grass.message(_("Summation of cost weights ..."))

input_maps = tmp_base + "1by_cost_site_sq.%05d" % 1

global TMP_FILE
TMP_FILE = grass.tempfile()
with open(TMP_FILE, "w") as maplist:
for i in range(2, n + 1):
for i in range(1, n + 1):
mapname = "%s1by_cost_site_sq.%05d" % (tmp_base, i)
maplist.write(mapname + "\n")

Expand All @@ -450,7 +448,7 @@ def main():

#######################################################
#### Step 4) ( 1/di^2 / sum(1/d^2) ) * ai
grass.verbose("")
grass.verbose(" ")
grass.message(_("Creating partial weights ..."))

proc = {}
Expand Down Expand Up @@ -534,7 +532,7 @@ def main():
# grass.run_command('g.list', type = 'raster', mapset = '.')

#######################################################
grass.message("")
grass.message(" ")
grass.message(_("Calculating final values ..."))

input_maps = tmp_base + "partial.%05d" % 1
Expand All @@ -550,7 +548,7 @@ def main():

grass.run_command("r.colors", map=output, color="bcyr", quiet=True)
grass.run_command(
"r.support", map=output, history="", title="Inverse cost-weighted interpolation"
"r.support", map=output, history=" ", title="Inverse cost-weighted interpolation"
)
grass.run_command("r.support", map=output, history="v.surf.icw interpolation:")
grass.run_command(
Expand Down

0 comments on commit 6c13210

Please sign in to comment.