I'm trying to 'automate' a few components within basemap. I have a pretty complicated, and assuredly poorly written, set of functions that allow me to 'dynamically' plot a grid of data (lon,lat).
Here is one section where I try to deal with transforming the data based on the projection. 'data' is a grid, often of size 720x360 or 720x180, representing full globe or hemisphere at 0.5 degree resolution. 'outlon0', outlat0', and 'd*out' are the llcrnr coordinates and step. 'transform' is an option, that is set to True by default: 1680 ## set up transformations for the data array 1681 if m.projection not in ['cyl','merc','mill']: 1682 lats = np.arange( outlat0, ( outlat0 + ( numygrid*dyout ) ), dyout )[:-1] 1683 lons = np.arange( outlon0, ( outlon0 + ( numxgrid*dxout ) ), dxout )[:-1] 1684 data = data[:-1,:-1] 1685 else: 1686 lats = np.arange( outlat0, ( outlat0 + ( numygrid*dyout ) ), dyout ) 1687 lons = np.arange( outlon0, ( outlon0 + ( numxgrid*dxout ) ), dxout ) 1688 1689 ## transform to nx x ny regularly spaced native projection grid 1690 if transform: 1691 dx = 2.*np.pi*m.rmajor/len(lons) 1692 nx = int((m.xmax-m.xmin)/dx)+1; ny = int((m.ymax-m.ymin)/dx)+1 1693 if nx is 1: 1694 topodat = data 1695 else: 1696 topodat = m.transform_scalar(data,lons,lats,nx,ny) 1697 else: 1698 topodat = data The problem is, when I use the approach with a 'cyl' grid, then subsequently try to draw the lsmask, I get a failure. Is this approach incorrect? I had to use the if nx is 1 statement because it was crashing with zero division error in some cases. Thanks. -- View this message in context: http://www.nabble.com/basemap%2C-transform_scalar-question-tp25649437p25649437.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users