quiver and masked array

Hi ALL,
I am just starting to leave the matlab to work with matplotlib 82-5 in my ubuntu linux. I have problens to make a vector fild plots using quiver. I have a netcdf file that i extract a u_velocity and v_velocity variables, after i mask the array and try to quiver. i get the following error

Traceback (most recent call last):
File “”, line 1, in ?
File “/usr/lib/python2.4/site-packages/matplotlib/pylab.py”, line 2256, in quiver
ret = gca().quiver(*args, **kwargs)
File “/usr/lib/python2.4/site-packages/matplotlib/axes.py”, line 828, in quiver
U = asarray(U)
File “/usr/lib/python2.4/site-packages/Numeric/Numeric.py”, line 134, in asarray
return multiarray.array(a,
typecode, copy=0, savespace=savespace)
File “/usr/lib/python2.4/site-packages/Numeric/MA/MA.py”, line 632, in array
raise MAError,
MA.MA.MAError: Cannot automatically convert masked array to Numeric because data
is masked in one or more locations.

But if i do not mask the array but i try to plot without the scale it gets the error :

File “”, line 1, in ?
File “/usr/lib/python2.4/site-packages/matplotlib/pylab.py”, line 2256, in quiver
ret = gca().quiver(*args, **kwargs)
File “/usr/lib/python2.4/site-packages/matplotlib/axes.py”, line 855, in quiver
if Nmax == 0: #jb
UnboundLocalError: local variable ‘Nmax’ referenced before assignment

Could someone helps me?
Thanks

···

Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora!

In newer versions quiver has been completely rewritten including masked array support. I recommend that you remove your ubuntu mpl package and install the latest release from the source tarball.

Eric

giovanni ruggiero wrote:

···

From my point of view, version 82-5 is simply too old to bother with.

Hi ALL,
I am just starting to leave the matlab to work with matplotlib 82-5 in my ubuntu linux. I have problens to make a vector fild plots using quiver. I have a netcdf file that i extract a u_velocity and v_velocity variables, after i mask the array and try to quiver. i get the following error

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 2256, in quiver
    ret = gca().quiver(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 828, in quiver
    U = asarray(U)
  File "/usr/lib/python2.4/site-packages/Numeric/Numeric.py", line 134, in asarray
    return multiarray.array(a, typecode, copy=0, savespace=savespace)
  File "/usr/lib/python2.4/site-packages/Numeric/MA/MA.py", line 632, in __array__
    raise MAError, \
MA.MA.MAError: Cannot automatically convert masked array to Numeric because data
                   is masked in one or more locations.

But if i do not mask the array but i try to plot without the scale it gets the error :

File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 2256, in quiver
    ret = gca().quiver(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 855, in quiver
    if Nmax == 0: #jb
UnboundLocalError: local variable 'Nmax' referenced before assignment

Could someone helps me?
Thanks

------------------------------------------------------------------------
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora! <http://us.rd.yahoo.com/mail/br/tagline/mobile_alerts/*http://br.mobile.yahoo.com/mailalertas/>

------------------------------------------------------------------------

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

As I posted a couple of days ago, Ubuntu users have the following options
to avoid old versions of MPL:

* Upgrade to the Edgy (6.10) distribution, which uses MPL 0.87.5.
Upgrading is easy, see
http://www.ubuntu.com/download/releasenotes/610?highlight=(edgy)|(upgrade)

* Add a repository containing the newest MPL to your
/etc/apt/sources.list. Such a repository was announced on this list a
couple of days ago.

* Compile MPL from source off the SVN repository.

Cheers,
Josh

···

On Tue, 21 Nov 2006, Eric Firing wrote:

From my point of view, version 82-5 is simply too old to bother with.
In newer versions quiver has been completely rewritten including masked
array support. I recommend that you remove your ubuntu mpl package and
install the latest release from the source tarball.

Eric

giovanni ruggiero wrote:
> Hi ALL,
> I am just starting to leave the matlab to work with matplotlib 82-5 in
> my ubuntu linux. I have problens to make a vector fild plots using
> quiver. I have a netcdf file that i extract a u_velocity and v_velocity
> variables, after i mask the array and try to quiver. i get the
> following error
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line
> 2256, in quiver
> ret = gca().quiver(*args, **kwargs)
> File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 828,
> in quiver
> U = asarray(U)
> File "/usr/lib/python2.4/site-packages/Numeric/Numeric.py", line 134,
> in asarray
> return multiarray.array(a, typecode, copy=0, savespace=savespace)
> File "/usr/lib/python2.4/site-packages/Numeric/MA/MA.py", line 632, in
> __array__
> raise MAError, \
> MA.MA.MAError: Cannot automatically convert masked array to Numeric
> because data
> is masked in one or more locations.
>
>
> But if i do not mask the array but i try to plot without the scale it
> gets the error :
>
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line
> 2256, in quiver
> ret = gca().quiver(*args, **kwargs)
> File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 855,
> in quiver
> if Nmax == 0: #jb
> UnboundLocalError: local variable 'Nmax' referenced before assignment
>
> Could someone helps me?
> Thanks
>
> ------------------------------------------------------------------------
> Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu
> celular. Registre seu aparelho agora!
> <http://us.rd.yahoo.com/mail/br/tagline/mobile_alerts/*http://br.mobile.yahoo.com/mailalertas/>
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Josh Lifton wrote:

As I posted a couple of days ago, Ubuntu users have the following options
to avoid old versions of MPL:

* Upgrade to the Edgy (6.10) distribution, which uses MPL 0.87.5.
Upgrading is easy, see
http://www.ubuntu.com/download/releasenotes/610?highlight=(edgy)|(upgrade)

(I am a happy Edgy user, but I installed from scratch.) I have read that the upgrade to Edgy may or may not go smoothly, however, depending on whether things like Automatix or EasyUbuntu were used.

* Add a repository containing the newest MPL to your
/etc/apt/sources.list. Such a repository was announced on this list a
couple of days ago.

But I seem to recall that there was a problem with this--the dependencies did not take care of making sure that compatible versions of numeric libraries were installed, meaning the ones against which the new mpl package was compiled.

* Compile MPL from source off the SVN repository.

Or from the latest tarball, which might be slightly easier and more stable, but misses the very latest changes.

Anyone who has not done such a compilation is likely to run into missing devel packages (because they don't get installed by default), but installing them using synaptic or apt-get should be easy, and a matter of only a few minutes. (It might help if we had a list of exactly which packages are needed--has anyone compiled this? Any volunteers for a wiki entry, if there isn't one already?)

Anyone wanting to use wxPython will run into the long-standing missing-headers-bug: https://launchpad.net/distros/ubuntu/+source/wxwidgets2.6/+bug/2887
but it is easy to fix, as described in the link. (There is a typo in step 3 of the workaround: 2.6.3.2 should be 2.6.3.3.) Don't bother unless you really want wx, though.

···

Cheers,
Josh