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
Ludwig,
excellent observation!
I have fixed it in CVS (will partially backport to GRASS 6.0.x, too):
- added iterations parameter
- added exit error message if failure (suggesting to increase iterations parm)
- Fixed wording (path -> pass)
- increased default iterations
The latter should probably solve problems earlier reported
(how to thin a river).
thanks again,
Markus
On Tue, Apr 04, 2006 at 08:20:06AM +0000, Ludwig M Brinckmann wrote:
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
_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5
--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy