[GRASS-dev] r.watershed -m with depressions bug

Michel Wortmann wortmann at pik-potsdam.de
Fri Jun 24 04:46:40 PDT 2022


Hi GRASS devs,

I am facing a r.watershed issue when I run it with the segmentation library (-m) and depressions. When I run:

r.watershed -s elevation=elevation accumulation=accumulation drainage=drainage depressions=sinks

It works, but when I add the -m flag, it produces the following error:

ERROR: bug in A* Search: doer -1903 heap size 0 count 40036125
WARNING: Subprocess failed with exit code 1
WARNING: category information for [accumulation__cells] in
         [r_watershed_sfd] missing or invalid
WARNING: category information for [drainage] in [r_watershed_sfd] missing
         or invalid

I have tried to reproduce this in the North Carolina dataset with random sink points but have so far failed. If I run it with a single cell and many randomly assigned cells as depressions on my DEM, it works fine. Unfortunately, I wasn't able to infer a situation in the elevation and depressions raster where this bug/condition (in the code https://github.com/OSGeo/grass/blob/30cca6bc45b0a21a9e370f0bfdc1e9a2713b1ab8/raster/r.watershed/seg/do_astar.c#L147 <https://github.com/OSGeo/grass/blob/30cca6bc45b0a21a9e370f0bfdc1e9a2713b1ab8/raster/r.watershed/seg/do_astar.c#L147> i.e. doer != -1) is met.

One issue might be that in some depressions, the elevation is actually below 0. I have tested this and it seems to work for elevations of -10 but it didnt for -200. I cant see anything that would cause this in the do_astar routine, which lead me to conclude that it probably has to do with something else.

Does someone know what might lead to this error? Are there any conditions that the depressions and/or the elevation map need to fulfil in the segmentation version of r.watershed that are not needed in the in-memory version?

Best wishes,
Michel




-- 
Dr. Michel Wortmann 
Potsdam Institute for Climate Impact Research 
Research Department II: Climate Resilience
Phone: +49 331 288 2546
wortmann at pik-potsdam.de
www.pik-potsdam.de/members/wortmann

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20220624/e02b50f6/attachment.htm>


More information about the grass-dev mailing list