Hi,

If I set up a random example and plot it as a contour it seems to work
fine...e.g.

import matplotlb.pyplot as plt
import numpy as np

data2 = np.random.sample((17,16))
x = np.linspace(-1.74, -1.32, 16)      
y = np.linspace(15.15, 15.61, 17)
X, Y = np.meshgrid(x, y) 
plt.contour(X, Y, data2, colors='black') 
plt.show() 

However if instead I try use a basemap projection to do the contouring I run
into trouble. For example...

import numpy as np
from mpl_toolkits.basemap import Basemap

ulat, llat, ulon, llon = 15.61, 15.15, -1.32, -1.74
m = Basemap(projection='geos', lon_0=0.0, llcrnrlon=llon,
                     llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, 
                     resolution='c')

data2 = np.random.sample((17,16))
x = np.linspace(-1.74, -1.32, 16)      
y = np.linspace(15.15, 15.61, 17)
X, Y = m(x, y)
m.contourf(X, Y, data2, colors='black')
plt.show() 

The errors I am getting are....

x, y = m(lons, lats)
  File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/__init__.py",
line 823, in __call__
    return self.projtran(x,y,inverse=inverse)
  File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/proj.py",
line 241, in __call__
    outx,outy = self._proj4(x, y, inverse=inverse)
  File "/users/eow/mgdk/sun4u//lib/python/mpl_toolkits/basemap/pyproj.py",
line 193, in __call__
    _Proj._fwd(self, inx, iny, radians=radians, errcheck=errcheck)
  File "_proj.pyx", line 56, in _proj.Proj._fwd (src/_proj.c:725)
RuntimeError: Buffer lengths not the same

Many thanks,

Martin
-- 
View this message in context: 
http://old.nabble.com/basemap-and-contouring-tp29697864p29697864.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to