Eric,
 
the GrADS interface is called 'pygrads'. 
it was developed by arlindo da silva of the 'opengrads' project; a project 
aimed at extending & enhancing the capabilities of grads by adding 'extensions' 
to the core grads engine.
 
Many users are switching to plotting with pygrads due to the fact that 
matplotlib is a much richer, more powerful, more mature/extensive plotting 
environment. 
 
So, GrADS users can manipulate gridded data in grads, export through pygrads, 
and create nicer/more elaborate plots using matplotlib ;)
 
http://opengrads.org/wiki/index.php?title=Python_Interface_to_GrADS
 
 
 
as for the solution you offered, I tried doing the following:
 
cs = m.contourf(X,Y,Z.filled(),Lv,norm=norm,cmap=plt.cm.jet)
 
but I still got a plot with the '0.0' (land) areas plotted as 'white'/missing?.
 
Does it matter that the output I provided from the "Z.mask" command showed all 
'false' for the mask array?
 
Is there any other info about the 'Z' grads-masked array that I can provide 
that might help figure out what is going wrong?

Pablo

----------------------------------------
> Date: Sun, 15 Mar 2009 18:01:08 -1000
> From: efir...@hawaii.edu
> Subject: Re: [Matplotlib-users] FW: basemap.contourf, colormap, 
> extend='none', & levels array question
> To: romero...@hotmail.com
> CC: matplotlib-users@lists.sourceforge.net
>
> Pablo Romero wrote:
>> it appears to be a masked array, but a "customized" one, that's being 
>> created from the interface to the external program Im working with 
>> (application named GrADS). here's some more info...
>>
>
> Aha, very interesting! I know about grads but don't use it, and I did
> not know about the python interface.
>
> Out of curiosity, why are you using the grads data interface but not the
> grads plotting?
>
>> [7] ga-> Z?
>> Type: GaField
>> Base Class:
>> String Form:
>> [[0.0 0.0 0.0 ..., 0.0 0.0 0.0]
>> [0.0 0.0 0.0 ..., 0.0 0.0 0.0]
>> [0.0 0.0 0.0 ..., 0.0 0.0 0.0]
>> 1.97999989986 ..., 0.924000024796
>> 1.41899991035 1.58399999142]
>> [0.0 0.0 0.0 ..., 0.0 0.0 0.0]]
>> Namespace: Interactive
>> Length: 311
>> File: /usr/lib/python2.5/site-packages/grads/numtypes.py
>> Docstring:
>> This is GraDS version of a n-dimensional array: a masked array with
>> a *grid* containing coordinate/dimension information attached to it.
>> As a MaskedArray, GaField objects may possibly have masked values.
>> Masked values of 1 exclude the corresponding element from any
>> computation.
>> Construction:
>> x = GaField (data, name=None, Grid=None,
>> dtype=None, copy=True, order=False,
>> mask = nomask, fill_value=None)
>> If copy=False, every effort is made not to copy the data:
>> If data is a MaskedArray, and argument mask=nomask,
>> then the candidate data is data.data and the
>> mask used is data.mask. If data is a numeric array,
>> it is used as the candidate raw data.
>> If dtype is not None and
>> is != data.dtype.char then a data copy is required.
>> Otherwise, the candidate is used.
>> If a data copy is required, raw data stored is the result of:
>> numeric.array(data, dtype=dtype.char, copy=copy)
>> If mask is nomask there are no masked values. Otherwise mask must
>> be convertible to an array of booleans with the same shape as x.
>> fill_value is used to fill in masked values when necessary,
>> such as when printing and in method/function filled().
>> The fill_value is not used for computation within this module.
>>
>>
>> [8] ga-> Z.mask
>> Out[8]:
>> array([[False, False, False, ..., False, False, False],
>> [False, False, False, ..., False, False, False],
>> [False, False, False, ..., False, False, False],
>> ...,
>> [False, False, False, ..., False, False, False],
>> [False, False, False, ..., False, False, False],
>> [False, False, False, ..., False, False, False]], dtype=bool)
>>
>>
>> [12] ga-> np.linalg.norm([Z[0,0], Z[0,-1], Z[-1,0], Z[-1,-1]])
>> Out[12]: 0.0
>
>
> What I meant was the BoundaryNorm instance "norm" that you are using to
> contour. But that's OK; we don't need that diagnostic now.
>
> The mystery is solved; the 0 values in your Z array are not really 0,
> they are masked, and contourf is handling them correctly. 0.0 is just
> the fill value. If you want that to be the *real* value, then instead of
> using Z as the argument to your contourf call, use Z.filled().
>
> Eric
_________________________________________________________________
Windows Liveā„¢ Groups: Create an online spot for your favorite groups to meet.
http://windowslive.com/online/groups?ocid=TXT_TAGLM_WL_groups_032009
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to