Basemap, Mercator Projection and pcolor

Hi,

I've successfully plotted gridded data on a basemap "cyl" projection using pcolor:

mp = Basemap(projection="cyl", resolution="l", llcrnrlon=0.0, urcrnrlon=30.0, llcrnrlat=-5.0, urcrnrlat=5.0)
pc = mp.pcolor(X, Y, zvalsm, cmap=cm.jet)

However, if I simply I change the projection type to merc, adding appropriate lat_ts, I get the projection but the pcolor fails to plot on it:

mp = Basemap(projection="merc", lat_ts=0.0, resolution="l", llcrnrlon=0.0, urcrnrlon=30.0, llcrnrlat=-5.0, urcrnrlat=5.0)'
pc = mp.pcolor(X, Y, zvalsm, cmap=cm.jet)

Any ideas? I am using matplotlib 0.91.2 and basemap 0.9.9 on CentOS 4.0 with Python 2.3.

Thanks,
Rich

Rich Fought wrote:

Hi,

I've successfully plotted gridded data on a basemap "cyl" projection using pcolor:

mp = Basemap(projection="cyl", resolution="l", llcrnrlon=0.0, urcrnrlon=30.0, llcrnrlat=-5.0, urcrnrlat=5.0)
pc = mp.pcolor(X, Y, zvalsm, cmap=cm.jet)

However, if I simply I change the projection type to merc, adding appropriate lat_ts, I get the projection but the pcolor fails to plot on it:

mp = Basemap(projection="merc", lat_ts=0.0, resolution="l", llcrnrlon=0.0, urcrnrlon=30.0, llcrnrlat=-5.0, urcrnrlat=5.0)'
pc = mp.pcolor(X, Y, zvalsm, cmap=cm.jet)

Any ideas? I am using matplotlib 0.91.2 and basemap 0.9.9 on CentOS 4.0 with Python 2.3.

Thanks,
Rich

Rich: What are X and Y set to? They should be the map projection coorindates of the grid. If they are latitudes and longitudes, this will work for 'cyl' but not 'merc'. For 'merc', you must convert the lats and lons to x and y using

x, y = mp(lon, lat)

-Jeff

ยทยทยท

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg

Rich: What are X and Y set to? They should be the map projection coorindates of the grid. If they are latitudes and longitudes, this will work for 'cyl' but not 'merc'. For 'merc', you must convert the lats and lons to x and y using

x, y = mp(lon, lat)

-Jeff

Thanks Jeff, that did the trick ... I am working with lats/longs and I assumed that the conversion would be automatic for some reason.

Rich