[GRASS-user] Hypsometry profile

Hamish hamish_b at yahoo.com
Thu Feb 7 21:22:58 EST 2008


> mort wrote:
> > I've generated profiles with use of r.profile command, so I have
> > txt output file.
> > On basis of this file I need to prepare the hypsometry profile.
> > The simple one I can prepare with OpenOffice, but I need more
> > complicated one which will prepare an output  file (eps, image?)
> > at least with horizontal and vertical scale defined by the user (me
> > in this case).
> > Do you know any of such software running on Linux?
> 
Hamish:
> You could try with many softwares.... 
> 
> ETOPO2 dataset:
>  g.region rast=etopo2
>  r.transect -g map=etopo2 line=-180,0,90,360 > equator_elev.dat
> 
> 
> All of the following should allow nice EPS output instead of default
> ugly X-window versions. (e.g. Gnuplot's X-Window stuff is very ugly
> but
> PNG,EPS,SVG output can look very nice)
> 
> 
> Octave (or Matlab):
> $ octave
> >> eq_elev = load('equator_elev.dat');
> >> figure(1)
> >> plot(eq_elev(:,1), eq_elev(:,4))
> >> figure(2)
> >> hist(eq_elev(:,4))
> 
> R:
> $ R
> > eq_elev <- read.table("equator_elev.dat")
> > hist(eq_elev[[4]])
> 
> Gnuplot:
> $ gnuplot
> gnuplot> set terminal postscript
> gnuplot> set output 'elev.ps'
> gnuplot> plot "equator_elev.dat" using 1:4 title 'Elevation'
> (check if your version of gnuplot supports 'set style data
> histogram')


> Python:  (maybe someone else can help here)
[time passes .. whiz .. bang .. whirl .. replying to myself]

Matplotlib (PyLab) is a python module which is yet another software
that, like Octave, "works in a fashion not dissimilar to Matlab(tm)".

And so it's easy to get nice plots:

$ python
>>> from pylab import *
>>> data = load("equator_elev.dat")
>>> # unlike ML array index starts at 0, so 4th column is 3.
>>> hist(data[:,3], 100)
>>> xlabel('Elevation')
>>> ylabel('Count')
>>> title('ETOPO2 along the Equator')
>>> show()


Hamish



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 




More information about the grass-user mailing list