Jeff,
Thanks for the quick reply, below is my plotting code. Here are the answers to your question about my arrray:
type(Zdat); type(zdat)
<type ‘numpy.ndarray’>
<type ‘numpy.ndarray’>
shape(Zdat); shape(zdat)
(180, 360)
(596, 596)
shape(lons); shape(x)
(360,)
(596, 596)
shape(lats); shape(y)
(180,)
(596, 596)
I would like to use contourf, but ultimately I want to plot the log(zdat), and since my data have so many null or zero values, I can’t get that to work with contourf, whereas imshow seems to handle it.
Thanks!!
PLOTTING FUNCTION HERE:
def fp_plot(datain):
from matplotlib.toolkits.basemap import Basemap, shiftgrid
Zdat=datain;
n,m=N.shape(Zdat)
lons=N.array([i-179.5 for i in range(m)])
lats=N.array([i-89.5 for i in range(n)])
print "The array is bounded: %s : %s lat, %s : %s lon " % (N.min(lats),N.max(lats),N.min(lons),N.max(lons))
# Set up basmap.
m = Basemap(llcrnrlon=-180.,llcrnrlat=-90.,urcrnrlon=180.,urcrnrlat=
90.0,
rsphere=(6378137.00,6356752.3142),
resolution=‘l’,area_thresh=1000.,projection=‘npstere’,
lat_1=80.,lon_0=0., boundinglat=40.)
# transform to nx x ny regularly spaced native projection grid
nx = int((m.xmax-m.xmin)/20000.)+1; ny = int((m.ymax-m.ymin)/20000.)+1
zdat,x,y = m.transform_scalar(Zdat,lons,lats,nx,ny,returnxy=True)
# create the figure.
fig=figure(figsize=(12,8))
# add an axes, leaving room for colorbar on the right.
ax = fig.add_axes([0.1,0.1,0.7,0.7])
# plot image over map with imshow. Want to use this, but no success yet.
anorm=normalize(.015*N.max(zdat),0.95*N.max(zdat));
# Draw flexpart output
m.imshow(x,y,zdat)
# Draw map components
m.drawcoastlines()
m.drawcountries()
m.drawstates()
meridians=arange(-170.,180.,20.)
m.drawmeridians(meridians,labels=[1,1,0,0])
paralles=arange(-85.,85.,5.)
m.drawparallels(paralles, labels=[0,0,0,1]); show();
Now, to answer your question, Zdat, or datain is a numpy array with the following characteristics: