[GRASS-user] r.basin error
Helmut Kudrnovsky
hellik at web.de
Mon Oct 22 10:54:50 PDT 2018
pelempito wrote
> Hi.
>
> I tryed to run the r.basin addon for almost 4000 basins. Approximately 10%
> of the basins end without the .csv parameters file. Digging deeper into
> the
> command output, I spotted the following error at the end of the log from
> r.basin:
>
>
> Traceback (most recent call last):
> File "/home/jr/.grass7/addons/scripts/r.width.funct", line
> 132, in
> <module>
> sys.exit(main())
> File "/home/jr/.grass7/addons/scripts/r.width.funct", line
> 85, in main
> prc[2,0] , prc[2,1] = findint(kl,0.3) , 0.3
> File "/home/jr/.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
>
>
> I think that r.basin stops after this error occurs, which may prevent
> r.basin from generating the .csv parameter file for a given basin. I
> researched a bit about the scalars in Python, and found this post
> <https://stackoverflow.com/questions/21687581/typeerror-only-length-1-arrays-can-be-converted-to-python-scalars-while-trying>
> (sorry for cross referencing), which refers that "non-numpy functions ...
> don't play nicely with numpy arrays", but I couldn't make more follow up.
>
> The error I just found can be reproduced by importing the raster DEM
> included in this ZIP file
> <http://geografiafisica.org/consigna/visitante/grass/hydrodem.zip>
> into
> GRASS, and running the following command (I have more coordinates for
> which
> r.basin fails as well):
>
>
> r.basin --overwrite --verbose map=hydrodem prefix=cuenca13
> coordinates=335595,2066655 threshold=22 dir=/tmp/tst
>
>
> The raster is a subset of the tile Entity ID SRTM1N18W071V3, from the SRTM
> 1
> Arc-Second Global DEM, post-treated by myself with the r.hydrodem addon.
>
> I unsuccessfully tried to solve the issue by updating the region with both
> the -a flag and the align parameter, since I read in the forum about that
> trick as a possible workaround as well.
have a look into the created vector basin, for the coordinates mentioned
above:
Number of areas: 2
maybe there is some issue withe DEM?
-----
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Users-f3884509.html
More information about the grass-user
mailing list