Eric, I've uploaded the file. The only thing I should mention is that my 'X' and 'Y' arrays are not masked arrays, they are 2d arrays that I created using the meshgrid function. I ended up doing this Xnp=np.array(X) Ynp=np.array(Y) which probably wasnt necessary.. Let me know if the file worked for you. Pablo
---------------------------------------- > Date: Sun, 15 Mar 2009 21:14:01 -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: >> Eric, >> Its Still not working, still getting white/empty areas where Z=0.0 >> Here's my ipython output: >> >> [6] ga-> Znp=np.array(Z.filled()) >> [7] ga-> Znp >> Out[7]: >> array([[ 0. , 0. , 0. , ..., 0. , >> 0. , 0. ], >> [ 0. , 0. , 0. , ..., 0. , >> 0. , 0. ], >> [ 0. , 0. , 0. , ..., 0. , >> 0. , 0. ], >> ..., >> [ 1.023 , 1.551 , 2.5079999 , ..., 0.72600001, >> 0.85799998, 1.023 ], >> [ 1.58399999, 1.74899995, 1.9799999 , ..., 0.92400002, >> 1.41899991, 1.58399999], >> [ 0. , 0. , 0. , ..., 0. , >> 0. , 0. ]]) >> [8] ga-> Lv=(0,1,3,5,6,7,8,9,10,12,14,16,18,20,25,30,35,40,50,75) >> [9] ga-> norm = mpl.colors.BoundaryNorm(Lv,256) >> [10] plt.contourf(Znp, Lv, norm=norm) >> Out[10]: >> [11] Znp[0,0] >> Out[11]: 0.0 >> [12] Znp[-1,0] >> Out[12]: 0.0 >> [13] Znp[1,0] >> Out[13]: 0.0 >> [14] Znp[0,1] >> Out[14]: 0.0 >> [15] Znp[0,-1] >> Out[15]: 0.0 > > You missed the [-1,-1] corner. I thought at least one corner would be > non-zero, but maybe not. At this point, it doesn't matter. > >> >> This is very frustrating. :( >> >> Is there anything else Im missing here? >> anything else I can try? > > Now I am wondering whether there is any difference between your > numpy/matplotlib installation and mine that is making this > difference--although that really does not make any sense, either. But > let's check it. Please use the same method as above to make Xnp and > Ynp, and then use np.savez to write out a file with Xnp, Ynp, and Znp: > > np.savez('XYZ.npz', Xnp=Xnp, Ynp=Ynp, Znp=Znp) > > and ftp XYZ.npz to ftp://currents.soest.hawaii.edu/pub/incoming. Then I > can easily try to reproduce exactly what you are doing, and we will see > if I get the same result, or a different one. > > >> >> Im beginning to think that negative/"less than zero" values are actually >> being plotted in those land areas, even though my array is only showing >> zeros, '0.0'. > > I don't see how this could be. > >> >> Is there any way I can plot the output in a grid format? >> i.e. print the text value of each point in the array at each point on the >> plot? >> This way, I can see if a '0.0' value is really being plotted in those >> white/blank areas. >> > Not trivially; among other things, I think you have too many points. And > you have already verified that the values print as 0.0. I am sure they > really are 0.0. > >> Or, is there another/better way to keep diagnosing the problem? >> > > I can't think of anything now other than letting me try it on my system, > as suggested above. > > You might also see what happens with a workaround: > > Znp0 = Znp.copy() > Znp0[Znp==0] = 0.1 > > Then try plotting Znp0. > > 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