|
From: Mike B. <oht...@gm...> - 2007-09-24 17:46:59
|
Howdy, I'm a recent refugee from GMT (Generic Mapping Tools) and am very happy to have found matplotlib. I've been having one nagging issue however that I must resolve as I require this ability. Basically, I need to mask 2d arrays and plot the result with pcolor via basemap. >From the documentation it seems this should be fairly straight forward and I'm hoping that this is the case. Here is an example of problem. ------------------------------------------- from pylab import * import matplotlib.numerix.ma as ma # matplotlibrc has numerix : numpy from matplotlib.toolkits.basemap import Basemap, shiftgrid, addcyclic import numpy as N . . . im = 144 jm = 93 lons = N.array([0., ... 357.5],dtype=float) lats = N.array([-90., ... 90.],dtype=float) topo_screen = N.zeros((jm,im),dtype='float') topo_screen[10] = 1 new_test = 100.*N.ones((jm,im),dtype='float') masked_test = ma.masked_where(topo_screen,new) This works and a screen dump of masked_test seem correct. A call to pcolor however results in the following: matplotlib version 0.90.1 verbose.level helpful interactive is False units is True platform is linux2 numerix numpy 1.0.1 . . . /usr/local/lib/python2.5/site-packages/numpy/core/ma.py:604: UserWarning: Cannot automatically convert masked array to numeric because data is masked in one or more locations. ------------------------------------------- Is this an embarrassingly simple error on my part? I hope so. Any help would be much appreciated. Mike |