Hi Dylan,
Excellently documented example by the way.
The path is probably quite similar but the point is that there is
currently no way to ensure that the r.drain path conforms to the same
path as the optimal path of cost accumulation (calculated by r.walk or
r.cost).
Specifically I can't comment on your example yet because I haven't
completed my changes to r.drain. When I do (assuming I remember) I
will be glad to re-run your analysis to see what difference is
present.
-Colin
Interesting post Colin. Can you comment on the differences between
r.drain and r.walk in this example [1], in light of your findings?
teaching r.walk to follow ridgelines when possible would be cool for back country stuff. Perhaps r.mapcalc multiply the slope-cost input map with a r.param.scale feature map that likes ridges and saddles but doesn't like gullies and pits? treelines too.
Also set cost map to NULL if slope > x so it doesn't have you crossing cumulatively short but physically challenging 20m cliffs.
Colin:
Excellently documented example by the way.
The path is probably quite similar but the point is that there is
currently no way to ensure that the r.drain path conforms to the
same path as the optimal path of cost accumulation (calculated
by r.walk or r.cost).
AFAIR r.drain just blindly climbs to the next up/downhill D8 cell, in a loop, until it can climb/drop no more. thus it is not "least" cost at all, just one valid solution? (??)
Hamish,
That sounds about right. Which is why I'm trying to modify
r.walk/r.drain to be able to return the actual least-cost path. I've
finished the r.walk bit but I'm having trouble modifying the r.drain
function.
Re my original question, would it be better to make a separate module
or modify r.drain?
-Colin
On Tue, Jun 24, 2008 at 2:06 PM, Hamish <hamish_b@yahoo.com> wrote:
teaching r.walk to follow ridgelines when possible would be cool for back country stuff. Perhaps r.mapcalc multiply the slope-cost input map with a r.param.scale feature map that likes ridges and saddles but doesn't like gullies and pits? treelines too.
Also set cost map to NULL if slope > x so it doesn't have you crossing cumulatively short but physically challenging 20m cliffs.
Colin:
Excellently documented example by the way.
The path is probably quite similar but the point is that there is
currently no way to ensure that the r.drain path conforms to the
same path as the optimal path of cost accumulation (calculated
by r.walk or r.cost).
AFAIR r.drain just blindly climbs to the next up/downhill D8 cell, in a loop, until it can climb/drop no more. thus it is not "least" cost at all, just one valid solution? (??)
That sounds about right. Which is why I'm trying to modify
r.walk/r.drain to be able to return the actual least-cost
path. I've finished the r.walk bit but I'm having trouble
modifying the r.drain function.
Re my original question, would it be better to make a
separate module or modify r.drain?
general advice:
if the difference in command line options are just a flag and the general purpose of the module remains the same, modify r.drain.
if there are many new/different command line options or it does a conceptually different task make it a new module. (see r.centroids)
if a large amount of code is shared, compile the two modules out of the same directory, and share as much code in shared functions as possible. (see r.univar)
On Tue, Jun 24, 2008 at 4:22 AM, Colin Nielsen <colin.nielsen@gmail.com> wrote:
Hi Dylan,
Excellently documented example by the way.
Thanks!
The path is probably quite similar but the point is that there is
currently no way to ensure that the r.drain path conforms to the same
path as the optimal path of cost accumulation (calculated by r.walk or
r.cost).
I see. I didn't quite understand your original post apparently. I
would be happy to help try out any modifications to r.walk/r.drain.
Specifically I can't comment on your example yet because I haven't
completed my changes to r.drain. When I do (assuming I remember) I
will be glad to re-run your analysis to see what difference is
present.
-Colin
Sounds good.
Cheers,
Dylan
Interesting post Colin. Can you comment on the differences between
r.drain and r.walk in this example [1], in light of your findings?
teaching r.walk to follow ridgelines when possible would be cool for back country stuff. Perhaps r.mapcalc multiply the slope-cost input map with a r.param.scale feature map that likes ridges and saddles but doesn't like gullies and pits? treelines too.
That is a good idea. I have done something similar in the past [1] ,
with vegetated areas / lakes, to 'force' the cost surface in ways
beneficial to hiking. Vegetated areas were made easier to traverse
(closed canopy pine forests) and lakes were made impossible to
traverse. However, adding more of this kind of intuition via landform
element would be a great feature.
Also set cost map to NULL if slope > x so it doesn't have you crossing cumulatively short but physically challenging 20m cliffs.
Ah... that is what my example above is missing. I didn't know that
r.drain would go around NULL cells!
Great tips.
Dylan
Colin:
Excellently documented example by the way.
The path is probably quite similar but the point is that there is
currently no way to ensure that the r.drain path conforms to the
same path as the optimal path of cost accumulation (calculated
by r.walk or r.cost).
AFAIR r.drain just blindly climbs to the next up/downhill D8 cell, in a loop, until it can climb/drop no more. thus it is not "least" cost at all, just one valid solution? (??)