From: <js...@us...> - 2008-07-25 02:40:14
|
Revision: 5862 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5862&view=rev Author: jswhit Date: 2008-07-25 02:40:12 +0000 (Fri, 25 Jul 2008) Log Message: ----------- flip wind barbs for points in SH according to meterological convention. 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-07-25 01:43:43 UTC (rev 5861) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-25 02:40:12 UTC (rev 5862) @@ -2914,8 +2914,15 @@ h = kwargs.pop('hold',None) if h is not None: ax.hold(h) + lons, lats = self(x, y, inverse=True) + unh = ma.masked_where(lats <= 0, u) + vnh = ma.masked_where(lats <= 0, v) + ush = ma.masked_where(lats > 0, u) + vsh = ma.masked_where(lats > 0, v) try: - ret = ax.barbs(x,y,u,v,*args,**kwargs) + retnh = ax.barbs(x,y,unh,vnh,*args,**kwargs) + kwargs['flip_barb']=True + retsh = ax.barbs(x,y,ush,vsh,*args,**kwargs) try: plt.draw_if_interactive() except: @@ -2926,7 +2933,7 @@ ax.hold(b) # set axes limits to fit map region. self.set_axes_limits(ax=ax) - return ret + return retnh,retsh def drawlsmask(self,rgba_land,rgba_ocean,lsmask=None, lsmask_lons=None,lsmask_lats=None,lakes=False,**kwargs): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-07-25 11:54:47
|
Revision: 5870 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5870&view=rev Author: jswhit Date: 2008-07-25 11:54:44 +0000 (Fri, 25 Jul 2008) Log Message: ----------- update barbs method 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 2008-07-25 11:41:18 UTC (rev 5869) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-25 11:54:44 UTC (rev 5870) @@ -2898,6 +2898,9 @@ Extra keyword ``ax`` can be used to override the default axis instance. Other \*args and \**kwargs passed on to matplotlib.pyplot.barbs + + Returns two matplotlib.axes.Barbs instances, one for the Northern + Hemisphere and one for the Southern Hemisphere. """ if not kwargs.has_key('ax') and self.ax is None: try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-07-28 16:23:30
|
Revision: 5910 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5910&view=rev Author: jswhit Date: 2008-07-28 16:23:26 +0000 (Mon, 28 Jul 2008) Log Message: ----------- make sure axes.frame (not axes.AxesPatch) used to define properties of map boundary line. 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-07-28 15:40:22 UTC (rev 5909) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-28 16:23:26 UTC (rev 5910) @@ -1211,23 +1211,28 @@ if zorder is not None: limb.set_zorder(zorder) else: # all other projections are rectangular. - ax.axesPatch.set_linewidth(linewidth) + # use axesPatch for fill_color, frame for border line props. + ax.frame.set_linewidth(linewidth) if self.projection not in ['geos','ortho']: if fill_color is None: ax.axesPatch.set_facecolor(ax.get_axis_bgcolor()) else: ax.axesPatch.set_facecolor(fill_color) ax.axesPatch.set_zorder(0) - ax.axesPatch.set_edgecolor(color) + ax.frame.set_zorder(0) + ax.frame.set_edgecolor(color) ax.set_frame_on(True) if zorder is not None: ax.axesPatch.set_zorder(zorder) + ax.frame.set_zorder(zorder) else: - ax.axesPatch.set_facecolor(ax.get_axis_bgcolor()) + # use axesPatch for fill_color, frame for border line props. ax.axesPatch.set_edgecolor(color) + ax.frame.set_edgecolor(color) ax.set_frame_on(True) if zorder is not None: ax.axesPatch.set_zorder(zorder) + ax.frame.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...> - 2008-07-28 17:30:00
|
Revision: 5914 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5914&view=rev Author: jswhit Date: 2008-07-28 17:29:57 +0000 (Mon, 28 Jul 2008) Log Message: ----------- don't touch axesPatch or frame default zorder. 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-07-28 16:58:16 UTC (rev 5913) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-28 17:29:57 UTC (rev 5914) @@ -1214,22 +1214,19 @@ # use axesPatch for fill_color, frame for border line props. ax.frame.set_linewidth(linewidth) if self.projection not in ['geos','ortho']: - if fill_color is None: - ax.axesPatch.set_facecolor(ax.get_axis_bgcolor()) - else: + if fill_color is not None: ax.axesPatch.set_facecolor(fill_color) - ax.axesPatch.set_zorder(0) - ax.frame.set_zorder(0) ax.frame.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) else: # use axesPatch for fill_color, frame for border line props. - ax.axesPatch.set_edgecolor(color) ax.frame.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) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-07-29 12:23:46
|
Revision: 5919 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5919&view=rev Author: jswhit Date: 2008-07-29 12:23:43 +0000 (Tue, 29 Jul 2008) Log Message: ----------- fix docstring markup 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-07-29 12:20:11 UTC (rev 5918) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-29 12:23:43 UTC (rev 5919) @@ -298,7 +298,7 @@ Variable Name Description ================ ==================================================== projection map projection. Print the module variable - "supported_projections" to see a list of allowed + ``supported_projections`` to see a list of allowed values. aspect map aspect ratio (size of y dimension / size of x dimension). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-08-02 12:40:22
|
Revision: 5955 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5955&view=rev Author: jswhit Date: 2008-08-02 12:40:17 +0000 (Sat, 02 Aug 2008) Log Message: ----------- fix typo in 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 2008-08-02 12:38:57 UTC (rev 5954) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-08-02 12:40:17 UTC (rev 5955) @@ -2956,7 +2956,7 @@ Arguments Description ============== ==================================================== land_color desired land color (color name or rgba tuple). - rgba_ocean desired ocean color (color name or rgba tuple). + ocean_color desired ocean color (color name or rgba tuple). ============== ==================================================== .. tabularcolumns:: |l|L| @@ -2965,7 +2965,7 @@ Keywords Description ============== ==================================================== lakes If True, inland lakes are also colored with - rgba_ocean (default is lakes=False). + ocean_color (default is lakes=False). lsmask An array of 0's for ocean pixels, 1's for land pixels and optionally 2's for inland lake pixels defining a global land-sea mask. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-08-04 11:44:36
|
Revision: 5959 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5959&view=rev Author: jswhit Date: 2008-08-04 11:44:30 +0000 (Mon, 04 Aug 2008) Log Message: ----------- only run meshgrid on lons,lats in rotate_vector if it really makes sense to do so. 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-08-03 18:02:34 UTC (rev 5958) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-08-04 11:44:30 UTC (rev 5959) @@ -2415,7 +2415,13 @@ returns ``uout,vout,x,y`` (where ``x,y`` are the map projection coordinates of the grid defined by ``lons,lats``). """ - if lons.ndim == 1 and lats.ndim == 1: + # if lons,lats are 1d and uin,vin are 2d, and + # lats describes 1st dim of uin,vin, and + # lons describes 2nd dim of uin,vin, make lons,lats 2d + # with meshgrid. + if lons.ndim == lats.ndim == 1 and uin.ndim == vin.ndim == 2 and\ + uin.shape[1] == vin.shape[1] == lons.shape[0] and\ + uin.shape[0] == vin.shape[0] == lats.shape[0]: lons, lats = np.meshgrid(lons, lats) x, y = self(lons, lats) # rotate from geographic to map coordinates. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-08-04 11:49:34
|
Revision: 5960 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5960&view=rev Author: jswhit Date: 2008-08-04 11:49:31 +0000 (Mon, 04 Aug 2008) Log Message: ----------- additional shape checking in rotate_vector. 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-08-04 11:44:30 UTC (rev 5959) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-08-04 11:49:31 UTC (rev 5960) @@ -2423,6 +2423,9 @@ uin.shape[1] == vin.shape[1] == lons.shape[0] and\ uin.shape[0] == vin.shape[0] == lats.shape[0]: lons, lats = np.meshgrid(lons, lats) + else: + if not lons.shape == lats.shape == uin.shape == vin.shape: + raise TypeError("shapes of lons,lats and uin,vin don't match") x, y = self(lons, lats) # rotate from geographic to map coordinates. if ma.isMaskedArray(uin): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-08-04 16:42:15
|
Revision: 5969 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5969&view=rev Author: jswhit Date: 2008-08-04 16:42:04 +0000 (Mon, 04 Aug 2008) Log Message: ----------- raise error if barb method used with matplotlib < 0.98.3 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-08-04 16:25:07 UTC (rev 5968) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-08-04 16:42:04 UTC (rev 5969) @@ -2913,6 +2913,11 @@ Returns two matplotlib.axes.Barbs instances, one for the Northern Hemisphere and one for the Southern Hemisphere. """ + if _matplotlib_version < '0.98.3': + msg = dedent(""" + 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() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-08-06 21:55:49
|
Revision: 5983 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5983&view=rev Author: jswhit Date: 2008-08-06 21:55:46 +0000 (Wed, 06 Aug 2008) Log Message: ----------- extend warpimage method to accept URL's, handle grayscale images. 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-08-06 20:39:42 UTC (rev 5982) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-08-06 21:55:46 UTC (rev 5983) @@ -3104,13 +3104,17 @@ def warpimage(self,image="bluemarble",**kwargs): """ - Display an image (given by ``image`` keyword) as a map background. + Display an image (filename given by ``image`` keyword) as a map background. + If image is a URL (starts with 'http'), it is downloaded to a temp + file using urllib.urlretrieve. Default (if ``image`` not specified) is to display 'blue marble next generation' image from http://visibleearth.nasa.gov/. Specified image must have pixels covering the whole globe in a regular lat/lon grid, starting and -180W and the South Pole. + Works with the global images from + http://earthobservatory.nasa.gov/Newsroom/BlueMarble/BlueMarble_monthlies.html. Extra keyword ``ax`` can be used to override the default axis instance. @@ -3143,11 +3147,22 @@ newfile = True else: newfile = False - self._bm_file = file + if file.startswith('http'): + from urllib import urlretrieve + self._bm_file, headers = urlretrieve(file) + else: + self._bm_file = file # read in jpeg image to rgba array of normalized floats. if not hasattr(self,'_bm_rgba') or newfile: pilImage = Image.open(self._bm_file) self._bm_rgba = pil_to_array(pilImage) + # if pil_to_array returns a 2D array, it's a grayscale image. + # create an RGB image, with R==G==B. + if self._bm_rgba.ndim == 2: + tmp = np.empty(self._bm_rgba.shape+(3,),np.uint8) + for k in range(3): + tmp[:,:,k] = self._bm_rgba + self._bm_rgba = tmp # convert to normalized floats. self._bm_rgba = self._bm_rgba.astype(np.float32)/255. # define lat/lon grid that image spans. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-08-07 20:57:44
|
Revision: 5997 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5997&view=rev Author: jswhit Date: 2008-08-07 20:57:42 +0000 (Thu, 07 Aug 2008) Log Message: ----------- added proj4string attribute. 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-08-07 19:53:52 UTC (rev 5996) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-08-07 20:57:42 UTC (rev 5997) @@ -324,8 +324,8 @@ for crude, ``l`` for low, etc.). If None, no boundary dataset is associated with the Basemap instance. - srs a string representing the 'spatial reference system' - for the map projection as defined by PROJ.4. + proj4string the string describing the map projection that is + used by PROJ.4. ================ ==================================================== **Converting from Geographic (lon/lat) to Map Projection (x/y) Coordinates** @@ -673,7 +673,8 @@ # spatial reference string (useful for georeferencing output # images with gdal_translate). if hasattr(self,'_proj4'): - self.srs = proj._proj4.srs + #self.srs = proj._proj4.srs + self.srs = proj._proj4.pjinitstring else: pjargs = [] for key,value in self.projparams.iteritems(): @@ -686,6 +687,7 @@ continue pjargs.append('+'+key+"="+str(value)+' ') self.srs = ''.join(pjargs) + self.proj4string = self.srs # set instance variables defining map region. self.xmin = proj.xmin self.xmax = proj.xmax This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-08-13 13:11:54
|
Revision: 6029 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6029&view=rev Author: jswhit Date: 2008-08-13 13:11:51 +0000 (Wed, 13 Aug 2008) Log Message: ----------- more kludges for geos 3.0.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 2008-08-12 18:36:29 UTC (rev 6028) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-08-13 13:11:51 UTC (rev 6029) @@ -913,6 +913,12 @@ antart = True else: poly = Shape(b) + # this is a workaround to avoid + # "GEOS_ERROR: TopologyException: + # found non-noded intersection between ..." + # with geos 3.0.0 + if _geoslib.__geos_major_version__ > 2: + poly = poly.simplify(1.e-10) antart = False # create duplicate polygons shifted by -360 and +360 # (so as to properly treat polygons that cross This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-09-11 12:16:19
|
Revision: 6081 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6081&view=rev Author: jswhit Date: 2008-09-11 12:16:16 +0000 (Thu, 11 Sep 2008) Log Message: ----------- map scatter method sets color mappable 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-09-10 18:46:10 UTC (rev 6080) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-09-11 12:16:16 UTC (rev 6081) @@ -2548,6 +2548,11 @@ ax.hold(b) raise ax.hold(b) + # reset current active image (only if pyplot is imported). + try: + plt.gci._current = ret + except: + pass # set axes limits to fit map region. self.set_axes_limits(ax=ax) return ret This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-09-23 19:04:25
|
Revision: 6118 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6118&view=rev Author: jswhit Date: 2008-09-23 18:59:54 +0000 (Tue, 23 Sep 2008) Log Message: ----------- more workarounds for geos library version 3 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-09-23 18:25:27 UTC (rev 6117) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-09-23 18:59:54 UTC (rev 6118) @@ -926,8 +926,12 @@ if not antart: b2[:,0] = b[:,0]-360 poly1 = Shape(b2) + if _geoslib.__geos_major_version__ > 2: + poly1 = poly1.simplify(1.e-10) b2[:,0] = b[:,0]+360 poly2 = Shape(b2) + if _geoslib.__geos_major_version__ > 2: + poly2 = poly2.simplify(1.e-10) polys = [poly1,poly,poly2] else: # Antartica already extends from -360 to +720. polys = [poly] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-09-27 20:33:25
|
Revision: 6125 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6125&view=rev Author: jswhit Date: 2008-09-27 20:33:21 +0000 (Sat, 27 Sep 2008) Log Message: ----------- more fixes for warpimage and cylindrical 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-09-27 17:36:35 UTC (rev 6124) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-09-27 20:33:21 UTC (rev 6125) @@ -3191,10 +3191,24 @@ self._bm_file, headers = urlretrieve(file) else: self._bm_file = file + # bmproj is True if map projection region is same as + # image region. + bmproj = self.projection == 'cyl' and \ + self.llcrnrlon == -180 and self.urcrnrlon == 180 # read in jpeg image to rgba array of normalized floats. if not hasattr(self,'_bm_rgba') or newfile: pilImage = Image.open(self._bm_file) self._bm_rgba = pil_to_array(pilImage) + # define lat/lon grid that image spans. + nlons = self._bm_rgba.shape[1]; nlats = self._bm_rgba.shape[0] + delta = 360./float(nlons) + self._bm_lons = np.arange(-180.+0.5*delta,180.,delta) + self._bm_lats = np.arange(-90.+0.5*delta,90.,delta) + # is it a cylindrical projection whose limits lie + # outside the limits of the image? + cylproj = self.projection in ['mill','cyl','merc'] and \ + (self.urcrnrlon > self._bm_lons[-1] or \ + self.llcrnrlon < self._bm_lons[0]) # if pil_to_array returns a 2D array, it's a grayscale image. # create an RGB image, with R==G==B. if self._bm_rgba.ndim == 2: @@ -3202,16 +3216,15 @@ for k in range(3): tmp[:,:,k] = self._bm_rgba self._bm_rgba = tmp + if cylproj: + # stack grids side-by-side (in longitiudinal direction), so + # any range of longitudes may be plotted on a world map. + self._bm_lons = \ + np.concatenate((self._bm_lons,self._bm_lons+360),1) + self._bm_rgba = \ + np.concatenate((self._bm_rgba,self._bm_rgba),1) # convert to normalized floats. self._bm_rgba = self._bm_rgba.astype(np.float32)/255. - # define lat/lon grid that image spans. - nlons = self._bm_rgba.shape[1]; nlats = self._bm_rgba.shape[0] - delta = 360./float(nlons) - self._bm_lons = np.arange(-180.+0.5*delta,180.,delta) - self._bm_lats = np.arange(-90.+0.5*delta,90.,delta) - - bmproj = self.projection == 'cyl' and \ - self.llcrnrlon == -180 and self.urcrnrlon == 180 if not bmproj: if newfile or not hasattr(self,'_bm_rgba_warped'): # transform to nx x ny regularly spaced native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-09-28 13:29:32
|
Revision: 6130 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6130&view=rev Author: jswhit Date: 2008-09-28 13:29:21 +0000 (Sun, 28 Sep 2008) Log Message: ----------- another fix for warpimage and 'cyl' 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-09-28 13:26:18 UTC (rev 6129) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-09-28 13:29:21 UTC (rev 6130) @@ -3194,7 +3194,8 @@ # bmproj is True if map projection region is same as # image region. bmproj = self.projection == 'cyl' and \ - self.llcrnrlon == -180 and self.urcrnrlon == 180 + self.llcrnrlon == -180 and self.urcrnrlon == 180 and \ + self.llcrnrlat == -90 and self.urcrnrlat == 90 # read in jpeg image to rgba array of normalized floats. if not hasattr(self,'_bm_rgba') or newfile: pilImage = Image.open(self._bm_file) @@ -3216,7 +3217,7 @@ for k in range(3): tmp[:,:,k] = self._bm_rgba self._bm_rgba = tmp - if cylproj: + if cylproj and not bmproj: # stack grids side-by-side (in longitiudinal direction), so # any range of longitudes may be plotted on a world map. self._bm_lons = \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-10-05 13:32:44
|
Revision: 6153 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6153&view=rev Author: jswhit Date: 2008-10-05 13:31:43 +0000 (Sun, 05 Oct 2008) Log Message: ----------- docstring updates 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-10-05 13:26:07 UTC (rev 6152) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-10-05 13:31:43 UTC (rev 6153) @@ -174,7 +174,7 @@ (because either they are computed internally, or entire globe is always plotted). - For the cylindrical projections (``cyl``, ``merc`` and ``mill``), + For the cylindrical projections (``cyl``, ``merc``,``mill`` and ``gall``), the default is to use llcrnrlon=-180,llcrnrlat=-90, urcrnrlon=180 and urcrnrlat=90). For all other projections except ``ortho`` and ``geos``, either the lat/lon values of the @@ -350,8 +350,9 @@ For non-cylindrical projections, the inverse transformation always returns longitudes between -180 and 180 degrees. For - cylindrical projections (self.projection == ``cyl``, ``mill`` or ``merc``) - The inverse transformation will return longitudes between + cylindrical projections (self.projection == ``cyl``, ``mill``, + ``gall`` or ``merc``) + the inverse transformation will return longitudes between self.llcrnrlon and self.llcrnrlat. Input arguments lon, lat can be either scalar floats, sequences @@ -797,8 +798,8 @@ For non-cylindrical projections, the inverse transformation always returns longitudes between -180 and 180 degrees. For cylindrical projections (self.projection == ``cyl``, - ``mill`` or ``merc``) - The inverse transformation will return longitudes between + ``mill``,``gall`` or ``merc``) + the inverse transformation will return longitudes between self.llcrnrlon and self.llcrnrlat. Input arguments lon, lat can be either scalar floats, @@ -2293,8 +2294,8 @@ lons, lats rank-1 arrays containing longitudes and latitudes (in degrees) of input data in increasing order. For non-cylindrical projections (those other than - ``cyl``, ``merc`` and ``mill``) lons must fit - within range -180 to 180. + ``cyl``, ``merc``,``gall`` and ``mill``) lons must + fit within range -180 to 180. nx, ny The size of the output regular grid in map projection coordinates ============== ==================================================== @@ -2364,8 +2365,8 @@ lons, lats rank-1 arrays containing longitudes and latitudes (in degrees) of input data in increasing order. For non-cylindrical projections (those other than - ``cyl``, ``merc`` and ``mill``) lons must fit - within range -180 to 180. + ``cyl``, ``merc``,``gall`` and ``mill``) lons must + fit within range -180 to 180. nx, ny The size of the output regular grid in map projection coordinates ============== ==================================================== @@ -2436,8 +2437,8 @@ lons, lats Arrays containing longitudes and latitudes (in degrees) of input data in increasing order. For non-cylindrical projections (those other than - ``cyl``, ``merc`` and ``mill``) lons must fit - within range -180 to 180. + ``cyl``, ``merc``,``gall`` and ``mill``) lons must + fit within range -180 to 180. ============== ==================================================== Returns ``uout, vout`` (rotated vector field). @@ -3231,15 +3232,15 @@ tmp[:,:,k] = self._bm_rgba self._bm_rgba = tmp if cylproj and not bmproj: - # stack grids side-by-side (in longitiudinal direction), so - # any range of longitudes may be plotted on a world map. + # stack grids side-by-side (in longitiudinal direction), so + # any range of longitudes may be plotted on a world map. self._bm_lons = \ np.concatenate((self._bm_lons,self._bm_lons+360),1) self._bm_rgba = \ np.concatenate((self._bm_rgba,self._bm_rgba),1) # convert to normalized floats. self._bm_rgba = self._bm_rgba.astype(np.float32)/255. - if not bmproj: + if not bmproj: # interpolation necessary. if newfile or not hasattr(self,'_bm_rgba_warped'): # transform to nx x ny regularly spaced native # projection grid. @@ -3298,6 +3299,7 @@ # plot warped rgba image. im = self.imshow(self._bm_rgba_warped,ax=ax) else: + # bmproj True, no interpolation necessary. im = self.imshow(self._bm_rgba,ax=ax) return im This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-10-05 13:36:08
|
Revision: 6154 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6154&view=rev Author: jswhit Date: 2008-10-05 13:33:26 +0000 (Sun, 05 Oct 2008) Log Message: ----------- docstring updates. 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-10-05 13:31:43 UTC (rev 6153) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-10-05 13:33:26 UTC (rev 6154) @@ -3917,6 +3917,9 @@ assert_almost_equal(rv[2, :],[1,1,-1,-1], 6) def test(): + """ + Run some tests. + """ import unittest suite = unittest.makeSuite(TestRotateVector,'test') runner = unittest.TextTestRunner() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-10-05 13:39:13
|
Revision: 6155 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6155&view=rev Author: jswhit Date: 2008-10-05 13:38:11 +0000 (Sun, 05 Oct 2008) Log Message: ----------- docstring formatting fixes 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-10-05 13:33:26 UTC (rev 6154) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-10-05 13:38:11 UTC (rev 6155) @@ -174,7 +174,7 @@ (because either they are computed internally, or entire globe is always plotted). - For the cylindrical projections (``cyl``, ``merc``,``mill`` and ``gall``), + For the cylindrical projections (``cyl``, ``merc``, ``mill`` and ``gall``), the default is to use llcrnrlon=-180,llcrnrlat=-90, urcrnrlon=180 and urcrnrlat=90). For all other projections except ``ortho`` and ``geos``, either the lat/lon values of the @@ -798,7 +798,7 @@ For non-cylindrical projections, the inverse transformation always returns longitudes between -180 and 180 degrees. For cylindrical projections (self.projection == ``cyl``, - ``mill``,``gall`` or ``merc``) + ``mill``, ``gall`` or ``merc``) the inverse transformation will return longitudes between self.llcrnrlon and self.llcrnrlat. @@ -2294,7 +2294,7 @@ lons, lats rank-1 arrays containing longitudes and latitudes (in degrees) of input data in increasing order. For non-cylindrical projections (those other than - ``cyl``, ``merc``,``gall`` and ``mill``) lons must + ``cyl``, ``merc``, ``gall`` and ``mill``) lons must fit within range -180 to 180. nx, ny The size of the output regular grid in map projection coordinates @@ -2365,7 +2365,7 @@ lons, lats rank-1 arrays containing longitudes and latitudes (in degrees) of input data in increasing order. For non-cylindrical projections (those other than - ``cyl``, ``merc``,``gall`` and ``mill``) lons must + ``cyl``, ``merc``, ``gall`` and ``mill``) lons must fit within range -180 to 180. nx, ny The size of the output regular grid in map projection coordinates @@ -2437,7 +2437,7 @@ lons, lats Arrays containing longitudes and latitudes (in degrees) of input data in increasing order. For non-cylindrical projections (those other than - ``cyl``, ``merc``,``gall`` and ``mill``) lons must + ``cyl``, ``merc``, ``gall`` and ``mill``) lons must fit within range -180 to 180. ============== ==================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-10-24 12:14:38
|
Revision: 6317 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6317&view=rev Author: jswhit Date: 2008-10-24 11:43:31 +0000 (Fri, 24 Oct 2008) Log Message: ----------- defer import of netcdf module 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-10-24 06:51:29 UTC (rev 6316) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-10-24 11:43:31 UTC (rev 6317) @@ -36,7 +36,7 @@ import numpy as np import numpy.ma as ma from shapelib import ShapeFile -import _geoslib, netcdf, netcdftime +import _geoslib, netcdftime # basemap data files now installed in lib/matplotlib/toolkits/basemap/data basemap_datadir = os.sep.join([os.path.dirname(__file__), 'data']) @@ -3758,6 +3758,7 @@ accesses to the same URL avoid the network. """ + import netcdf if file.startswith('http'): return netcdf._RemoteFile(file,maskandscale=maskandscale,\ cache=cache,username=username,password=password,verbose=verbose) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-11-07 12:30:14
|
Revision: 6369 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6369&view=rev Author: jswhit Date: 2008-11-07 12:30:08 +0000 (Fri, 07 Nov 2008) Log Message: ----------- added masked array support to addcyclic function (thanks to Jesper Larsen) 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-11-06 22:53:02 UTC (rev 6368) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-11-07 12:30:08 UTC (rev 6369) @@ -3679,8 +3679,14 @@ if lon0 < lonsin[0] or lon0 > lonsin[-1]: raise ValueError, 'lon0 outside of range of lonsin' i0 = np.argmin(np.fabs(lonsin-lon0)) - dataout = np.zeros(datain.shape,datain.dtype) - lonsout = np.zeros(lonsin.shape,lonsin.dtype) + if hasattr(datain,'mask'): + datout = ma.zeros((nlats,nlons+1),datain.dtype) + else: + datout = np.zeros((nlats,nlons+1),datain.dtype) + if hasattr(lonsin,'mask'): + lonsout = ma.zeros(nlons+1,lonsin.dtype) + else: + lonsout = np.zeros(nlons+1,lonsin.dtype) if start: lonsout[0:len(lonsin)-i0] = lonsin[i0:] else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-11-08 17:02:42
|
Revision: 6374 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6374&view=rev Author: jswhit Date: 2008-11-08 17:02:38 +0000 (Sat, 08 Nov 2008) Log Message: ----------- add mmap keyword to NetCDFFile (as yet undocumented) 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-11-07 16:53:31 UTC (rev 6373) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-11-08 17:02:38 UTC (rev 6374) @@ -3735,7 +3735,7 @@ else: return corners -def NetCDFFile(file, mode='r', maskandscale=True, cache=None,\ +def NetCDFFile(file, mode='r', maskandscale=True, cache=None, mmap=True,\ username=None, password=None, verbose=False): """NetCDF File reader/writer. API is the same as Scientific.IO.NetCDF. @@ -3769,7 +3769,7 @@ return netcdf._RemoteFile(file,maskandscale=maskandscale,\ cache=cache,username=username,password=password,verbose=verbose) else: - return netcdf.netcdf_file(file,mode=mode,maskandscale=maskandscale) + return netcdf.netcdf_file(file,mode=mode,mmap=mmap,maskandscale=maskandscale) def num2date(times,units='days since 0001-01-01 00:00:00',calendar='proleptic_gregorian'): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-11-08 17:08:28
|
Revision: 6375 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6375&view=rev Author: jswhit Date: 2008-11-08 17:08:25 +0000 (Sat, 08 Nov 2008) Log Message: ----------- add docstring for mmap NetCDFFile keyword. 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-11-08 17:02:38 UTC (rev 6374) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-11-08 17:08:25 UTC (rev 6375) @@ -3763,6 +3763,9 @@ ``cache`` is a location (a directory) for caching data, so that repeated accesses to the same URL avoid the network. + The keyword ``mmap`` is only valid for local netCDF files. When + ``mmap=True`` (default), the mmap module is used to access the data. + This may be slow for very large netCDF variables. """ import netcdf if file.startswith('http'): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-12-06 14:36:02
|
Revision: 6500 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6500&view=rev Author: jswhit Date: 2008-12-06 14:35:51 +0000 (Sat, 06 Dec 2008) Log Message: ----------- updated blue marble URL 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-05 21:09:42 UTC (rev 6499) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-06 14:35:51 UTC (rev 6500) @@ -3167,7 +3167,7 @@ Specified image must have pixels covering the whole globe in a regular lat/lon grid, starting and -180W and the South Pole. Works with the global images from - http://earthobservatory.nasa.gov/Newsroom/BlueMarble/BlueMarble_monthlies.html. + http://earthobservatory.nasa.gov/Features/BlueMarble/BlueMarble_monthlies.php. Extra keyword ``ax`` can be used to override the default axis instance. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-12-12 17:24:02
|
Revision: 6593 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6593&view=rev Author: jswhit Date: 2008-12-12 17:23:57 +0000 (Fri, 12 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-12 14:55:12 UTC (rev 6592) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-12 17:23:57 UTC (rev 6593) @@ -3155,6 +3155,8 @@ Default image size is 5400x2700, which can be quite slow and use quite a bit of memory. The ``scale`` keyword can be used to downsample the image (``scale=0.5`` downsamples to 2700x1350). + + \**kwargs passed on to :meth:`imshow`. """ if ax is not None: return self.warpimage(image='bluemarble',ax=ax,scale=scale,**kwargs) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |