[GRASS5] r.thin -- misleading message about successful completion

Ludwig M Brinckmann ludwigbrinckmann at hotmail.com
Tue Apr 4 04:20:06 EDT 2006


I have been trying to thin flow accumulations generated with
r.terraflow with r.thin.

r.thin always reported a successfull
completion of the program.

However I discovered that in many
cases a subsequent run of r.to.vector was not happy with the
results of r.thin, suggesting I should run r.thin...

Now looking through the code of r.thin I have discovered that
in fact even if r.thin reports a successful completion, it
might have just run out of an arbitrary number of iterations
for the thinning process, without actually converging. This is bad.

[
What actually stops the iterations is this line, undocumented
and only visible for those who venture into the source.

thin_lines.c, 115:

	   while((deleted>0)&&(i<=30))  /* it must be done in <= 30
	   pathes */

at the top of the file one however finds this #define, which
is never used:

	#define MAX_PASSES    10
]


As the quickest fix I suggest a termination message in r.thin
indicating
that the compiled-in iterations have been exhausted and that
running of r.thin again on the results will maybe converge.

The right fix IMHO is to move the number of iterations to the
command line, with a sensible default, plus of cause an error
message if the number of iterations do not complete the
program.


Ludwig





More information about the grass-dev mailing list