From: <js...@us...> - 2010-05-27 18:56:25
|
Revision: 8339 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8339&view=rev Author: jswhit Date: 2010-05-27 18:56:19 +0000 (Thu, 27 May 2010) Log Message: ----------- raise ImportError if trying to plot on triangular grids with basemap < 1.0 Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2010-05-27 12:43:32 UTC (rev 8338) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2010-05-27 18:56:19 UTC (rev 8339) @@ -2755,6 +2755,11 @@ ax.hold(h) try: if tri: + try: + import matplotlib.tri as tri + except: + msg='need basemap > 0.99.1 to plot on unstructured grids' + Raise ImportError(msg) # for unstructured grids, toss out points outside # projection limb (don't use those points in triangulation). if hasattr(data,'mask'): @@ -2767,7 +2772,6 @@ y = np.compress(mask,y) data = np.compress(mask,data) if masked: - import matplotlib.tri as tri triang = tri.Triangulation(x, y) z = data[triang.triangles] mask = (z > 1.e20).sum(axis=-1) @@ -2841,6 +2845,11 @@ ax.hold(h) try: if kwargs.has_key('tri') and kwargs['tri']: + try: + import matplotlib.tri as tri + except: + msg='need basemap > 0.99.1 to plot on unstructured grids' + Raise ImportError(msg) # for unstructured grids, toss out points outside # projection limb (don't use those points in triangulation). if hasattr(data,'mask'): @@ -2853,7 +2862,6 @@ y = np.compress(mask,y) data = np.compress(mask,data) if masked: - import matplotlib.tri as tri triang = tri.Triangulation(x, y) z = data[triang.triangles] mask = (z > 1.e20).sum(axis=-1) @@ -2922,6 +2930,11 @@ ax.hold(h) try: if kwargs.has_key('tri') and kwargs['tri']: + try: + import matplotlib.tri as tri + except: + msg='need basemap > 0.99.1 to plot on unstructured grids' + Raise ImportError(msg) # for unstructured grids, toss out points outside # projection limb (don't use those points in triangulation). if hasattr(data,'mask'): @@ -2934,7 +2947,6 @@ y = np.compress(mask,y) data = np.compress(mask,data) if masked: - import matplotlib.tri as tri triang = tri.Triangulation(x, y) z = data[triang.triangles] mask = (z > 1.e20).sum(axis=-1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |