Hello,
I have written for my use a simple script that lets the user draw a path on a map (like r.profile, on which the script is built) and then outputs the path’s length, cumulative uphill and downhill climb, highest and lowest altitudes, maximum and average slope (up and down).
Unfortunately I was not able to make it work with ash, because (in my understanding) ash does not support arrays. I am also thinking about rewriting everything in C or Tcl.
Te script is attached to this email, in case it can be of any interest to anybody.
Regards and happy new year,
Stefano.
(attachments)
r.hikereport (6.17 KB)
On Thursday 03 January 2008, stefano negri wrote:
Hello,
I have written for my use a simple script that lets the user draw a path on
a map (like r.profile, on which the script is built) and then outputs the
path's length, cumulative uphill and downhill climb, highest and lowest
altitudes, maximum and average slope (up and down).
Unfortunately I was not able to make it work with ash, because (in my
understanding) ash does not support arrays. I am also thinking about
rewriting everything in C or Tcl.
Te script is attached to this email, in case it can be of any interest to
anybody.
Regards and happy new year,
Stefano.
Nice work. Have you had a look at r.walk - or thought about the possibility of
integrating these features in the r.walk code (written using the GRASS C
API) ?
Cheers,
Dylan
--
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341
2008/1/3, stefano negri <ste.negri.liste@gmail.com>:
Hello,
I have written for my use a simple script that lets the user draw a path on a map (like r.profile, on which the script is built) and then outputs the path's length, cumulative uphill and downhill climb, highest and lowest altitudes, maximum and average slope (up and down).
Unfortunately I was not able to make it work with ash, because (in my understanding) ash does not support arrays. I am also thinking about rewriting everything in C or Tcl.
Te script is attached to this email, in case it can be of any interest to anybody.
Regards and happy new year,
Stefano.
Hello,
there is now a python version of basically the same script (and also
removed a bug that was there in the bash version). Both python and
corrected bash version are attached.
The python version, of course, does not depend on external commands
(awk, bc...) and is incomparably faster. Ideas and comments are
welcome.
If you think it could be worth going into the addons, I would be glad
to add it there, but I don't have write access to the repository.
As I have read some posts in the past about scripting GRASS with bash,
Tcl and python, I feel I can give my 2 cents on that (for others that
are considering learning one of the three), because before deciding
for python I have also tried to learn some Tcl. I don't want to
comment on the language itself, just on how easy it can be to learn.
On this respect I think python is for sure the best to choose: I found
it very natural, while I had exactly the opposite feeling with Tcl.
That's just *my* experience... it could also be a matter of what kind
of background you have: mine is mainly in Java and Delphi (but I have
also used in the past C, a bit of Lisp, and bash).
Best regards,
Stefano.
(attachments)
hikereport.py (10.2 KB)
r.hikereport (6.27 KB)