From: <js...@us...> - 2008-12-13 14:46:33
|
Revision: 6597 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6597&view=rev Author: jswhit Date: 2008-12-13 14:46:30 +0000 (Sat, 13 Dec 2008) Log Message: ----------- update docstrings. 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 2008-12-13 14:43:02 UTC (rev 6596) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-13 14:46:30 UTC (rev 6597) @@ -1289,7 +1289,7 @@ After filling continents, lakes are re-filled with axis background color. - returns matplotlib.patches.Polygon object. + returns a list of matplotlib.patches.Polygon objects. """ if self.resolution is None: raise AttributeError, 'there are no boundary datasets associated with this Basemap instance' @@ -2632,6 +2632,8 @@ Extra keyword ``ax`` can be used to override the default axis instance. Other \**kwargs passed on to matplotlib.pyplot.plot. + + returns an matplotlib.image.AxesImage instance. """ if not kwargs.has_key('ax') and self.ax is None: try: @@ -3159,6 +3161,8 @@ to downsample the image (``scale=0.5`` downsamples to 2700x1350). \**kwargs passed on to :meth:`imshow`. + + returns an matplotlib.image.AxesImage instance. """ if ax is not None: return self.warpimage(image='bluemarble',ax=ax,scale=scale,**kwargs) @@ -3186,6 +3190,8 @@ Extra keyword ``ax`` can be used to override the default axis instance. \**kwargs passed on to :meth:`imshow`. + + returns an matplotlib.image.AxesImage instance. """ try: from PIL import Image This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-12-13 17:45:05
|
Revision: 6599 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6599&view=rev Author: jswhit Date: 2008-12-13 17:45:00 +0000 (Sat, 13 Dec 2008) Log Message: ----------- docstring update. 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 2008-12-13 15:11:57 UTC (rev 6598) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-13 17:45:00 UTC (rev 6599) @@ -2185,7 +2185,9 @@ Extra keyword ``ax`` can be used to override the default axis instance. - Other \**kwargs passed on to matplotlib.patches.Polygon.""" + Other \**kwargs passed on to matplotlib.patches.Polygon. + + returns a matplotlib.patches.Polygon object.""" if not kwargs.has_key('ax') and self.ax is None: try: ax = plt.gca() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-12-17 23:37:27
|
Revision: 6657 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6657&view=rev Author: jswhit Date: 2008-12-17 23:37:18 +0000 (Wed, 17 Dec 2008) Log Message: ----------- fix docstring typo 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 2008-12-17 23:00:03 UTC (rev 6656) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-17 23:37:18 UTC (rev 6657) @@ -322,11 +322,11 @@ (size of y dimension / size of x dimension). llcrnrlon longitude of lower left hand corner of the selected map domain. - llcrnrlon latitude of lower left hand corner of the + llcrnrlat latitude of lower left hand corner of the selected map domain. urcrnrlon longitude of upper right hand corner of the selected map domain. - urcrnrlon latitude of upper right hand corner of the + urcrnrlat latitude of upper right hand corner of the selected map domain. llcrnrx x value of lower left hand corner of the selected map domain in map projection coordinates. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-12-26 23:21:00
|
Revision: 6704 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6704&view=rev Author: jswhit Date: 2008-12-26 23:20:56 +0000 (Fri, 26 Dec 2008) Log Message: ----------- fix defn of llcrnrlon, urcrnrlon for pseudo-cyl projections 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 2008-12-26 16:36:39 UTC (rev 6703) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-26 23:20:56 UTC (rev 6704) @@ -594,9 +594,9 @@ raise ValueError, 'must specify lon_0 for %s projection' % _projnames[self.projection] if width is not None or height is not None: print 'warning: width and height keywords ignored for %s projection' % _projnames[self.projection] - llcrnrlon = -180. + llcrnrlon = lon_0-180. llcrnrlat = -90. - urcrnrlon = 180 + urcrnrlon = lon_0+180 urcrnrlat = 90. self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-12-31 20:19:20
|
Revision: 6729 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6729&view=rev Author: jswhit Date: 2008-12-31 20:19:16 +0000 (Wed, 31 Dec 2008) Log Message: ----------- fix small bug in land-sea mask lat/lon definitions 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 2008-12-31 19:56:55 UTC (rev 6728) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-31 20:19:16 UTC (rev 6729) @@ -3110,9 +3110,16 @@ lsmaskf = open(os.path.join(basemap_datadir,'5minmask.bin'),'rb') nlons = 4320; nlats = nlons/2 delta = 360./float(nlons) - lsmask_lons = np.arange(-180+0.5*delta,180.,delta) - lsmask_lats = np.arange(-90.+0.5*delta,90.,delta) lsmask = np.reshape(np.fromstring(lsmaskf.read(),np.uint8),(nlats,nlons)) + lsmask_lons = np.arange(-180,180.,delta) + lsmask_lats = np.arange(-90.,90+0.5*delta,delta) + # add cyclic point in longitude + lsmask, lsmask_lons = addcyclic(lsmask, lsmask_lons) + nlons = nlons + 1; nlats = nlats + 1 + # add North Pole point (assumed water) + tmparr = np.zeros((nlats,nlons),lsmask.dtype) + tmparr[0:nlats-1,0:nlons] = lsmask + lsmask = tmparr lsmaskf.close() # instance variable lsmask is set on first invocation, # it contains the land-sea mask interpolated to the native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-01-16 16:22:19
|
Revision: 6788 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6788&view=rev Author: jswhit Date: 2009-01-16 16:22:16 +0000 (Fri, 16 Jan 2009) Log Message: ----------- added more informative error message when one of shapefile components can't be found. 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 2009-01-16 16:12:27 UTC (rev 6787) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-01-16 16:22:16 UTC (rev 6788) @@ -1608,6 +1608,12 @@ vertices. If ``drawbounds=True`` a matplotlib.patches.LineCollection object is appended to the tuple. """ + if not os.path.exists('%s.shp'%shapefile): + raise IOError('cannot locate %s.shp'%shapefile) + if not os.path.exists('%s.shx'%shapefile): + raise IOError('cannot locate %s.shx'%shapefile) + if not os.path.exists('%s.dbf'%shapefile): + raise IOError('cannot locate %s.dbf'%shapefile) # open shapefile, read vertices for each object, convert # to map projection coordinates (only works for 2D shape types). try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-01-26 20:27:54
|
Revision: 6835 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6835&view=rev Author: jswhit Date: 2009-01-26 20:27:50 +0000 (Mon, 26 Jan 2009) Log Message: ----------- make default calendar proleptic_gregorian for date2index (to be consistent with num2date and date2num) 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 2009-01-26 20:27:17 UTC (rev 6834) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-01-26 20:27:50 UTC (rev 6835) @@ -3943,7 +3943,7 @@ cdftime = netcdftime.utime(units,calendar=calendar) return cdftime.date2num(dates) -def date2index(dates, nctime, calendar=None): +def date2index(dates, nctime, calendar='proleptic_gregorian'): """ Return indices of a netCDF time variable corresponding to the given dates. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-01-26 22:54:43
|
Revision: 6837 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6837&view=rev Author: jswhit Date: 2009-01-26 22:54:38 +0000 (Mon, 26 Jan 2009) Log Message: ----------- update date2index docstring. 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 2009-01-26 22:49:01 UTC (rev 6836) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-01-26 22:54:38 UTC (rev 6837) @@ -3973,6 +3973,9 @@ ``proleptic_gregorian``, ``noleap``, ``365_day``, ``julian``, ``all_leap``, ``366_day``. Default is ``proleptic_gregorian``. + If ``calendar=None``, will use ``calendar`` attribute + of ``nctime`` object, and if that attribute does + not exist calendar is set to ``standard``. ============== ==================================================== Returns an index or a sequence of indices. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-01-26 23:02:55
|
Revision: 6839 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6839&view=rev Author: jswhit Date: 2009-01-26 23:02:46 +0000 (Mon, 26 Jan 2009) Log Message: ----------- remove some extra whitespace 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 2009-01-26 22:56:11 UTC (rev 6838) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-01-26 23:02:46 UTC (rev 6839) @@ -3582,7 +3582,7 @@ .. tabularcolumns:: |l|L| ============== ==================================================== - Arguments Description + Arguments Description ============== ==================================================== datain a rank-2 array with 1st dimension corresponding to y, 2nd dimension x. @@ -3595,7 +3595,7 @@ .. tabularcolumns:: |l|L| ============== ==================================================== - Keywords Description + Keywords Description ============== ==================================================== checkbounds If True, values of xout and yout are checked to see that they lie within the range specified by xin @@ -3714,7 +3714,7 @@ .. tabularcolumns:: |l|L| ============== ==================================================== - Arguments Description + Arguments Description ============== ==================================================== lon0 starting longitude for shifted grid (ending longitude if start=False). lon0 must be on @@ -3726,7 +3726,7 @@ .. tabularcolumns:: |l|L| ============== ==================================================== - Keywords Description + Keywords Description ============== ==================================================== start if True, lon0 represents the starting longitude of the new grid. if False, lon0 is the ending @@ -3858,7 +3858,7 @@ .. tabularcolumns:: |l|L| ============== ==================================================== - Keywords Description + Keywords Description ============== ==================================================== units a string of the form '<time units> since <reference time>' describing the units and @@ -3917,7 +3917,7 @@ .. tabularcolumns:: |l|L| ============== ==================================================== - Keywords Description + Keywords Description ============== ==================================================== units a string of the form '<time units> since <reference time>' describing the units and @@ -3962,7 +3962,7 @@ .. tabularcolumns:: |l|L| ============== ==================================================== - Keywords Description + Keywords Description ============== ==================================================== calendar describes the calendar used in the time calculations. All the values currently defined in @@ -3990,7 +3990,7 @@ .. tabularcolumns:: |l|L| ============== ==================================================== - Arguments Description + Arguments Description ============== ==================================================== lonsin, latsin rank-2 arrays containing longitudes and latitudes of grid. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-02-06 13:12:41
|
Revision: 6888 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6888&view=rev Author: jswhit Date: 2009-02-06 13:12:38 +0000 (Fri, 06 Feb 2009) Log Message: ----------- import cm into basemap namespace 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 2009-02-06 02:51:24 UTC (rev 6887) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-02-06 13:12:38 UTC (rev 6888) @@ -41,6 +41,7 @@ import numpy.ma as ma from shapelib import ShapeFile import _geoslib, netcdftime +import cm # basemap data files now installed in lib/matplotlib/toolkits/basemap/data # check to see if environment variable BASEMAPDATA set to a directory, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-03-09 15:20:08
|
Revision: 6970 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6970&view=rev Author: jswhit Date: 2009-03-09 15:19:49 +0000 (Mon, 09 Mar 2009) Log Message: ----------- tweak interp docstring to be more general (xout, yout don't actually have to be rank-2) 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 2009-03-08 13:29:00 UTC (rev 6969) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-03-09 15:19:49 UTC (rev 6970) @@ -3598,8 +3598,7 @@ y, 2nd dimension x. xin, yin rank-1 arrays containing x and y of datain grid in increasing order. - xout, yout rank-2 arrays containing x and y of desired output - grid. + xout, yout arrays containing x and y of desired output grid. ============== ==================================================== .. tabularcolumns:: |l|L| This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-06-17 02:16:57
|
Revision: 7224 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7224&view=rev Author: jswhit Date: 2009-06-17 02:06:27 +0000 (Wed, 17 Jun 2009) Log Message: ----------- axes.frame replaced by axes.spines 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 2009-06-16 18:31:57 UTC (rev 7223) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-06-17 02:06:27 UTC (rev 7224) @@ -1262,24 +1262,44 @@ limb.set_zorder(zorder) else: # all other projections are rectangular. # use axesPatch for fill_color, frame for border line props. - ax.frame.set_linewidth(linewidth) + try: + ax.frame.set_linewidth(linewidth) + except AttributeError: + for spine in ax.spines.itervalues(): + ax.spines[spine].set_linewidth(linewidth) if self.projection not in ['geos','ortho']: if fill_color is not None: ax.axesPatch.set_facecolor(fill_color) - ax.frame.set_edgecolor(color) + try: + ax.frame.set_edgecolor(color) + except AttributeError: + for spine in ax.spines.itervalues(): + ax.spines[spine].set_edgecolor(color) ax.set_frame_on(True) # FIXME? should zorder be set separately for edge and background? if zorder is not None: ax.axesPatch.set_zorder(zorder) - ax.frame.set_zorder(zorder) + try: + ax.frame.set_zorder(zorder) + except AttributeError: + for spine in ax.spines.itervalues(): + ax.spines[spine].set_zorder(zorder) else: # use axesPatch for fill_color, frame for border line props. - ax.frame.set_edgecolor(color) + try: + ax.frame.set_edgecolor(color) + except AttributeError: + for spine in ax.spines.itervalues(): + ax.spines[spine].set_edgecolor(color) ax.set_frame_on(True) # FIXME? should zorder be set separately for edge and background? if zorder is not None: ax.axesPatch.set_zorder(zorder) - ax.frame.set_zorder(zorder) + try: + ax.frame.set_zorder(zorder) + except AttributeError: + for spine in ax.spines.itervalues(): + ax.spines[spine].set_zorder(zorder) # for geos or ortho projections, also # draw and fill map projection limb, clipped # to rectangular region. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-06-23 13:15:21
|
Revision: 7232 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7232&view=rev Author: jswhit Date: 2009-06-23 12:47:49 +0000 (Tue, 23 Jun 2009) Log Message: ----------- fix bug in spines 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 2009-06-23 12:39:21 UTC (rev 7231) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-06-23 12:47:49 UTC (rev 7232) @@ -1266,7 +1266,7 @@ ax.frame.set_linewidth(linewidth) except AttributeError: for spine in ax.spines.itervalues(): - ax.spines[spine].set_linewidth(linewidth) + spine.set_linewidth(linewidth) if self.projection not in ['geos','ortho']: if fill_color is not None: ax.axesPatch.set_facecolor(fill_color) @@ -1274,7 +1274,7 @@ ax.frame.set_edgecolor(color) except AttributeError: for spine in ax.spines.itervalues(): - ax.spines[spine].set_edgecolor(color) + spine.set_edgecolor(color) ax.set_frame_on(True) # FIXME? should zorder be set separately for edge and background? if zorder is not None: @@ -1283,14 +1283,14 @@ ax.frame.set_zorder(zorder) except AttributeError: for spine in ax.spines.itervalues(): - ax.spines[spine].set_zorder(zorder) + spine.set_zorder(zorder) else: # use axesPatch for fill_color, frame for border line props. try: ax.frame.set_edgecolor(color) except AttributeError: for spine in ax.spines.itervalues(): - ax.spines[spine].set_edgecolor(color) + spine.set_edgecolor(color) ax.set_frame_on(True) # FIXME? should zorder be set separately for edge and background? if zorder is not None: @@ -1299,7 +1299,7 @@ ax.frame.set_zorder(zorder) except AttributeError: for spine in ax.spines.itervalues(): - ax.spines[spine].set_zorder(zorder) + spine.set_zorder(zorder) # for geos or ortho projections, also # draw and fill map projection limb, clipped # to rectangular region. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-06-24 18:11:33
|
Revision: 7236 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7236&view=rev Author: jswhit Date: 2009-06-24 18:11:30 +0000 (Wed, 24 Jun 2009) Log Message: ----------- put ax checking code in a separate private method 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 2009-06-24 05:51:52 UTC (rev 7235) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-06-24 18:11:30 UTC (rev 7236) @@ -1203,14 +1203,7 @@ returns matplotlib.collections.PatchCollection representing map boundary. """ # get current axes instance (if none specified). - if ax is None and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif ax is None and self.ax is not None: - ax = self.ax + ax = ax or self._check_ax() limb = None if self.projection in ['ortho','geos'] or (self.projection=='aeqd' and\ self._fulldisk): @@ -1344,14 +1337,7 @@ if self.resolution is None: raise AttributeError, 'there are no boundary datasets associated with this Basemap instance' # get current axes instance (if none specified). - if ax is None and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif ax is None and self.ax is not None: - ax = self.ax + ax = ax or self._check_ax() # get axis background color. axisbgc = ax.get_axis_bgcolor() npoly = 0 @@ -1414,14 +1400,7 @@ if self.resolution is None: raise AttributeError, 'there are no boundary datasets associated with this Basemap instance' # get current axes instance (if none specified). - if ax is None and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif ax is None and self.ax is not None: - ax = self.ax + ax = ax or self._check_ax() coastlines = LineCollection(self.coastsegs,antialiaseds=(antialiased,)) coastlines.set_color(color) coastlines.set_linewidth(linewidth) @@ -1461,14 +1440,7 @@ if not hasattr(self,'cntrysegs'): self.cntrysegs, types = self._readboundarydata('countries') # get current axes instance (if none specified). - if ax is None and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif ax is None and self.ax is not None: - ax = self.ax + ax = ax or self._check_ax() countries = LineCollection(self.cntrysegs,antialiaseds=(antialiased,)) countries.set_color(color) countries.set_linewidth(linewidth) @@ -1508,14 +1480,7 @@ if not hasattr(self,'statesegs'): self.statesegs, types = self._readboundarydata('states') # get current axes instance (if none specified). - if ax is None and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif ax is None and self.ax is not None: - ax = self.ax + ax = ax or self._check_ax() states = LineCollection(self.statesegs,antialiaseds=(antialiased,)) states.set_color(color) states.set_linewidth(linewidth) @@ -1555,14 +1520,7 @@ if not hasattr(self,'riversegs'): self.riversegs, types = self._readboundarydata('rivers') # get current axes instance (if none specified). - if ax is None and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif ax is None and self.ax is not None: - ax = self.ax + ax = ax or self._check_ax() rivers = LineCollection(self.riversegs,antialiaseds=(antialiased,)) rivers.set_color(color) rivers.set_linewidth(linewidth) @@ -1703,14 +1661,7 @@ # draw shape boundaries using LineCollection. if drawbounds: # get current axes instance (if none specified). - if ax is None and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif ax is None and self.ax is not None: - ax = self.ax + ax = ax or self._check_ax() # make LineCollections for each polygon. lines = LineCollection(shpsegs,antialiaseds=(1,)) lines.set_color(color) @@ -1783,14 +1734,7 @@ associated with each parallel. """ # get current axes instance (if none specified). - if ax is None and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif ax is None and self.ax is not None: - ax = self.ax + ax = ax or self._check_ax() # don't draw meridians past latmax, always draw parallel at latmax. if latmax is None: latmax = 80. # offset for labels. @@ -2043,14 +1987,7 @@ associated with each meridian. """ # get current axes instance (if none specified). - if ax is None and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif ax is None and self.ax is not None: - ax = self.ax + ax = ax or self._check_ax() # don't draw meridians past latmax, always draw parallel at latmax. if latmax is None: latmax = 80. # unused w/ cyl, merc or miller proj. # offset for labels. @@ -2255,16 +2192,7 @@ Other \**kwargs passed on to matplotlib.patches.Polygon. returns a matplotlib.patches.Polygon object.""" - if not kwargs.has_key('ax') and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif not kwargs.has_key('ax') and self.ax is not None: - ax = self.ax - else: - ax = kwargs.pop('ax') + ax = kwargs.pop('ax', None) or self._check_ax() g = pyproj.Geod(a=self.rmajor,b=self.rminor) az12,az21,dist = g.inv(lon_0,lat_0,lon_0,lat_0+radius_deg) seg = [self(lon_0,lat_0+radius_deg)] @@ -2577,14 +2505,7 @@ or specified axes instance. """ # get current axes instance (if none specified). - if ax is None and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif ax is None and self.ax is not None: - ax = self.ax + ax = ax or self._check_ax() # update data limits for map domain. corners = ((self.llcrnrx,self.llcrnry), (self.urcrnrx,self.urcrnry)) ax.update_datalim( corners ) @@ -2621,16 +2542,7 @@ Other \**kwargs passed on to matplotlib.pyplot.scatter. """ - if not kwargs.has_key('ax') and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif not kwargs.has_key('ax') and self.ax is not None: - ax = self.ax - else: - ax = kwargs.pop('ax') + ax = kwargs.pop('ax', None) or self._check_ax() # allow callers to override the hold state by passing hold=True|False b = ax.ishold() h = kwargs.pop('hold',None) @@ -2664,16 +2576,7 @@ Other \**kwargs passed on to matplotlib.pyplot.plot. """ - if not kwargs.has_key('ax') and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif not kwargs.has_key('ax') and self.ax is not None: - ax = self.ax - else: - ax = kwargs.pop('ax') + ax = kwargs.pop('ax', None) or self._check_ax() # allow callers to override the hold state by passing hold=True|False b = ax.ishold() h = kwargs.pop('hold',None) @@ -2707,16 +2610,7 @@ returns an matplotlib.image.AxesImage instance. """ - if not kwargs.has_key('ax') and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif not kwargs.has_key('ax') and self.ax is not None: - ax = self.ax - else: - ax = kwargs.pop('ax') + ax = kwargs.pop('ax', None) or self._check_ax() kwargs['extent']=(self.llcrnrx,self.urcrnrx,self.llcrnry,self.urcrnry) # use origin='lower', unless overridden. if not kwargs.has_key('origin'): @@ -2758,16 +2652,7 @@ Other \**kwargs passed on to matplotlib.pyplot.pcolor. """ - if not kwargs.has_key('ax') and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif not kwargs.has_key('ax') and self.ax is not None: - ax = self.ax - else: - ax = kwargs.pop('ax') + ax = kwargs.pop('ax', None) or self._check_ax() # make x,y masked arrays # (masked where data is outside of projection limb) x = ma.masked_values(np.where(x > 1.e20,1.e20,x), 1.e20) @@ -2805,16 +2690,7 @@ Other \**kwargs passed on to matplotlib.pyplot.pcolormesh. """ - if not kwargs.has_key('ax') and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif not kwargs.has_key('ax') and self.ax is not None: - ax = self.ax - else: - ax = kwargs.pop('ax') + ax = kwargs.pop('ax', None) or self._check_ax() # allow callers to override the hold state by passing hold=True|False b = ax.ishold() h = kwargs.pop('hold',None) @@ -2848,16 +2724,7 @@ Other \*args and \**kwargs passed on to matplotlib.pyplot.contour. """ - if not kwargs.has_key('ax') and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif not kwargs.has_key('ax') and self.ax is not None: - ax = self.ax - else: - ax = kwargs.pop('ax') + ax = kwargs.pop('ax', None) or self._check_ax() # make sure x is monotonically increasing - if not, # print warning suggesting that the data be shifted in longitude # with the shiftgrid function. @@ -2921,16 +2788,7 @@ Other \*args and \**kwargs passed on to matplotlib.pyplot.scatter. """ - if not kwargs.has_key('ax') and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif not kwargs.has_key('ax') and self.ax is not None: - ax = self.ax - else: - ax = kwargs.pop('ax') + ax = kwargs.pop('ax', None) or self._check_ax() # make sure x is monotonically increasing - if not, # print warning suggesting that the data be shifted in longitude # with the shiftgrid function. @@ -2991,16 +2849,7 @@ Other \*args and \**kwargs passed on to matplotlib.pyplot.quiver. """ - if not kwargs.has_key('ax') and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif not kwargs.has_key('ax') and self.ax is not None: - ax = self.ax - else: - ax = kwargs.pop('ax') + ax = kwargs.pop('ax', None) or self._check_ax() # allow callers to override the hold state by passing hold=True|False b = ax.ishold() h = kwargs.pop('hold',None) @@ -3037,16 +2886,7 @@ barb method requires matplotlib 0.98.3 or higher, you have %s""" % _matplotlib_version) raise NotImplementedError(msg) - if not kwargs.has_key('ax') and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif not kwargs.has_key('ax') and self.ax is not None: - ax = self.ax - else: - ax = kwargs.pop('ax') + ax = kwargs.pop('ax', None) or self._check_ax() # allow callers to override the hold state by passing hold=True|False b = ax.ishold() h = kwargs.pop('hold',None) @@ -3136,16 +2976,7 @@ rgba_ocean = ocean_color # look for axes instance (as keyword, an instance variable # or from plt.gca(). - if not kwargs.has_key('ax') and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif not kwargs.has_key('ax') and self.ax is not None: - ax = self.ax - else: - ax = kwargs.pop('ax') + ax = kwargs.pop('ax', None) or self._check_ax() # if lsmask,lsmask_lons,lsmask_lats keywords not given, # read default land-sea mask in from file. if lsmask is None or lsmask_lons is None or lsmask_lats is None: @@ -3267,16 +3098,7 @@ except ImportError: raise ImportError('warpimage method requires PIL (http://www.pythonware.com/products/pil)') from matplotlib.image import pil_to_array - if not kwargs.has_key('ax') and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif not kwargs.has_key('ax') and self.ax is not None: - ax = self.ax - else: - ax = kwargs.pop('ax') + ax = kwargs.pop('ax', None) or self._check_ax() # default image file is blue marble next generation # from NASA (http://visibleearth.nasa.gov). if image == "bluemarble": @@ -3436,14 +3258,7 @@ Extra keyword ``ax`` can be used to override the default axis instance. """ # get current axes instance (if none specified). - if ax is None and self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - elif ax is None and self.ax is not None: - ax = self.ax + ax = ax or self._check_ax() # not valid for cylindrical projection if self.projection == 'cyl': raise ValueError("cannot draw map scale for projection='cyl'") @@ -3578,6 +3393,27 @@ raise KeyError("barstyle must be 'simple' or 'fancy'") return rets + def _check_ax(self, ax=None): + """ + Returns the axis on which to draw. + By default, returns self.ax. If None, set it to plt.gca() + """ + # + if ax is None: + if self.ax is None: + try: + ax = plt.gca() + except: + import matplotlib.pyplot as plt + ax = plt.gca() + else: + ax = self.ax + # associate an axes instance with this Basemap instance + # the first time this method is called. + # self.ax = ax + #return self.ax + return ax + ### End of Basemap class def _searchlist(a,x): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-06-24 18:19:54
|
Revision: 7237 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7237&view=rev Author: jswhit Date: 2009-06-24 18:18:55 +0000 (Wed, 24 Jun 2009) Log Message: ----------- simplify _check_ax method 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 2009-06-24 18:11:30 UTC (rev 7236) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-06-24 18:18:55 UTC (rev 7237) @@ -3393,25 +3393,22 @@ raise KeyError("barstyle must be 'simple' or 'fancy'") return rets - def _check_ax(self, ax=None): + def _check_ax(self): """ - Returns the axis on which to draw. - By default, returns self.ax. If None, set it to plt.gca() + Returns the axis on which to draw. + Returns self.ax, or if self.ax=None returns plt.gca(). """ - # - if ax is None: - if self.ax is None: - try: - ax = plt.gca() - except: - import matplotlib.pyplot as plt - ax = plt.gca() - else: - ax = self.ax + if self.ax is None: + try: + ax = plt.gca() + except: + import matplotlib.pyplot as plt + ax = plt.gca() # associate an axes instance with this Basemap instance # the first time this method is called. - # self.ax = ax - #return self.ax + #self.ax = ax + else: + ax = self.ax return ax ### End of Basemap class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-06-24 18:54:33
|
Revision: 7238 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7238&view=rev Author: jswhit Date: 2009-06-24 18:53:48 +0000 (Wed, 24 Jun 2009) Log Message: ----------- add code to import pyplot as necessary 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 2009-06-24 18:18:55 UTC (rev 7237) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-06-24 18:53:48 UTC (rev 7238) @@ -2543,6 +2543,9 @@ Other \**kwargs passed on to matplotlib.pyplot.scatter. """ ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt # allow callers to override the hold state by passing hold=True|False b = ax.ishold() h = kwargs.pop('hold',None) @@ -2611,6 +2614,9 @@ returns an matplotlib.image.AxesImage instance. """ ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt kwargs['extent']=(self.llcrnrx,self.urcrnrx,self.llcrnry,self.urcrnry) # use origin='lower', unless overridden. if not kwargs.has_key('origin'): @@ -2653,6 +2659,9 @@ Other \**kwargs passed on to matplotlib.pyplot.pcolor. """ ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt # make x,y masked arrays # (masked where data is outside of projection limb) x = ma.masked_values(np.where(x > 1.e20,1.e20,x), 1.e20) @@ -2691,6 +2700,9 @@ Other \**kwargs passed on to matplotlib.pyplot.pcolormesh. """ ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt # allow callers to override the hold state by passing hold=True|False b = ax.ishold() h = kwargs.pop('hold',None) @@ -2725,6 +2737,9 @@ Other \*args and \**kwargs passed on to matplotlib.pyplot.contour. """ ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt # make sure x is monotonically increasing - if not, # print warning suggesting that the data be shifted in longitude # with the shiftgrid function. @@ -2789,6 +2804,9 @@ Other \*args and \**kwargs passed on to matplotlib.pyplot.scatter. """ ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt # make sure x is monotonically increasing - if not, # print warning suggesting that the data be shifted in longitude # with the shiftgrid function. @@ -2850,6 +2868,9 @@ Other \*args and \**kwargs passed on to matplotlib.pyplot.quiver. """ ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt # allow callers to override the hold state by passing hold=True|False b = ax.ishold() h = kwargs.pop('hold',None) @@ -2887,6 +2908,9 @@ you have %s""" % _matplotlib_version) raise NotImplementedError(msg) ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt # allow callers to override the hold state by passing hold=True|False b = ax.ishold() h = kwargs.pop('hold',None) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-08-05 16:56:00
|
Revision: 7386 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7386&view=rev Author: jswhit Date: 2009-08-05 16:55:48 +0000 (Wed, 05 Aug 2009) Log Message: ----------- fix bug preventing drawing of parallels in some projections. 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 2009-08-05 16:30:55 UTC (rev 7385) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-08-05 16:55:48 UTC (rev 7386) @@ -1789,8 +1789,7 @@ yd = (y[1:]-y[0:-1])**2 dist = np.sqrt(xd+yd) split = dist > 500000. - if np.sum(split) and self.projection not in \ - ['cyl', 'merc', 'mill', 'gall', 'moll', 'robin', 'sinu', 'mbtfpq']: + if np.sum(split) and self.projection not in _cylproj: ind = (np.compress(split,np.squeeze(split*np.indices(xd.shape)))+1).tolist() xl = [] yl = [] @@ -2028,7 +2027,7 @@ yd = (y[1:]-y[0:-1])**2 dist = np.sqrt(xd+yd) split = dist > 500000. - if np.sum(split) and self.projection not in _cylproj + _pseudocyl: + if np.sum(split) and self.projection not in _cylproj: ind = (np.compress(split,np.squeeze(split*np.indices(xd.shape)))+1).tolist() xl = [] yl = [] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-08-07 14:26:47
|
Revision: 7415 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7415&view=rev Author: jswhit Date: 2009-08-07 14:26:35 +0000 (Fri, 07 Aug 2009) Log Message: ----------- change example in docstrings to use np.loadtxt instead of mlab.load 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 2009-08-07 10:15:04 UTC (rev 7414) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-08-07 14:26:35 UTC (rev 7415) @@ -379,11 +379,10 @@ >>> from mpl_toolkits.basemap import Basemap >>> import numpy as np >>> import matplotlib.pyplot as plt - >>> import matplotlib.mlab as mlab >>> # read in topo data (on a regular lat/lon grid) - >>> etopo = mlab.load('etopo20data.gz') - >>> lons = mlab.load('etopo20lons.gz') - >>> lats = mlab.load('etopo20lats.gz') + >>> etopo = np.loadtxt('etopo20data.gz') + >>> lons = np.loadtxt('etopo20lons.gz') + >>> lats = np.loadtxt('etopo20lats.gz') >>> # create Basemap instance for Robinson projection. >>> m = Basemap(projection='robin',lon_0=0.5*(lons[0]+lons[-1])) >>> # compute map projection coordinates for lat/lon grid. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-08-25 11:54:34
|
Revision: 7566 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7566&view=rev Author: jswhit Date: 2009-08-25 11:54:24 +0000 (Tue, 25 Aug 2009) Log Message: ----------- add lonmin, lonmax instance vars 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 2009-08-25 02:15:45 UTC (rev 7565) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-08-25 11:54:24 UTC (rev 7566) @@ -737,13 +737,19 @@ if projection in _cylproj: self.latmin = self.llcrnrlat self.latmax = self.urcrnrlat + self.lonmin = self.llcrnrlon + self.lonmax = self.urcrnrlon elif projection in ['ortho','geos'] + _pseudocyl: self.latmin = -90. self.latmax = 90. + self.lonmin = self.llcrnrlon + self.lonmax = self.urcrnrlon else: - lons, lats = self.makegrid(101,101) + lons, lats = self.makegrid(1001,1001) self.latmin = lats.min() self.latmax = lats.max() + self.lonmin = lons.min() + self.lonmax = lons.max() # if ax == None, pyplot.gca may be used. self.ax = ax This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-08-26 11:52:14
|
Revision: 7574 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7574&view=rev Author: jswhit Date: 2009-08-26 11:52:06 +0000 (Wed, 26 Aug 2009) Log Message: ----------- check that date is utc in nightshade 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 2009-08-26 11:33:41 UTC (rev 7573) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-08-26 11:52:06 UTC (rev 7574) @@ -3445,6 +3445,9 @@ returns a matplotlib.contour.ContourSet instance. """ from solar import daynight_grid + # make sure date is utc. + if date.utcoffset() is not None: + raise ValueError('datetime instance must be UTC') # create grid of day=0, night=1 lons,lats,daynight = daynight_grid(date,delta,self.lonmin,self.lonmax) x,y = self(lons,lats) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-08-30 01:04:27
|
Revision: 7588 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7588&view=rev Author: jswhit Date: 2009-08-30 01:04:11 +0000 (Sun, 30 Aug 2009) Log Message: ----------- workaround for contourf bug (mask regions outside map) 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 2009-08-30 00:08:34 UTC (rev 7587) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-08-30 01:04:11 UTC (rev 7588) @@ -2831,9 +2831,17 @@ region (see examples/contour_demo.py).""") # mask for points outside projection limb. xymask = np.logical_or(np.greater(x,1.e20),np.greater(y,1.e20)) + # mask outside projection region (workaround for contourf bug?) + epsx = 0.1*(self.xmax-self.xmin) + epsy = 0.1*(self.ymax-self.ymin) + outsidemask = np.logical_or(np.logical_or(x > self.xmax+epsx,\ + x < self.xmin-epsy),\ + np.logical_or(y > self.ymax+epsy,\ + y < self.ymin-epsy)) data = ma.asarray(data) - # combine with data mask. - mask = np.logical_or(ma.getmaskarray(data),xymask) + # combine masks. + mask = \ + np.logical_or(outsidemask,np.logical_or(ma.getmaskarray(data),xymask)) data = ma.masked_array(data,mask=mask) # allow callers to override the hold state by passing hold=True|False b = ax.ishold() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-09-08 12:40:36
|
Revision: 7708 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7708&view=rev Author: jswhit Date: 2009-09-08 12:12:18 +0000 (Tue, 08 Sep 2009) Log Message: ----------- update date2index docstring 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 2009-09-08 12:06:35 UTC (rev 7707) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-09-08 12:12:18 UTC (rev 7708) @@ -3919,6 +3919,13 @@ If ``calendar=None``, will use ``calendar`` attribute of ``nctime`` object, and if that attribute does not exist calendar is set to ``standard``. + select The index selection method. ``exact`` wil return the + indices perfectly matching the dates given. + ``before`` and ``after`` will return the indices + corresponding to the dates just before or after + the given dates if an exact match cannot be found. + ``nearest`` will return the indices that + correspond to the closest dates. ============== ==================================================== Returns an index or a sequence of indices. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-09-09 16:28:51
|
Revision: 7725 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7725&view=rev Author: jswhit Date: 2009-09-09 16:28:43 +0000 (Wed, 09 Sep 2009) Log Message: ----------- update date2index wrapper to be consistent with date2index in netcdftime.py 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 2009-09-09 14:47:09 UTC (rev 7724) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-09-09 16:28:43 UTC (rev 7725) @@ -3886,7 +3886,7 @@ cdftime = netcdftime.utime(units,calendar=calendar) return cdftime.date2num(dates) -def date2index(dates, nctime, calendar='proleptic_gregorian'): +def date2index(dates, nctime, calendar='proleptic_gregorian',select='exact'): """ Return indices of a netCDF time variable corresponding to the given dates. @@ -3919,18 +3919,18 @@ If ``calendar=None``, will use ``calendar`` attribute of ``nctime`` object, and if that attribute does not exist calendar is set to ``standard``. - select The index selection method. ``exact`` wil return the + select The index selection method. ``exact`` will return the indices perfectly matching the dates given. ``before`` and ``after`` will return the indices corresponding to the dates just before or after the given dates if an exact match cannot be found. ``nearest`` will return the indices that - correspond to the closest dates. + correspond to the closest dates. Default ``exact``. ============== ==================================================== Returns an index or a sequence of indices. """ - return netcdftime.date2index(dates, nctime, calendar=None) + return netcdftime.date2index(dates, nctime, calendar=calendar, select=select) def maskoceans(lonsin,latsin,datain,inlands=False): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-09-10 11:39:30
|
Revision: 7732 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7732&view=rev Author: jswhit Date: 2009-09-10 11:39:23 +0000 (Thu, 10 Sep 2009) Log Message: ----------- change default calendar for date2index. 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 2009-09-10 11:36:16 UTC (rev 7731) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-09-10 11:39:23 UTC (rev 7732) @@ -3886,7 +3886,7 @@ cdftime = netcdftime.utime(units,calendar=calendar) return cdftime.date2num(dates) -def date2index(dates, nctime, calendar='proleptic_gregorian',select='exact'): +def date2index(dates, nctime, calendar=None,select='exact'): """ Return indices of a netCDF time variable corresponding to the given dates. @@ -3915,10 +3915,10 @@ Valid calendars ``standard``, ``gregorian``, ``proleptic_gregorian``, ``noleap``, ``365_day``, ``julian``, ``all_leap``, ``366_day``. - Default is ``proleptic_gregorian``. If ``calendar=None``, will use ``calendar`` attribute of ``nctime`` object, and if that attribute does not exist calendar is set to ``standard``. + Default is ``None``. select The index selection method. ``exact`` will return the indices perfectly matching the dates given. ``before`` and ``after`` will return the indices This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ry...@us...> - 2009-09-28 22:12:47
|
Revision: 7833 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7833&view=rev Author: ryanmay Date: 2009-09-28 22:12:38 +0000 (Mon, 28 Sep 2009) Log Message: ----------- Update to be compatible with matplotlib trunk's new method of tracking the current image. 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 2009-09-28 21:58:10 UTC (rev 7832) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-09-28 22:12:38 UTC (rev 7833) @@ -2567,7 +2567,10 @@ ax.hold(b) # reset current active image (only if pyplot is imported). try: - plt.gci._current = ret + try: + plt.sci(ret) + except AttributeError: + plt.gci._current = ret except: pass # set axes limits to fit map region. @@ -2642,7 +2645,10 @@ ax.hold(b) # reset current active image (only if pyplot is imported). try: - plt.gci._current = ret + try: + plt.sci(ret) + except AttributeError: + plt.gci._current = ret except: pass # set axes limits to fit map region. @@ -2687,7 +2693,10 @@ ax.hold(b) # reset current active image (only if pyplot is imported). try: - plt.gci._current = ret + try: + plt.sci(ret) + except AttributeError: + plt.gci._current = ret except: pass # set axes limits to fit map region. @@ -2724,7 +2733,10 @@ ax.hold(b) # reset current active image (only if pyplot is imported). try: - plt.gci._current = ret + try: + plt.sci(ret) + except AttributeError: + plt.gci._current = ret except: pass # set axes limits to fit map region. @@ -2788,9 +2800,17 @@ # reset current active image (only if pyplot is imported). try: try: # new contour. - if CS._A is not None: plt.gci._current = CS + if CS._A is not None: + try: + plt.sci(CS) + except AttributeError: + plt.gci._current = CS except: # old contour. - if CS[1].mappable is not None: plt.gci._current = CS[1].mappable + if CS[1].mappable is not None: + try: + plt.sci(CS[1].mappable) + except AttributeError: + plt.gci._current = CS[1].mappable except: pass return CS @@ -2863,9 +2883,17 @@ # reset current active image (only if pyplot is imported). try: try: # new contour. - if CS._A is not None: plt.gci._current = CS + if CS._A is not None: + try: + plt.sci(CS) + except AttributeError: + plt.gci._current = CS except: # old contour. - if CS[1].mappable is not None: plt.gci._current = CS[1].mappable + if CS[1].mappable is not None: + try: + plt.sci(CS[1].mappable) + except AttributeError: + plt.gci._current = CS[1].mappable except: pass return CS This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |