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

Hamish hamish_b at yahoo.com
Wed Jan 27 22:22:25 EST 2010


Timmie:
> 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!
> 
> 
> #######


neat. if you could add that (and whatever other tips you think are
useful) to the wiki site it would be really great:

http://grass.osgeo.org/wiki/GRASS_and_Python#Interfacing_with_NumPy



thanks,
Hamish



      


More information about the grass-user mailing list