[GRASS-user] Help needed with stream channel slope

Thomas Adams tea3rd at gmail.com
Wed May 30 07:32:12 PDT 2018


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:

===========================
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
<module>
    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 <original>
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


--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180530/4da481c2/attachment.html>


More information about the grass-user mailing list