pygrads plot configuration
Arlindo da Silva
dasilva at ALUM.MIT.EDU
Fri Jan 23 13:55:44 EST 2009
On Fri, Jan 23, 2009 at 1:08 PM, Pablo Romero <romero619 at hotmail.com> wrote:
>
> ok, thank you.
> Ive started digging through the galab.py source code, to see how its
> interfacing the matplotlib/basemap objects,and doing the plotting through
> matplotlib.
> question: if I want to avoid using galab, and simply instantiate my own
> matplotlib basemap object, do I simply need to export a variable from galab
> and pass it to matplotlib/basemap/contourf? or, do I need to do some sort of
> translation/interpolation/preparation???
>
No, simply export the array:
ts = ga.expr('ts')
The "ts" object will be a "GrADSField" object, which is a subclass of a
Masked Array class. A masked array has 3 main attributes
ts.data - a numpy numeric array
ts.mask - a boolean array of same shape as ts.data which is used for
handling undefs.
ts.grid - information about the coordinates, dimension environment
So, ts can be used anywhere you could use a masked array. Some functions
may not like a masked array, in which case you can use "ts.data" instead.
Notice that you can use either ga.exp() or ga.expr() with v1.9, but only
ga.expr() with v2.0. In principle ga.expr is more flexible, you can get back
x-y sections, for example. However, 'expr' is new, let me know if you run
into any snags.
Arlindo
--
Arlindo da Silva
dasilva at alum.mit.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20090123/d0609865/attachment.html
More information about the gradsusr
mailing list