[GRASS-dev] Re: GRASS to Numpy [was: Re: List of new features in GRASS 7 (in trac)]

Tim Michelsen timmichelsen at gmx-topmail.de
Wed Jan 27 17:58:21 EST 2010


Hello,
> try with r.out.mat. AFAIU NumPy/SciPy is essentially an attempt
> to clone Matlab in python. Given that, I would not be surprised
> if it just sort of worked, given the right command.
Thanks for providing that pointer.

Here is a example that I was trying out with Spearfish location:

### PY ###

import scipy.io as sio
elev = sio.loadmat('elev.mat')
elev.get('map_data')
data = elev.get('map_data')
import pylab
pylab.plot(data)
pylab.show()

pylab.contour(data)
pylab.contour(data.reverse())

import numpy as np

data_rev = data[::-1]
pylab.contour(data_rev)
# => this is a quick plot. basemap mapping may provide a nicer map!


#######

>> Is such a feature also planned for vectors? They could be
>> exported to a format usable by Shaply...
> 
> I'm pretty sure I wrote a v.out.mat, have a look in wiki addons.
> 
> (I've got no idea what Shaply does or wants)
Please see also:
http://permalink.gmane.org/gmane.comp.gis.grass.devel/37719



More information about the grass-dev mailing list