OSGeo / grass-addons

GRASS GIS Addons Repository
https://grass.osgeo.org/grass-stable/manuals/addons/
GNU General Public License v2.0
100 stars 151 forks source link

[Bug] r.traveltime does not give same results as r.watershed #788

Open plvoit opened 2 years ago

plvoit commented 2 years ago

Name of the addon r.traveltime

Describe the bug When using r.traveltime one would expect that every pixel in subbasin, created with r.watershed, flows to the outlet point, which is defined by the cell with the maximum flow accumulation value within the respective subbasin. Unfortunately this does not always work and the resulting traveltime-raster is often smaller than the the subbasin (see attached screenshot where the yellow part is not included in the traveltime rarster). What is the reason that some cells apparently never arrive at the outlet, although r.traveltime and r.watershed use the same input grids (filled DEM (r.fill.dir), flow direction and flow accumulation)?

To Reproduce Steps to reproduce the behavior:

  1. Open the North Carolina dataset nc_basinc_spm_grass7
  2. Run following commands in the console (the outlet coordinates where derived manually):

g.region raster=elevation@PERMANENT r.fill.dir --overwrite input=elevation@PERMANENT output=filled_dem direction=flowdir format=agnps r.fill.dir --overwrite input=filled_dem@PERMANENT output=filled_dem2 direction=flowdir2 format=agnps r.watershed -s -a --overwrite elevation=filled_dem2@PERMANENT accumulation=accu basin=subbasins threshold=10000 r.mapcalc "n = 0.035f" --overwrite r.traveltime --overwrite dir=flowdir2@PERMANENT accu=accu@PERMANENT dtm=filled_dem2@PERMANENT manningsn=n@PERMANENT out_x=637757.00 out_y=218794.34 threshold=3000 b=1 nchannel=0.03 dis=1000 out=traveltime_99

Expected behavior In a subbasin created with r.watershed every cell should eventually flow to the outlet and the traveltime raster, created with r.traveltime, should have the same size as the subbasin.

Screenshots Screenshot is attached

System description (please complete the following information):

screenshot

plvoit commented 2 years ago

I found the problem. It seems as long as there are unresovled areas with r.fill.dir, r.traveltime might not perform correctly. I now ran r.fill.dir 5 times instead of two times and r.traveltime performed correctly. Sorry for the hassle, I actually was dealing with that since quite a while until I wrote the bug report and found the solution 5 min after that....

ecodiv commented 2 years ago

Good to hear you found the solution. If solved, perhaps good to close the bug report.