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 ------------------------------------------------------------------------------ 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