[GRASS-user] Help needed with stream channel slope

Hi all,

I have written an involved script (which I run automatically), in part, calling r.basin to get the stream channel slope (preferably at the basin outlet). For all basin outlet locations, r.basin defines the watershed correctly, but for about 10% of the locations the *_parameters.csv file is not created and I get errors:

Hi Tom:

Have you looked at the addon r.stream.slope ??

···

On 05/30/2018 05:32 PM, Thomas Adams wrote:

Hi all,

I have written an involved script (which I run automatically), in part, calling r.basin to get the stream channel slope (preferably at the basin outlet). For all basin outlet locations, r.basin defines the watershed correctly, but for about 10% of the locations the *_parameters.csv file is not created and I get errors:

https://grasswiki.osgeo.org/wiki/AddOns/GRASS7/raster#r.stream.slope

===========================
Hypsometric | quantiles

360 | 0.025
358 | 0.05
356 | 0.1
351 | 0.25
341 | 0.5
330 | 0.75
321 | 0.9
316 | 0.975

Done!
…/src/gtk/dcclient.cpp(250): assert “Assert failure” failed in wxFreePoolGC(): Wrong GC
…/src/gtk/dcclient.cpp(250): assert “Assert failure” failed in wxFreePoolGC(): Wrong GC
…/src/gtk/dcclient.cpp(250): assert “Assert failure” failed in wxFreePoolGC(): Wrong GC
…/src/gtk/dcclient.cpp(250): assert “Assert failure” failed in wxFreePoolGC(): Wrong GC


100%
Tot. cells 1886.0
Tot. area 188600.0
Max distance 771.033539
Traceback (most recent call last):
File “/home/teaiii/.grass7/addons/scripts/r.width.funct”, line 132, in
sys.exit(main())
File “/home/teaiii/.grass7/addons/scripts/r.width.funct”, line 87, in main
prc[4,0] , prc[4,1] = findint(kl,0.5) , 0.5
File “/home/teaiii/.grass7/addons/scripts/r.width.funct”, line 125, 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]
TypeError: only length-1 arrays can be converted to Python scalars


An ERROR occurred running r.basin
Please check for error messages above or try with another pairs of outlet
coordinates
Removing region definition
grep: mjk473_dem_parameters.csv: No such file or directory

Channel average slope (percent):
grep: mjk473_dem_parameters.csv: No such file or directory

Drainage Area (sq km):

I know the basin boundary is generated correctly because I generate a map automatically.

So, the above is a problem; I have sent a lot of time trying to understand where I’m going wrong. I just re-built GRASS 7.4.0 and that had no effect in correcting the problem.

r.basin generates waaay more than I need. Is there a simpler way the get the average main channel slope? I’ve looked through the available modules and can not find another way to do this. I just need a single value…

Best regards,
Tom

_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[https://lists.osgeo.org/mailman/listinfo/grass-user](https://lists.osgeo.org/mailman/listinfo/grass-user)
-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

Hi Micha,

Thank you – I looked at this previously, but I think I misunderstood what it did. I’ve tried r.stream.slope and it sure looks like it’s doing what I need. Thank you for encouraging me to re-visit it!

Best,
Tom

···

On Wed, May 30, 2018 at 3:34 PM, Micha Silver <tsvibar@gmail.com> wrote:

Hi Tom:

On 05/30/2018 05:32 PM, Thomas Adams wrote:

Hi all,

I have written an involved script (which I run automatically), in part, calling r.basin to get the stream channel slope (preferably at the basin outlet). For all basin outlet locations, r.basin defines the watershed correctly, but for about 10% of the locations the *_parameters.csv file is not created and I get errors:

Have you looked at the addon r.stream.slope ??
https://grasswiki.osgeo.org/wiki/AddOns/GRASS7/raster#r.stream.slope

===========================
Hypsometric | quantiles

360 | 0.025
358 | 0.05
356 | 0.1
351 | 0.25
341 | 0.5
330 | 0.75
321 | 0.9
316 | 0.975

Done!
…/src/gtk/dcclient.cpp(250): assert “Assert failure” failed in wxFreePoolGC(): Wrong GC
…/src/gtk/dcclient.cpp(250): assert “Assert failure” failed in wxFreePoolGC(): Wrong GC
…/src/gtk/dcclient.cpp(250): assert “Assert failure” failed in wxFreePoolGC(): Wrong GC
…/src/gtk/dcclient.cpp(250): assert “Assert failure” failed in wxFreePoolGC(): Wrong GC


100%
Tot. cells 1886.0
Tot. area 188600.0
Max distance 771.033539
Traceback (most recent call last):
File “/home/teaiii/.grass7/addons/scripts/r.width.funct”, line 132, in
sys.exit(main())
File “/home/teaiii/.grass7/addons/scripts/r.width.funct”, line 87, in main
prc[4,0] , prc[4,1] = findint(kl,0.5) , 0.5
File “/home/teaiii/.grass7/addons/scripts/r.width.funct”, line 125, 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]
TypeError: only length-1 arrays can be converted to Python scalars


An ERROR occurred running r.basin
Please check for error messages above or try with another pairs of outlet
coordinates
Removing region definition
grep: mjk473_dem_parameters.csv: No such file or directory

Channel average slope (percent):
grep: mjk473_dem_parameters.csv: No such file or directory

Drainage Area (sq km):

I know the basin boundary is generated correctly because I generate a map automatically.

So, the above is a problem; I have sent a lot of time trying to understand where I’m going wrong. I just re-built GRASS 7.4.0 and that had no effect in correcting the problem.

r.basin generates waaay more than I need. Is there a simpler way the get the average main channel slope? I’ve looked through the available modules and can not find another way to do this. I just need a single value…

Best regards,
Tom

_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[https://lists.osgeo.org/mailman/listinfo/grass-user](https://lists.osgeo.org/mailman/listinfo/grass-user)
-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

On Wed, May 30, 2018 at 11:09 PM, Thomas Adams <tea3rd@gmail.com> wrote:

Hi Micha,

Thank you -- I looked at this previously, but I think I misunderstood what
it did. I've tried r.stream.slope and it sure looks like it's doing what I
need. Thank you for encouraging me to re-visit it!

Tom,
If you see any potential manual page improvements, please suggest!

Markus