[GRASS-dev] latest r.width.funct.py appears to be broken

On Thu, Nov 1, 2018 at 6:35 PM Bartolomei.Chris <Bartolomei.Chris@ensco.com> wrote:

Good afternoon Markus & Co. :blush:

It appears that the latest version of r.width.funct.py is not functioning properly … We have a few Windows10 systems here running GRASS; I’m on v7.4.0 and another person has (had) 7.2.2. She was trying to run r.basin on a 30m resolution DEM and kept getting the following error:

Traceback (most recent call last):
File “C:\Users\XXX\AppData\Roaming\GRASS7\addons/scripts/r.width.funct.py”, line 135, in
sys.exit(main())
File “C:\Users\XXX\AppData\Roaming\GRASS7\addons/scripts/r.width.funct.py”, line 84, in main
prc[0,0] , prc[0,1] = findint(kl,0.05) , 0.05
File “C:\Users\XXX\AppData\Roaming\GRASS7\addons/scripts/r.width.funct.py”, line 128, in findint
z1, z2, f1, f2 = kl[int(Xf[0])][0], kl[int(Xf[0]-1)][0], kl[int(Xf[0])][1], kl[int(Xf[0]-1)][1]
IndexError: invalid index to scalar variable.

This was fixed the other day by madi :slight_smile:

2018-10-23 03:26:54 -0700 (Tue, 23 Oct 2018)
New Revision: 73602

To get that, just reinstall the addon with g.extension.

Best
Markus

PS: thanks anyway for the updated script! The author solved it in a slightly different way.


Markus Neteler, PhD
http://www.mundialis.de - free data with free software
http://grass.osgeo.org
http://courses.neteler.org/blog

Hi Markus

As always thank you for the prompt response :blush:

I think maybe the fix is not a fix then as we had done this upgrade to GRASS 7.4.2 and the re-installation of the addons and testing just a few hours ago … (???)

I’ll include the code of the broken r.width.funct.py below just in case.

:blush:

Chris

Broken r.width.funct.py:

#!/usr/bin/env python

···

From: Markus Neteler neteler@osgeo.org
Sent: Thursday, November 1, 2018 2:02 PM
To: Bartolomei.Chris Bartolomei.Chris@ensco.com
Cc: GRASS developers list grass-dev@lists.osgeo.org; GRASS user list grass-user@lists.osgeo.org
Subject: Re: latest r.width.funct.py appears to be broken

*** WARNING ***
EXTERNAL EMAIL – This message originates from outside ENSCO Inc.

On Thu, Nov 1, 2018 at 6:35 PM Bartolomei.Chris <Bartolomei.Chris@ensco.com> wrote:

Good afternoon Markus & Co. :blush:

It appears that the latest version of r.width.funct.py is not functioning properly … We have a few Windows10 systems here running GRASS; I’m on v7.4.0 and another person has (had) 7.2.2. She was trying to run r.basin on a 30m resolution DEM and kept getting the following error:

Traceback (most recent call last):
File “C:\Users\XXX\AppData\Roaming\GRASS7\addons/scripts/r.width.funct.py”, line 135, in
sys.exit(main())
File “C:\Users\XXX\AppData\Roaming\GRASS7\addons/scripts/r.width.funct.py”, line 84, in main
prc[0,0] , prc[0,1] = findint(kl,0.05) , 0.05
File “C:\Users\XXX\AppData\Roaming\GRASS7\addons/scripts/r.width.funct.py”, line 128, in findint
z1, z2, f1, f2 = kl[int(Xf[0])][0], kl[int(Xf[0]-1)][0], kl[int(Xf[0])][1], kl[int(Xf[0]-1)][1]
IndexError: invalid index to scalar variable.

This was fixed the other day by madi :slight_smile:

2018-10-23 03:26:54 -0700 (Tue, 23 Oct 2018)
New Revision: 73602

To get that, just reinstall the addon with g.extension.

Best

Markus

PS: thanks anyway for the updated script! The author solved it in a slightly different way.


Markus Neteler, PhD
http://www.mundialis.de - free data with free software
http://grass.osgeo.org
http://courses.neteler.org/blog